Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question

put on hold as off-topic by Krom Stern, Zehelvion, jhocking, Trevor Powell, Josh Petrie 2 days ago

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about "how to get started," "what to learn next," or "which technology to use" are discussion-oriented questions which involve answers that are either based on opinion, or which are all equally valid. Those kinds of questions are outside the scope of this site. Visit our help center for more information." – Krom Stern, Zehelvion, jhocking, Trevor Powell, Josh Petrie
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Where to get started questions are off topic for the site. –  Byte56 Jul 13 '12 at 3:41

4 Answers 4

up vote 2 down vote accepted

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.

share|improve this answer
    
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? –  Jefffrey Jul 14 '12 at 0:06
    
SDL has its own 2D API, and the SDL_gfx addon I mentioned. They are totally usable for basic 2D work. –  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!

share|improve this answer

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.

share|improve this answer
    
So if I use SDL I should be ok with everything? –  Jefffrey Jul 14 '12 at 0:03
    
@Jeffery Using SDL means that your code is mostly compatible, you might have to change a little bit of code –  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!

share|improve this answer

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