[programming] Info on 2D games using OpenGL
Moderator: Oberlus
[programming] Info on 2D games using OpenGL
To the programmers:
I'm diverting my AXIS project for a while to get into some other things. I'm wanting to create a 2D side-scrolling game but my inital tests show a serious lack of framerate for any realistically playable game @ 1024x768 using SDL. Some have suggested i use OpenGL instead.
Are there any resources on the net for making 2D games with OpenGL? I can't find much on the topic. I ask because i know that's basically what FO is already doing.
Thanks for any tips.
I'm diverting my AXIS project for a while to get into some other things. I'm wanting to create a 2D side-scrolling game but my inital tests show a serious lack of framerate for any realistically playable game @ 1024x768 using SDL. Some have suggested i use OpenGL instead.
Are there any resources on the net for making 2D games with OpenGL? I can't find much on the topic. I ask because i know that's basically what FO is already doing.
Thanks for any tips.
Basically you want to be using glOrtho instead of glPerspective iirc. You can find tutorials here on OpenGL:
http://nehe.gamedev.net/
And in particular this one on 2D:
http://nehe.gamedev.net/data/lessons/le ... ?lesson=21
http://nehe.gamedev.net/
And in particular this one on 2D:
http://nehe.gamedev.net/data/lessons/le ... ?lesson=21
It is not that hard!
OpenGL programming guide: http://fly.cc.fer.hr/~unreal/theredbook/
NeHe's OpenGL tutorials: http://nehe.gamedev.net/
OpenGL programming guide: http://fly.cc.fer.hr/~unreal/theredbook/
NeHe's OpenGL tutorials: http://nehe.gamedev.net/
lev, you said somewhere on your axis page that you were finding SDL too slow (at least w.r.t. alpha channel PNGs). For a turn based strategy game i find this worrying, since i'm about to start porting my project over to SDL.
Just how bad is it? I'm planning on using alpha channel PNGs quite a lot, and while i'm not expecting to produce anything quite as eye catching as FO, i'd still like it to look pretty polished on the starmap screen while keeping a high framerate when scrolling, zooming and rotating (i may include the option for 3-d maps at some point).
Do you think SDL is going to be up to the job, or should i be looking at OpenGL myself?
Just how bad is it? I'm planning on using alpha channel PNGs quite a lot, and while i'm not expecting to produce anything quite as eye catching as FO, i'd still like it to look pretty polished on the starmap screen while keeping a high framerate when scrolling, zooming and rotating (i may include the option for 3-d maps at some point).
Do you think SDL is going to be up to the job, or should i be looking at OpenGL myself?
The COW Project : You have a spy in your midst.
for a TBS game, SDL is plenty good. For an action game with high resolutions, it's not. However, the game i want to make (one of, i should say would include lots of eye-candy like multiple parallax background (like the FO map), particle effects (what i'm working on now), lighting, etc. I can fake a lot of that with SDL, but OpenGL has very good framerates for simple textured-quads right out of the gate.
I'll send you my framerate SDL particle demo (it's cool besides) and you can test for yourself. It's simple to compile. When blitting a 1024x768 BMP converted to the screen format, plus simulating ~1000 particles, i get fps of about 30-45+. (not bad)
For a PNG image with no conversion, i only get 20-25.
That's with no game logic (collision checking, sprite blitting, AI, GUI, etc).
For AXIS, i converted all my map tiles to BMP format and noticed an emmediate jump in performance since i draw all tiles overy time the map moves. Now i learned that you need to convert the surface to screen format for optimum performance. That will get me going even faster.
For your game, SDL is the perfect solution. GL is too much overkill for that kind of project (unless you want some extreme eye-candy) for sure.
Also, ParaGUI has resumed active development which is pretty exciting. They are focusing on speeding up the library. Current tests put the new version 25-50% faster than what i'm using now. Grab PG and SDL and you'll have graphics in a matter of minutes, really.
NOTE: it is possible to integrate SDL and OpenGL (FO does it) and it's slicker'n snot. SDL handles all the windowing and OpenGL handles the actual graphics. It's MUCH simpler than trying to manage windows with the native MSWindows / X Server commands. So learning basic SDL is to your benefit anyway.
I'll send you my framerate SDL particle demo (it's cool besides) and you can test for yourself. It's simple to compile. When blitting a 1024x768 BMP converted to the screen format, plus simulating ~1000 particles, i get fps of about 30-45+. (not bad)
For a PNG image with no conversion, i only get 20-25.
That's with no game logic (collision checking, sprite blitting, AI, GUI, etc).
For AXIS, i converted all my map tiles to BMP format and noticed an emmediate jump in performance since i draw all tiles overy time the map moves. Now i learned that you need to convert the surface to screen format for optimum performance. That will get me going even faster.
For your game, SDL is the perfect solution. GL is too much overkill for that kind of project (unless you want some extreme eye-candy) for sure.
Also, ParaGUI has resumed active development which is pretty exciting. They are focusing on speeding up the library. Current tests put the new version 25-50% faster than what i'm using now. Grab PG and SDL and you'll have graphics in a matter of minutes, really.
NOTE: it is possible to integrate SDL and OpenGL (FO does it) and it's slicker'n snot. SDL handles all the windowing and OpenGL handles the actual graphics. It's MUCH simpler than trying to manage windows with the native MSWindows / X Server commands. So learning basic SDL is to your benefit anyway.
Smart... i guess you are drawing a lot more stuff than i would be - youre having to blit every tile whereas i would be effectively drawing over a black background. I will start with SDL and see how it goes. Thanks.
The COW Project : You have a spy in your midst.
That's actually a good point. I'm drawing 22x24= 488? tiles every scroll. Then, add on top of that vision circles, pods, and map items (which are all still PNGs by the way).
For your game, the map window is just:
1) draw stary black background
2) draw each star, and how many of them can there be at once? Even if you use the full zoom, that's still only a couple hundred.
I would say feel free to use PNG graphics for that. It's no problem. Did you get the demo i sent?
For your game, the map window is just:
1) draw stary black background
2) draw each star, and how many of them can there be at once? Even if you use the full zoom, that's still only a couple hundred.
I would say feel free to use PNG graphics for that. It's no problem. Did you get the demo i sent?
Ah, yes - just checked my home account and there is a rather large file waiting for me - thanks.
Will hopefully have a look at it tonight - if i manage to get out of work in time.
Will hopefully have a look at it tonight - if i manage to get out of work in time.
The COW Project : You have a spy in your midst.
-
- Pupating Mass
- Posts: 90
- Joined: Thu Nov 06, 2003 3:16 am
- Location: West Sussex, United Kingdom
On the subject of ParaGUI, does anyone know why their website takes a heck of a long time to load in the browser? I've only managed to do it once recently, the rest of the time i get bored...leiavoia wrote:Also, ParaGUI has resumed active development which is pretty exciting.
Chris Walker
| c.walker (at) mgt.hull.ac.uk |
WorldForge.org
| c.walker (at) mgt.hull.ac.uk |
WorldForge.org
Nah, there is something very wrong with that domain, always has been.
I can load it at home just fine, but if i try to access it from work i just sits there. Something is wrong with its something or other thingy. Thats the problem.
Maybe try accessing it through a proxy service or somthing? (i would try, but i cant cos i'm at work and such things get blocked )
I can load it at home just fine, but if i try to access it from work i just sits there. Something is wrong with its something or other thingy. Thats the problem.
Maybe try accessing it through a proxy service or somthing? (i would try, but i cant cos i'm at work and such things get blocked )
The COW Project : You have a spy in your midst.
-
- Pupating Mass
- Posts: 90
- Joined: Thu Nov 06, 2003 3:16 am
- Location: West Sussex, United Kingdom
Thats it. I access through a Uni proxy. My brother says it loads fine at homw too. Damn Halls with their shody internet connections!!! LOL. Well at least its free...Maybe try accessing it through a proxy service or somthing? (i would try, but i cant cos i'm at work and such things get blocked)
Chris Walker
| c.walker (at) mgt.hull.ac.uk |
WorldForge.org
| c.walker (at) mgt.hull.ac.uk |
WorldForge.org
Re: [programming] Info on 2D games using OpenGL
(Better reply late than never )leiavoia wrote:Some have suggested i use OpenGL instead.
Thanks for any tips.
I find allegro very suited for 2D-games. It is cross-platform, and uses Hardware-accel wherever possible. It also has a midi-sequencer, zooming and a (small) GUI built in.
http://alleg.sourceforge.net (!)
too late. I've already converted to OpenGL. It took me the whole weekend to get my crash-course, but i know enough now to reconstruct my demo in OpenGL instead of SDL. Here are some relatively recent screenshots:
http://forum.orionsector.com/viewtopic.php?t=1300
Right now i'm working on the collision detection backend and streamlining some quadtree structures. fun!
http://forum.orionsector.com/viewtopic.php?t=1300
Right now i'm working on the collision detection backend and streamlining some quadtree structures. fun!