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

we are trying to make a small 2d game which requires an excessive amount of sprites spawning and moving around the screen at the same time. We did try doing this in python but it started choking at around the 500 mark. Are there any specific engines that you would recommend for this sort of project or a good way to handle this in python?

Thanks for your time.

share|improve this question
What exactly are your sprites doing? I assume they're not just being drawn. – doppelgreener May 18 '11 at 11:55
Too many unknowns here such as what code is being executed for each sprite, what platform you're on, etc. Python isn't your problem here is my bet, it's your approach to coding and managing the sprites. – Tim Holt May 18 '11 at 14:22
Hardware instancing would be pretty good for this. – Byte56 May 18 '11 at 15:33

If you have a very large number of sprites, it might be time to let hardware handle it and move your sprite rendering into VBOs via pygl or the like. Realistically though, massive numbers of sprites can usually be turned on it's head as a "find the sprite under this pixel" problem instead. Maybe not so easy in python, but you might find a library already written for "particles" that handles this situation better. Collecting your sprites by wich frame they are on for example.

A good answer to this question would require a bit more knowledge about the type, speed, clumping, or even how regular the sprites might be. Do you have thousands of sprites because there are that many entities? or is it moving land-pieces? do they move in groups? Each assumption we can make about the sprites can offer a better / faster rendering solution.

As usual, what is your input data, and what do you want out.

share|improve this answer
+1 for particles. Look up how to do a good particle system on your platform of choice and you will learn a lot about tricks for managing a massive number of sprites. – Lunin May 18 '11 at 18:31

Late to the party, but I think the simple answer is, "Learn what code profiling is and how to apply it". Because you cannot make any assumptions as to what is causing your performance drop until you do.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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