2D C++ Game Library Suggestions

Started by
9 comments, last by theo2005 12 years ago

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!

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.
I like SFML for 2d graphics http://www.sfml-dev.org/index.php
+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.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
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.
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.

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.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
By simple, I don't mean super simple, just not too complicated. I'll learn some SFML then. Thanks for your suggestions.
By simple, I don't mean super simple, just not too complicated. I'll learn some SFML then. Thanks for your replies!

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.

This topic is closed to new replies.

Advertisement