Java game object pool management

Posted by Kenneth Bray on Game Development See other posts from Game Development or by Kenneth Bray
Published on 2012-11-03T20:02:53Z Indexed on 2012/11/03 23:19 UTC
Read the original article Hit count: 363

Filed under:
|
|
|

Currently I am using arrays to handle all of my game objects in the game I am making, and I know how terrible this is for performance. My question is what is the best way to handle game objects and not hurt performance?

Here is how I am creating an array and then looping through it to update the objects in the array:

public static ArrayList<VboCube> game_objects =  new ArrayList<VboCube>();
/* add objects to the game */

while (!Display.isCloseRequested() && !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
        for (int i = 0; i < game_objects.size(); i++){
            // draw the object
            game_objects.get(i).Draw();
            game_objects.get(i).Update();
            //world.updatePhysics();
        }
}

I am not looking for someone to write me code for asset or object management, just point me into a better direction to get better performance. I appreciate the help you guys have provided me in the past, and I dont think I would be as far along with my project without the support on stack exchange!

© Game Development or respective owner

Related posts about java

Related posts about 3d