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)
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:13model = contentManager.Load<Model>(_assetFile);
, I should usemodel
all 10 times? – IMX Jun 10 '13 at 17:03ReferenceEquals(Content.Load<Model>("somename"), Content.Load<Model>("somename")) == true
. So it's not the models that you need to be pooling. – Andrew Russell Jun 12 '13 at 02:52