I'm pretty newbie in this things and I've never really had particular experience in game developing. I started learning something about 3D (using 3Ds Max and then Blender) and then 3D game developing using OpenGL.

While with 3D i found it very easy to get started, I don't have a clue on where to start for 2D game developing.

For example, I know that for 3D you can use SDL for keyboard, mouse and OpenGL (I don't like Direct X) for animation and 3d models. Then you can create .obj files with Blender or any 3D modeling software and then parse that file to import vertexes and edges in OpenGL without drawing it yourself (which is almost impossible).

But for 2D games I don't know:

  • What API could I use
  • What are sprites and animated sprites made of
  • What softwares may I have to use

I mainly like cross-platform things. I'm a bit confused about this but I'd like someday to export my game into all OS. I'd like to use c++ and I'd like to use Open sources softwares and API over owned ones (Like Direct X is for Windows). Also I'd like to use resources that can be used over Mac OS, Windows and Linux as well. I don't like easy things, such as pre made frameworks or game engines. I'd like to start from scratch.

Could you please explain to me how to get started?

  • \$\begingroup\$ Where to get started questions are off topic for the site. \$\endgroup\$ – MichaelHouse Jul 13 '12 at 3:41

SDL and OpenGL are perfectly suitable for 2D. There's no reason to change APIs.

SDL has a built in 2D drawing API, and there is a newer SDL_gfx module for more modern 2D rendering needs.

The triangles and textures and such you draw with OpenGL can just as easily be flat shapes in an orthographic projection view. Any portable 2D library you use is just going to be wrapping OpenGL with a handful of simple helper functions, so of you're already comfortable with OpenGL, just use it (and write your own helpers as needed).

Every 2D game I've ever written has been in OpenGL and C++, and I've used SDL for a few of them. They definitely work for the job.

  • \$\begingroup\$ I didn't quite got the relation between OpenGL and SDL. I'm not comfortable with both. I saw how OpenGL works, but just by few hours of tutorial videos. Since SDL has audio, keyboard and mouse also, can I just use it for 2d too. I mean without OpenGL. OpenGL seems an overkill for just 2D, is it? \$\endgroup\$ – Shoe Jul 14 '12 at 0:06
  • \$\begingroup\$ SDL has its own 2D API, and the SDL_gfx addon I mentioned. They are totally usable for basic 2D work. \$\endgroup\$ – Sean Middleditch Jul 14 '12 at 0:53

I'd recommend using lazyfoo's tutorials which uses SDL, which is very cross-platform (officially: Win, OS X, linux, even Android and iOS! and some others non-officially), and it also supports OpenGL!

Not only do the above make SDL great, but the sheer fact that all you need to do is recompile on the target platform (for linking purposes)!

Of course, there are a ton of questions using SDL, so don't be afraid that it's an obscure library.

The library itself isn't open-source, and you should go for the external library option so you don't have to make all your code open-source, but SDL is still a great library!


This is probably going to get closed so i'll just throw something in.

SDL is "dimension agnostic", it's just an abstraction layer that makes working with given operating system easier. SDL (SFML is better if you're using C++) uses OpenGL to do 2D rendering. Which brings me to an important point, OpenGL is just a way to ease access to your graphics card functionality. It allows you to draw triangles on the screen, that's it, that's what graphics cards are so good at. If you make those triangles seem like they're 2D or 3D on a flat screen, that's up to you. OpenGL isn't some sort of a magical 3D fairy land API, you can easily create 2D games with it.

  • \$\begingroup\$ So if I use SDL I should be ok with everything? \$\endgroup\$ – Shoe Jul 14 '12 at 0:03
  • \$\begingroup\$ @Jeffery Using SDL means that your code is mostly compatible, you might have to change a little bit of code \$\endgroup\$ – thePalindrome Jul 14 '12 at 0:41

The extremely well put together tutorials videos over at http://fixbyproximity.com create a basic 2D shooter from scratch. The owner of the site, Mike Geig, has recorded hours of himself using the Allegro engine and Visual Studio 2010 to build it completely from scratch. There's an optional shorter set of videos at the end where he refactors the entire thing into C++ code (it's initially in a C-style coding).

The Allegro engine is a complete wrapper for 2D game development and makes everything pretty simple to work with.

Sprites are just basic 2D drawings - do a Google search for 'sprite sheets' and you'll see a bunch of them. Geig's videos also show them in action.

Any graphics software can create 2D sprites - so really, an IDE and Allegro and some sprite sheets are all you'd likely need to start putting together some demos.

Good luck!


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