Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Clarification: I'm not asking for the best place to start. I'm just asking for a place to start.

I am a C# web developer and I want to expand my skillset and have some fun while doing it. I know some of the basics of C++ and I would love to write a simple 2d game/game engine for myself using C++. What other libraries or SDKs do I need and where would I find some tutorials and informational resources to move forward?

I'v already looked into XNA with C#. There are a lot of resources for that but I would rather use non Microsoft products. The point of this is to have a little fun while becoming a better rounded programmer.

Thanks for any help!

share|improve this question

closed as not constructive by Josh Petrie, Byte56, Tetrad Jun 17 '12 at 15:29

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 24 down vote accepted

The standard starting place (in my experience) for C++ game dev is SDL. You've got to get your hands a little dirtier with this than you do XNA.

If you want to try something a little higher level then I would suggest SFML. It handles some of the more menial tasks for you but you've still got to keep your eye on your memory usage, etc.

share|improve this answer
I'll look into those. My biggest problem with XNA is that it was so straightforward that I didn't feel like I was really learning the lower level stuff that I'm interested in exploring. – quakkels Oct 7 '11 at 22:34
SFML has a nice design, but is still quite a bit buggy and is in the process of a major API redesign- I wouldn't use it for more complex games until the next release is well polished. – Bitgarden Oct 7 '11 at 22:39
If you want something a bit more challenging than SDL, try ClanLib. Like XNA it supports hardware acceleration, but also works on Linux, and also 2D exclusive. – ChrisC Oct 7 '11 at 23:09
You can also go straight for the throat - OpenGL is my personal favorite (you can wrap it with SDL or SFML) – ultifinitus Oct 8 '11 at 6:43

I would suggest using SDL. It's been around a long time so the documentation and support are pretty good, and it's one of the easiest ways I know of to get a drawing surface on the screen. It will give you practice writing classes in C++ (since you'll probably want to wrap a lot the the SDL C function calls) and also give you some experience using pointers and references and doing some basic memory management. Managing your own memory is one of the major differences between C++ and C#.

share|improve this answer

Personally, I would pick Allegro 5, for the following reasons:

  1. It has a CMake-based build system. This makes it much easier than most build systems for working on multiple platforms. This seems like a minor thing, but it's pretty important overall. It makes building the library much simpler.

  2. SFML is still in significant flux. 2.0 is a pretty substantial change. Whereas Allegro has already been through a significant change with version 5, and it's now all about stability.

  3. It covers modularity in a different way from SFML. With SFML, you ask for specific components, but you get all of them. If you ask for the graphics component, you get all of the graphics component. With Allegro 5, you always get the graphics component. But if you don't want to use Allegro's bitmap loaders, you don't have to; you can use your own.

  4. It has very good documentation. SFML uses Doxygen-style documentation, but even that is pretty Spartan. Whereas Allegro 5 is more comprehensive, with functions grouped together based on specific systems that they cover. It's not perfect, but it is better overall.

  5. They're smart enough to not try to do threading. With C++11/Boost.Threads either widely available or just around the corner, using another thread wrapper can be more than just problematic: it can be dangerous to getting your code working properly.

share|improve this answer
Why would you prefer/suggest Allegro over SDL or SFML? – iamcreasy Oct 8 '11 at 8:36
@iamcreasy: If you insist. – Nicol Bolas Oct 8 '11 at 9:00
You still don't mention SDL... – Arcane Engineer Oct 8 '11 at 9:52
@NickWiggill: SDL has threads and platform-specific build systems. I didn't feel the need to call it out for anything specific. – Nicol Bolas Oct 8 '11 at 10:54
@nicol-bolas you didn't mention the cons of Allegro. Like very low amount of tutorial comparing. – iamcreasy Oct 8 '11 at 21:42

I think a fantastic place to start is LazyFoo. This will get you up and running with SDL faster than any other place I've seen. I'd recommend quickly getting into OpenGL (as soon as you can stomach it) because you'll get a lot more bang for your programming dollar- with hardware acceleration. If you do go that route, I recommend This Guide.

share|improve this answer

I would recommend SFML if you are using c++. It will get you something on the screen quickly and using it with your c++ game code is straight forward.

share|improve this answer
  • SFML -- the baby in the group, but potentially easiest to use from what I've read.
  • SDL -- the middle road. Very mature library, sensible, generally concise if a little arcane from time to time, and a very common choice. Setting up display formats can be a bit of a bastard, I've used lazyfoo's tutorials to help on that front.
  • Allegro -- Geriatric, it's been around since Atari ST days. For that reason, a lot of the 2D rendering code (which I think is only in Allegro 4) is pretty darn quick since the logic was built for much lower spec systems. I personally don't find it very intuitive, even considering the documentation.

Considering OpenGL accelerates the 2D side of things these days, it's not that important to have access to the fast software renderers that Allegro and SDL have (or had in earlier versions). However when I pick a library I focus on project maturity, user base and docs more than speed (so long as speed is reasonable), and I would say SDL and Allegro win on those fronts. SDL has also been to release triple AAA titles like Civ: Call to Power.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.