Jump to content
  • Advertisement
Sign in to follow this  
pokaex

2D C++ Game Library Suggestions

This topic is 2375 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,
I've just finished learning some C++ tutorials and I know the basics of the language. Some things I've made by myself without any help are: a simple calculator with a GUI(using QT), Tic Tac Toe(console only) and a simple Pong game using SDL. I've also done quite a lot of the Project Euler questions using C++ and Python. I think I know enough to do some simple 2D game development.

Can anyone suggest a good library for simple 2D games? I've considered SDL and SFML but they're mainly for graphics and they do not include any features such as physics or AI. I'm looking for something that is:
~Not too advanced or complicated
~Uses C++ (or Python, but preferably C++)
~Has an active community
~Physics and AI would be nice, but I don't mind creating my own
~Keyboard and Mouse input
~2D, with hardware acceleration
~Shaders, particles and other effects would be nice

That's it for now, can't think of anything else I need at the moment. I hope this isn't too much to ask for. Thanks.

Any suggestions will be greatly appreciated!

Share this post


Link to post
Share on other sites
Advertisement
I have never used library for game physics but I think Box2D is quite popular. If all you want is very simple physics and you know some physics it's always possible to write it yourself.

There are many different kind of AI depending on what you want to do.

Share this post


Link to post
Share on other sites
+1 for SFML and Box2D (though Chipmunk is a decent physics alternative). If you're going to use SFML, use SFML 2.0; don't bother with 1.6. It's so close to being done and is very stable.

SFML:

  • Is simple (but pretty powerful)
  • Supports shaders
  • Supports audio output (through OpenAL)
  • Hardware accelerated
  • Has an active community (and Laurent (the creator) is very active on the SFML forums)
  • Handles keyboard, mouse, and joystick input

    It doesn't do physics or AI, but you probably won't find any game engine that'll do AI for you (seeing as each game has to make custom AI). Box2D isn't too complicated, and it's quite powerful. Box2D also has an active community, with Erin Catto (the creator) an active member. Both are written in C++, and both have very permissive licenses.

    The game I'm working on is using SFML and Box2D, and I've been quite happy with them so far.

Share this post


Link to post
Share on other sites
I'm trying to decide between SDL and SFML. What are the main differences? I've tried a bit of SDL and I like it so far. For the physics, I think I'll just make my own because all I need is something simple.

Share this post


Link to post
Share on other sites
I had to switch to SFML from SDL because I needed to be able to rotate the sprite an arbitrary number of degrees. SFML is built upon openGL so you get all the advanced features of openGL with messing with all the matrices and stuff. When I tried doing this in SDL i was told i needed to switch to openGL for the entire project which i didn't want to do. Also I believe SFML is hardware accelerated and SDL is not, but I am not positive and that may not be true.

Share this post


Link to post
Share on other sites

I'm trying to decide between SDL and SFML. What are the main differences? I've tried a bit of SDL and I like it so far.

SDL is C-based, SFML is C++-based. SDL does not natively use OpenGL and hardware acceleration (the upcoming SDL 1.3/2.0 might be changing that, though I don't know) (if you want SDL to use OpenGL, you have to set it up and use OpenGL yourself), whereas SFML already uses OpenGL and hardware acceleration for everything. I don't think (could be wrong) that SDL gives you networking support, but SFML does. SDL is LGPL, SFML is ZLIB/PNG licensed (though some of the audio libraries SFML uses (like OpenAL and libsndfile) are LGPL). I don't think SDL is bad, but in my opinion SFML is better when working in C++ (and SFML 2.0 is even better).


For the physics, I think I'll just make my own because all I need is something simple.

I hope by simple you really do mean *super simple.* Once objects can rotate or once you start supporting multiple collision shapes, it's not simple and you should use a library. But if by simple you really do mean super simple (i.e. one object type, no rotations, etc.), then yeah, you can do it on your own and it isn't too bad.

Share this post


Link to post
Share on other sites
By simple, I don't mean super simple, just not too complicated. I'll learn some SFML then. Thanks for your suggestions.

Share this post


Link to post
Share on other sites
By simple, I don't mean super simple, just not too complicated. I'll learn some SFML then. Thanks for your replies!

Share this post


Link to post
Share on other sites

By simple, I don't mean super simple, just not too complicated. I'll learn some SFML then. Thanks for your replies!


If you've got basic C++ skills, I've put together this (rather long) tutorial series on creating a game with SFML/C++ that might be a good place to start.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!