I'm new to the game dev world.

I have a rather large project in mind (I learn by setting myself challenges :P ) and I'm wondering what the best engine/framework/language is for a 2D game with thousands of sprites/actors on screen at a time. Bare metal type stuff. I need to still be able to zoom in and out with that many actors at once.

This game will have no 3D elements.

Any thoughts?


  • \$\begingroup\$ See Game Trailers Bonus Round. \$\endgroup\$ – Quazi Irfan Dec 30 '11 at 9:41
  • 1
    \$\begingroup\$ What platform(s). \$\endgroup\$ – Tetrad Dec 30 '11 at 9:55
  • 3
    \$\begingroup\$ By bare metal do you mean C/C++? The XNA SpriteBatch handles thousands of sprites very easily; but it's not bare metal. Also +1 for reading the FAQ and asking probably the best 'best' question I have seen. \$\endgroup\$ – Jonathan Dickinson Dec 30 '11 at 10:06
  • \$\begingroup\$ @JonathanDickinson I say bare metal because I see this as being fairly processor intensive. Those thousands of sprites all do something and interact. And I want as little bloat as possible. Hope that makes sense. Platform is PC \$\endgroup\$ – Grungetastic Dec 30 '11 at 10:29
  • \$\begingroup\$ I think XNA is great for handling loads of 2d sprites if you know C#, and they can all interact and stuff as well. If you want 'bare-metal' then C++ on opengl or directX is probably the way to go. XNA runs on DirectX. \$\endgroup\$ – annonymously Dec 30 '11 at 10:38

C# with XNA

Since you're new to this, XNA would have the advantage of also being a very good place to get started. From creating a new project to displaying a 2D sprite on screen it takes 5 lines of code:

private Texture2D texture;

texture = Content.Load<Texture2D>("sprite");

spriteBatch.Draw(texture, Vector2.Zero, Color.White);

It doesn't get much easier than this. Also has the advantage of having loads of educational samples available for it.

The problem is your performance requirement. But I've managed to draw thousands of sprites before in XNA with no problem. However there was no gameplay code behind it, and my computer is high-end so results would be biased. But with careful optimization it would probably work out. So this is my recommendation.

C# with SharpDX or SlimDX

Still staying in the managed C# realm, you could also go back one step and consider using SharpDX which is a new managed wrapper around DirectX, and they claim it to be about around 6 times faster than XNA. That should have enough power for your needs. And it's cross-platform.

There's also SlimDX to consider.

C++ with DirectX/OpenGL

And if you keep going further in that direction, you'll finally reach the pure C++ with DirectX/OpenGL realm. If you decide to go down that route (which by the way, will be much harder to deal with at this stage), there's a few things you can do to make your life easier.

For instance, you could use SDL to create the window for you and take care of input, and FMOD to handle the audio, both of which I have found much easier to work with than their native counterparts.

I also don't know what it's like nowadays, but the last time I worked with these, I found it was pretty easy to do 2D stuff in DirectX thanks to the D3DXSprite class which IIRC was quite similar to XNA's SpriteBatch, while with OpenGL I had to implement everything from scratch (i.e. messing around with textured quads, orthographic projections and implementing the batching).


I recommand SFML, as it allows you to easily manage 2D sprites and zoom/unzoom (thanks to an existing "camera" class). With these abstractions, I've found it simpler to use than XNA. I don't have hard stats on the performance, but since it uses C++ and renders through OpenGL, I think it can be faster than XNA.

Coincidentally, I'm working on a similar game using SFML. It can manage 1000+ moving sprites at 50 FPS on my laptop, while running the game logic (collision between sprites, etc).

Here is a screenshot of this SFML program running on my 3-year-old laptop with integrated graphics, at 25 FPS (800x600):

lots of sprites in SFML

I think there are more than 1000 sprites displayed.

  • \$\begingroup\$ +1 I've heard good stuff about SFML before (usually in comparison with SDL). \$\endgroup\$ – David Gouveia Dec 30 '11 at 15:51
  • \$\begingroup\$ For people that want to go down the SFML path, Code Blocks looks like a nice IDE that support SFML \$\endgroup\$ – Grungetastic Dec 31 '11 at 1:40
  • \$\begingroup\$ I suggest a link to SMFL should be added! \$\endgroup\$ – Zolomon Jan 3 '12 at 17:39

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