performance tips [SOLVED]
in
Programming Questions
•
7 months ago
5yhMe again :)
My game is a top viewed dungeon crawler. To build each room I use inteces os tiles, repeating 'em based in the coordinates i get from a text file.
I separate the sprites based in their "depth". There are 6 levels of depths so I render them in series - first one first and so on. This is a strange way to act like image layers.
I would like to know what could I do to improve my performance, since it gets unusable once i load a full featured room (about 500 sprites based in ~30 objects).
I would also like to know how much is Processing suitable for such use (sprite based full featured games(not simple demos)). Also, I'm usin minim to deal with music. Is it a good choice?
Thanks for your help!
Here's my draw code
fill(0);
rect(0, 0, 480, 320); // i need this rect to clear the previews frame screen
oPlayer.controls(); //Use to check players input. Is there a better way?
pushMatrix(); //using push/pop matrix to simulate a camera
translate(cam_x, cam_y);
oMundo.render0(); // render first layer (it reads the coordinate array everytime that is called)
oMundo.render1(); // render seccond layer (it reads the coordinate array everytime that is called)
popMatrix();
oPlayer.render(); // render the player (3rd layer);
pushMatrix();
translate(cam_x, cam_y);
oMundo.render2(); // render 4th layer (it reads the coordinate array everytime that is called)
oMundo.render3(); // render 5th layer (it reads the coordinate array everytime that is called)
popMatrix();
inter.drawUI(); //// render 6th layer (gui showing selected itens and player energy)
My game is a top viewed dungeon crawler. To build each room I use inteces os tiles, repeating 'em based in the coordinates i get from a text file.
I separate the sprites based in their "depth". There are 6 levels of depths so I render them in series - first one first and so on. This is a strange way to act like image layers.
I would like to know what could I do to improve my performance, since it gets unusable once i load a full featured room (about 500 sprites based in ~30 objects).
I would also like to know how much is Processing suitable for such use (sprite based full featured games(not simple demos)). Also, I'm usin minim to deal with music. Is it a good choice?
Thanks for your help!
Here's my draw code
fill(0);
rect(0, 0, 480, 320); // i need this rect to clear the previews frame screen
oPlayer.controls(); //Use to check players input. Is there a better way?
pushMatrix(); //using push/pop matrix to simulate a camera
translate(cam_x, cam_y);
oMundo.render0(); // render first layer (it reads the coordinate array everytime that is called)
oMundo.render1(); // render seccond layer (it reads the coordinate array everytime that is called)
popMatrix();
oPlayer.render(); // render the player (3rd layer);
pushMatrix();
translate(cam_x, cam_y);
oMundo.render2(); // render 4th layer (it reads the coordinate array everytime that is called)
oMundo.render3(); // render 5th layer (it reads the coordinate array everytime that is called)
popMatrix();
inter.drawUI(); //// render 6th layer (gui showing selected itens and player energy)
1