PDA

View Full Version : graphic game display speed



EricLang
19-03-2009, 11:36 AM
I'm wondering...
I created a lemmings clone with the Graphics32 library and this works quite ok.
Planning to recreate the game in a more flexible way. Is the use of OpenGL for a 2D game really needed? Is the screenoutput really faster than when I use graphics32?

jdarling
19-03-2009, 01:51 PM
Well... The main advantage of going with OpenGL is going to be cross platform. Of course this is only useful if your using Lazarus/FPC, as Delphi no longer supports cross platform compilation.

A game such as Lemmings can actually be done with GDI and still get a good player experience. Nothing fancy needed.

If you plan on adding in particle effects, fades, 3d backgrounds, blooms, lighting, shaders, bla, bla, bla then yes OpenGL wins. Mainly due to the fact its already been done for you and its methods are supported almost universally.

Hope that helps,
- Jeremy

Memphis
19-03-2009, 01:59 PM
it is also a good start for learning opengl

EricLang
19-03-2009, 02:02 PM
That helps :) If the theoretical framerate is not at least doubled when using OpenGL I doubt if I want to dive into this OpenGL-world.
I do not need very advanced graphical effects. Maybe some fade-out or highlighting that's it.
However, if I find a fellow programmer who is experienced and can convince me I will think about it :)

jdarling
19-03-2009, 02:14 PM
Oh, you WILL get a higher framerate with OpenGL than with GDI/Graphics32. The question is do you actually need one. Typically 2D simple games like Lemmings can run at 30fps and no one notices/cares. This is "Retro Gaming" after all.

- Jeremy

PS: Graphics32 does support fading and something akin to blooms/lights. So really you could do it all in Graphics32 if you want. Best bet is to write it in a way that the render doesn't matter, build your first render in Graphics32, then build one in OpenGL, and build one in DirectX. This way you have a working (Graphics32) to compare results with.

WILL
19-03-2009, 03:46 PM
Just a note on fading. Full screen fades are slower than ever in ANY non-hardware accelerated method. I'm not saying that you can only do them in OpenGL or Direct3D, but without hardware anything like fading, rotation, scaling, or more will be much much slower without hardware acceleration support.

Back in the DOS days early graphics programmers would use special features of the CPU (MMX, other Pentium features, etc) to try to boost their drawing speed, but this often required the use of Assembly which I don't think is all that accessible or easy to do these days on modern Windows.

Lets face it, you won't 'need' to use OpenGL or DirectX, but honestly it will make your game lighter on resources and in turn less sluggish and easier to do fast graphics enhance the look with a little bit of bling on your screen. ;)

End sales pitch... :P

User137
19-03-2009, 08:16 PM
It's not just the effects that you can add, but when it comes to simple drawing is also much faster with hardware acceleration. You can have much much more happening on the screen same time. Of course that will bring challenges when trying to bring out fonts and textures but some libs exist to do that for you, if not bothered to create them by self.

EricLang
19-03-2009, 09:14 PM
Probably true all that, but just starting with opengl is rather complicated.

pstudio
20-03-2009, 12:01 PM
If you don't want to dig deep into OGL or DirectX then there are libraries that abstact these API's into something easier and more quick to work with like Phoenix and Asphyre. IMO the advantages are just to many to not use either OGL or DirectX. Sure you could probably do lemmings with Graphics32, but if you wanted to make a new game or make some big changes to lemmings, then you will need a 3D hardware api.

EricLang
28-03-2009, 10:50 AM
Ok, I'm going to give it a try.
The OpenGL unit that comes with Delphi7, is that usable?
I saw some example-projects at http://www.sulaco.co.za/tut.htm.
Is this a reasonable starting point?

pstudio
28-03-2009, 12:48 PM
I've used the DGL OpenGL header from DelphiGL.com in the past, but I don't know how up to date it is now.

You probably also want to look at nehe.gamedev.com and the tutorials. I think many of us has stopped by that site at some time.