PDA

View Full Version : New to Game Programming, Old Applicatoin Programmer



captainproton
07-07-2007, 10:18 PM
I discovered this Forum a week ago when I was researching Graphics Programming in Delphi / Pascal and wanted to join in because I will have questions in the future.

I wrote a simple slot machine for my wife who loves playing them. Personally I hate them! I released it as shareware and it is selling quite well.

I know, slot machines are easy and don't require to much thinking to write one but in the future it will become difficult for me as I attempt to recreate it / convert it to OpenGL, DirectX or something to assist in the graphical animation of portions of it.

So, here I am! Expect questions about Graphics because I am out of my comfort zone. An application programmer for 15 years and very comfortable in what I do but now I am stepping into the ocean of graphics and think I am probably going to drown.

Out of interest you can get the slot machine at http://ps.craigedgar.com

If anyone here wants a license for it, let me know.

Look forward to bugging you all with strange questions soon .

Craig :shock:

czar
07-07-2007, 11:30 PM
It looks to me like you already have graphics and a visually attractive application/program. What do you think you would do if you used opengl or directx?

I think for many people there is big jump from writing an application, that reacts to events to a program that continually refreshes the screen.

If you start using opengl or directx then obviously you would no longer be using the vcl. The downside is that you will need to code objects for the equivalent of buttons, edit box etc. The upside is that you can make your screens look very different from windows application and give it much more of a wow factor.

WILL
08-07-2007, 05:34 AM
Hi Craig,

Welcome to PGD! :)

Working with DirectX and OpenGL for the first while can seem a bit daunting, but once you start getting something working and seeing how it comes together, it's quite fun.

Depending on your comfort with code, you may want to either work with a game library like Omega, Asphyre, S2DL or Phoenix OR if you are a bit more into getting right to the guts of how it's done, you can pick up a set of 'headers' for either DirectX, OpenGL or SDL.

Recomended header packages:

DirectX -- Clootie's Graphics pages (see links page under 'Tool & Library Developers')

OpenGL -- (there are several really; Noeska has a set, DelphiGL.com(German language site), Free Pascal repository, JEDI-SDL package)

SDL -- JEDI-SDL


Depending on what compiler/platforms you want to use there are many options...

captainproton
08-07-2007, 09:10 AM
Czar, thanks for your comments. What I would like to do is include animations and other such things. I would like to see the Reels animated as they roll and perhaps bounce a bit at the end. I feel that the game is pretty good as it is (according to the people that buy it) but I am always trying to make things better. My wife plays these things and they all seem to have one thing in common - animations and they cope well on slow machines where as Picture Slots can struggle as I draw various bitmaps onto a canvas one reel at a time.

Will, I have looked at some of the OpenGL and DirectX stuff and my biggest problem is terminology. I simply don't understand some of the things they talk about. Trying to find a tutorial suitable for my 45 year old brain is very hard.

I started out as a COBOL programmer many years ago, went on to BASIC, then PASCAL (which I did because I needed something for my BBS that BASIC couldn't do). That was 15 years ago and until now no graphics programming has been required. I wish I had learned some of this stuff while my mind was a knowledge sponge.

Right now, if I am to learn new tricks I must delete old ones.

I guess moving to any Graphics Platform isn't a big deal, I have just enjoyed reading posts on this forum and wanted to get involved.

Craig

dmantione
08-07-2007, 10:44 AM
How about the Friends of FPC OpenGL tutorial? Unlike most other toturials you will find, this one assumes you code in Pascal :) http://www.friends-of-fpc.org/tutorials/graphics/dlx_ogl/

captainproton
08-07-2007, 07:07 PM
Aha, the Free Pascal thing reminds me of the good old days of Pascal when writing pure code was the only way to get things done.

Thanks for the link to the OpenGL Tutorial - I am reading it now.

In my game the background is static. The only things that really change are the Reels which are painted one cell at a time to form a complete column and then drawn on screen.

