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 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?


share|improve this question

closed as off-topic by Byte56 Apr 29 at 15:05

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." – Byte56
If this question can be reworded to fit the rules in the help center, please edit the question.

See Game Trailers Bonus Round. –  iamcreasy Dec 30 '11 at 9:41
What platform(s). –  Tetrad Dec 30 '11 at 9:55
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. –  Jonathan Dickinson Dec 30 '11 at 10:06
@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 –  Grungetastic Dec 30 '11 at 10:29
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. –  annonymously Dec 30 '11 at 10:38

2 Answers 2

up vote 9 down vote accepted

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).

share|improve this answer
Thanks for your excellent answer! –  Grungetastic Dec 30 '11 at 11:54

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.

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

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