r/truegamedev • u/strategosInfinitum • Oct 29 '14
Is object pooling worthwhile?(Java, Android)
has anyone here implemented some form of object pooling for games in java?
did you find it was worthwhile?
I attempted to make my own but i have found it's introducing a lot of complexity almost entirely due to the need to set object types. http://stackoverflow.com/questions/19883211/libgdx-object-pool-for-many-objects-of-the-same-parent-class
Having to keep all the objects as one type i decided to make them all generic entities. They then get their properties from classes i've called "EntityTypes" on single instances of these EntityTypes exist but can be shared by multiple Entities.
So the only difference between a Planet Entity and a ship Entity would be the EntityType they happen to use, and other variables which contain an object3d , position , velocity etc.
This would be easier if i could extend the pool objects.
So now im thinking of having multiple pools http://stackoverflow.com/questions/13294757/using-object-pools-in-libgdx
tl;dr is object pooling worth it in java games?
View all comments
Show parent comment
1
u/muddy_shoes Nov 03 '14
Well when you come up with a pooling mechanism that has negligible overhead for the case I was referring to on low-end Android devices I'll be all ears. In the meantime you might consider that you're making a fairly arrogant assumption that you just know better than me about a performance case that I actually experienced and you didn't.