I have tried to draw on a tbitmap in memory then flip it onto the visible screen but it creates a lot of flicker. The form1.doublebuffered property works well to resolve screen flicker.

czar
08-07-2007, 07:30 PM
Hi again,

Even old delphix would probably be suffciient for you. The major plus point of using dephix is that your program would still work on older directx 7 hardware. I.e. You could make it work on most computers out here.

Most of the other graphics systems are now requiring DirectX 9. As for OpenGL my own experience is that OpenGL programs are a huge problem when you sell to people that do not have gaming computers. If they do not have a gaming computer then they usually don't have a decent video card and that means they are probably using the Microsoft OpenGL driver which is to put it bluntly sucks.

I had a product on the market that worked using both Graphics32 and OpenGL. The OpenGL version of the app had superior features to the Graphics32 version however, I found most people were unable to use the OpenGL version because of the lack of decent drivers.

captainproton
08-07-2007, 08:44 PM
I would like to maintain maximum compatibility with older machines. Most machines purchased these days seem to have integrated video cards which don't lend themselves well to gaming.

Although my game isn't very graphics intensive and I don't think it will ever be I certainly don't want to limit my potential market to those who have the sense to buy machines with a separate GPU.

DirectX is also something that has confused me over the past few months. When all I want to do is convert my existing Reel which is painted slowly into some form of fast / smooth animation. Just to make it look pretty, it wont change the functionality of the program at all.

I have discovered that the game looks like crap on Vista because of the 120DPI resolution it uses rather than the normal 96. I figured that DirectX / OpenGL would resolve that issue and allow it to look consistant.

If I could figure out how to force Vista into 96DPI my problems would be eased.

czar
08-07-2007, 09:28 PM
Set form scaled to false. Most vista machines will be in normal 96dpi.

Use DelphiX for your app - it is easy to learn and will work on a wide range of machines and hardware types. I made a maths cdrom a number of years ago using delphix and it works on just about anything. We get no complaints about compatibility problems.

Obviously DelphiX has a few limitations but nothing that would hinder you for this project.

WILL
08-07-2007, 10:25 PM
I would stick to the concept of pixels rather than dpi when working with computer graphics.

DPI(dots per inch) is a translation from computer graphics to physical print. Where as you are solely working with pixels on a screen. dpi doesn't make much sense in this form of use.


Another alternative to DirectX (or DelphiX) is to use SDL. (www.libsdl.org) Which is a cross-platform alternative to both DirectX and OpenGL. (though you can use OpenGL with it for use of your 3D hardware)

The great thing about SDL is that you don't have to worry about your users having the correct version of SDL installed or not. (except if they are running Linux) You provide can freely include the version of SDL they need to run the game in the form of dll files.

JEDI-SDL is a great package that allows you to do all of your SDL stuff, with a ton of examples. The only downside is that it's not component based so you can't just drop some stuff into a Windows form and make it all Windows GUI friendly, you'd have to work with a window or fullscreen full of graphics of your own design.

