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

This is how I realized a pool, to prevent stutters during gameplay.

I load everything I will probably need during runtime upfront, and take each model I need from the pool during runtime. Now, my pool is just the left-hand side of the viewport and I know this is very dirty.

So what could I do, to have a more efficient pool?

I am asking since the game still tends to stutter once in a while when I grab some models off the pool to ingame-runtime (although it is already ingame)

My pool implementation

share|improve this question
This sounds fine. So as long as you manage the non-active Pool object properly. Typically, you would loop through the Active items in your pool, and update. Make sure to not waste any unneeded cycles on non-active objects. – Jon Jun 10 '13 at 14:01
This sounds wrong. Typically a 3D model is loaded once and shared across all actors/entities using that model. You might stream or cache them - but you wouldn't pool them. Perhaps you are using the wrong terminology? Pooling actors makes a little more sense. As does pooling resources, like buffers. Can you post some code so we know exactly what you mean / are doing? – Andrew Russell Jun 10 '13 at 14:31
Pasting code would be too local, I am afraid. But basically: I load a model about 10 times and every single of these 10 models are complete stand-alone 3D-Models. How can I use one model for 10 isolated models? – IMX Jun 10 '13 at 14:35
How are you loading models? Is it with Content.Load<Model>("whatever")? Because if you call that 10 times, you get the one instance back every time (ContentManager has built-in caching). I think at this stage posting code might be helpful - without it your question is far too vague to answer specifically. (Although mobo just answered with a good overview of pooling.) – Andrew Russell Jun 10 '13 at 16:13
So you are saying, that once I have model = contentManager.Load<Model>(_assetFile);, I should use modelall 10 times? – IMX Jun 10 '13 at 17:03

Pooling is more often used to get around memory allocation issues. If you are making a bullet-hell game then creating and destroying all of those bullets is going to be a costly operation. It would be better to create a bullet pool, and when a bullet is destroyed it is just removed from the logic and draw loops, and returned to the pool. Once it is shot again it is re-initialized and added again to the logic and draw loops.

If you are trying to use this to precache objects, I would take a different approach. If you are drawing three balls there is no reason to load its texture and shape three times. If your object and renderer are separate (makes life way easier) then you can just have the renderer draw the same ball in three different locations. You can take this a step further with sprites. You can load a single sprite sheet for all of the animations of an object (or multiple objects) into a texture and just draw a section of the texture each time. Each object does not need its own texture.

share|improve this answer
I heard that bit of drawing one mesh at different locations a couple of times now. But never was there someone to actually explain what to do roughly (code-wise) – IMX Jun 10 '13 at 16:35
I am not familiar with XNA in particular, but generally it is done through mesh instancing. Take a look at:…… – mobo Jun 10 '13 at 16:59

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.