Sign in to follow this  
grechzoo

Starting a new 2D game, want to assess my option instead ofgoing straight back to SDL.

Recommended Posts

grechzoo    100
[i] (this is a personally question regarding my project and I am not trying to make another SDL vs DirectX vs OpenGL)[/i]


I will be working on a new 2d top down game, that will not really need any 3d assets, but I want to ask about my choices.

Previously I have used SDL but I feel like the performanceof the image blitting is a little sluggish, even on a 2.4ghz processor one of my game prototypes would sometimes chug. And I need this game to perform well as it’s a big project rather than a simple prototype, so the choice I make must be flexible, powerful and reliable.

So basically my question is, even for a 2d game, are OpenGL and DirectX the more flexible choices, and will they significantly open up my possibilities with my game compared to just using SDL alone? Or does their focus on 3D make their benefits negligible for my purposes?

Also which would you recommend? I know with OpenGL, SDLs input controls and audio mixer are still needed. Is DirectX the better choice for those types of things then? (im porgramming in C++)

Anyway depending on my advice i am going to start learning one of them no matter what. Are there any recommendations on books that don’t just focus on the 3d rendering side of the APIs? Considering I wont be using that aspect for this project.

Many thanks and I truly appreciate any advice offered.

Share this post


Link to post
Share on other sites
Gamer Gamester    140
OpenGL can work well for a 2d game. You'll be making your own 2d engine on top of it -- a bit of a task, though much more approachable than a 3d engine. If you have some experience programming, it could be a good way to go. If it's one of your first programming projects, then it'll probably be more satisfying to use an existing 2d engine.

You can ignore the 3d aspects of OpenGL pretty easily. Look up how to use an orthographic projection.

I've only used OpenGL (for cross-platform reasons), but I get the impression that DirectX work similarly for this purpose.

Share this post


Link to post
Share on other sites
BrianJensen    343
I am thinking you were doing something wrong with SDL. Even when I had a few hundred animated sprites on the screen with animated tiles on a scrolling map RPG demo operating on a netbook it wasn't sluggish. Handling inputs easily.

Not related to SDL but my cheap 30$ mobile phone can handle path finding, completely random map generation scrolling RPG with hundreds of images on the screen at the same time. Handle user inputs without so much as a hiccup. Though written in Java, it is still a budget budget smart phone. 2 budgets it is that cheap.

Share this post


Link to post
Share on other sites
mhagain    13430
Pick either OpenGL or D3D, though I'd guess that OpenGL would feel a bit more familiar to you in some respects, coming from SDL. Either way though, the way you need to draw stuff, update the screen, etc is significantly different so you've got enough new concepts to be getting on with.

Whichever you pick doesn't affect how you handle input and sound - you can continue to use SDL for these without trouble. I'd definitely advise only changing one thing at a time so stick with SDL there.

Share this post


Link to post
Share on other sites
japro    887
If you are programming in C++ also check out [url="http://www.sfml-dev.org/"]SFML[/url]. It does mostly the same things SDL does but in a more straight forward and C++ish way. Also it uses OpenGL for rendering and you can mix it with ogl easily if you wish.

Share this post


Link to post
Share on other sites
grechzoo    100
thanks guys.

and 0circle0 i think it was my pc (needs a reformat)

still i want to learn a more advanced API and oto OpenGL looks like the way to go,

Share this post


Link to post
Share on other sites
BeerNutts    4401
[quote name='grechzoo' timestamp='1313590721' post='4850328']
thanks guys.

and 0circle0 i think it was my pc (needs a reformat)

still i want to learn a more advanced API and oto OpenGL looks like the way to go,
[/quote]

I think SFML is EXACTLY what you're looking for. Please check it out. You'll have no performance issues, and it has great image functionality as well (rotating, scaling, etc. is all done using HW acceleration).

sfml-dev.org

Share this post


Link to post
Share on other sites
Zouflain    548
SDL OR OpenGL is a very odd consideration, as SDL is designed to work very well as a layer on top of OpenGL without ever having to deal with more than one SDL texture (the screen, and that's essentially invisible). I've used SDL in conjunction with OpenGL for nearly every game I've ever worked on, and never had a single issue with performance on either API's end (can't say the same for my own code, lol). The conversion process is also painless, and allows you to continue using SDL's sound, networking and other libraries without concern.

It will mean getting used to using OpenGL, but it does lend itself to absolutely painless cross-platform programming (without the need for GLUT, which is extremely outdated). Personally I've never looked back after writing my first few windows applications with OpenGL alone. And its handy to familiarize yourself with readily portable API's.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this