You can checkout JEDI-SDL at jedi-sdl.pascalgamedevelopment.com (http://jedi-sdl.pascalgamedevelopment.com/)

czar
08-07-2007, 10:45 PM
DPI in forms is something different and has nothing to do with print to paper. If you create a VCL application you will need to deal with DPI differences. I have two of my machines at home on 120DPI with 22" 16:10 LCD screens and one other machine is still 96dpi with an older 19" 4:3 LCD so I am starting to get used to working with multiple DPI settings.

captainproton
08-07-2007, 11:25 PM
I am very aware of the DPI issues when printing, but Csar is right. When displaying a form on 96DPI things look good, but move to another machine with 120DPI and things go bad unless you handle them.

Mu problem was that some buttons were BltBtn's which would appear wider than the glyph being displayed. I converted them all to Speedbutton's and made them transparent and it fixed the problem. But the buttons still weren't being drawn in the correct location. Where there may have been a gap of 50 pixels at 96DPI that gap grew to about 100 pixels at 120DPI. I know that the actual pixels are the same but the 120DPI stretches things out.

I like JEDI stuff and will take a look at it.

Thanks for all the comments so far, it is fun talking to fellow programmers rather than just talking to myself which is what I do a lot of.

czar
08-07-2007, 11:41 PM
Did you try setting Form property "scaled := false;"


?

captainproton
09-07-2007, 12:38 AM
Yes, I have set scaling to false previously without any effect. I also have stuff relating to enumdisplaysettings which I shall remove for the duration and try the scaling again in case there is something in there screwing around with it.

captainproton
10-07-2007, 10:03 PM
Ok, I previously said that I had set scaling to false! Well, I had but for some reason it didn't fix my problem. But now when I set it to false it works perfectly.

I don't understand why it didn't work in the past unless there was something else mucking up.

Thanks Czar for your help. Now all I got to do is convert the remaining BltBtn's to Speedbuttons and I am set.

My next hurdle is creating nicely animated Reels. Will play with DanjetX for that and other stuff.

I will make some changes and upload the game to my web site so that all those poor saps with Vista can play.

Thanks again.

Craig

czar
10-07-2007, 10:16 PM
I use DanjetX on a daily basis for my work. Just be aware that it does require DirectX 9 and some of your people may not be able to run a DirectX 9 application. The DanJetX forum is a great place to get help if you need specific danjetx support.

WILL
11-07-2007, 04:36 AM
Personally I think DanJetX looks great, but I don't know it it's really something for beginners to tackle right out of the box as it where.

I'd recommend something more along the lines of DelphiX or JEDI-SDL. I could be wrong though... :)

czar
11-07-2007, 04:57 AM
I agree - that is why I suggested delphix to him - ease of use is similar to danjetx. But his software appeals to people who tend not buy new hardware very often so DelphiX would be more suitable to ensure compatibility. I mean the normal DelphiX that still only requires DirectX 7.

WILL
11-07-2007, 06:19 AM
Well sadly with the loss of the Turbo site older DelphiX is hard to get your hands on now.

Fret not... PGD is planning on taking over hosting responsibilities... --well mostly-- of the New DelphiX packages.

Jaro and Dom both seem enthusiastic about the idea. All that is pending is the implementation.

jdarling
11-07-2007, 12:25 PM
DelphiX or JEDI-SDL would both be good starting points. Though personally I would recommend Phoenix or S2DL. Why, because they are both wrappers around JEDI-SDL and thus both cross platform. Supporting MAC users and Linux users in a selling product is never a bad thing.

You could re-build the game in either in a matter of hours. Granted to get the real cross-platform support you will have to switch to FPC or Lazarus.

More info:
Phoenix PGD Thread: http://www.pascalgamedevelopment.com/viewtopic.php?t=3345&highlight=phoenix
Phoenix Home Page: http://www.phoenixlib.net/
S2DL Home Page: http://thegamedeveloper.co.za/?page_id=61

Also, both authors (Andreaz and Cairns) are normal visitors and posters to PGD so support shouldn't be difficult.

Just my two cents.

WILL
11-07-2007, 02:22 PM
I've posted a WIP of the big grand master list here: Pascal Dev Guides (http://www.pascalgamedevelopment.com/viewtopic.php?p=36290#36290)

If anyone feels that I've missed any (another list specifically for 3D engines is forthcoming) let me know.

captainproton
11-07-2007, 07:33 PM
I was aware of DelphiX a month ago and did have trouble finding it. When ever it looked hopeful, the page wouldn't load or the file was not found so I gave up on it.

There are so many choices it's hard to know what to do do - and I am not likely to be producing any more games in the future. I wanted some graphics engine for one job only and don't want to spend 4 years at University learning how to use it.

I guess I am a lazy programmer. If I can't get it to work in 4 seconds then I give up. "If in doubt, throw it out!".

Craig

WILL
11-07-2007, 08:28 PM
DelphiX is getting a new home. Worry not. ;)