1 registered members (AndrewAMD),
1,486
guests, and 10
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Best Performance for a 2D Game
[Re: Toryno]
#351711
12/28/10 02:57
12/28/10 02:57
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
Serious User
|
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
Maybe you could tell us a bit more.
Okay so far, it seems youre using a tilesystem as a bsase, right?
why 4000 objects? Thats really alot. How do you handle your sprites? Are you running a lot While(1){wait(1);} loops?
Or do you use one mainloop that handles all objects?
Greets Rackscha
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: Best Performance for a 2D Game
[Re: Rackscha]
#351712
12/28/10 04:14
12/28/10 04:14
|
Joined: Apr 2009
Posts: 138 Germany
Toryno
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 138
Germany
|
That's the complete code, it's very short jet. The picture is a 24bit-bitmap with 60x60 pixels (without alpha for shure). Every of the single quarters makes one tile of the "map" and every single quarter will be either earth, stone, sand or some other types of ground. It don't shows the earth from above but from side, like someone cutted it with a huge knife... The player will have do digg in the ground and so every single sprite can be removed. That's the reason for taking so much sprites
#include <acknex.h>
#include <default.c>
STRING* standard_bmp = "picture.bmp";
void start_new_game() {
level_load(NULL);
wait(2);
camera.x = 5300;
camera.y = 30 * 100;
camera.z = 30 * 40;
camera.pan = 180;
var tmpy = 0;
var tmpz = 0;
int i = 0;
int j = 0;
for (i=0; i<40; i++) {
for (j=0; j<100; j++) {
ent_create(standard_bmp, vector(0,j*60,i*60), NULL);
}
}
}
function main() {
max_entities = 10500;
fps_max = 60;
video_mode = 8;
video_screen = 2;
start_new_game();
}
Thanks for reading, thinking, answering
|
|
|
Re: Best Performance for a 2D Game
[Re: Toryno]
#351817
12/28/10 18:26
12/28/10 18:26
|
Joined: Apr 2005
Posts: 4,506 Germany
fogman
Expert
|
Expert
Joined: Apr 2005
Posts: 4,506
Germany
|
"60x60"
You should use a power of 2 as size to get a better performance, e.g. 64x64 or 32x32
no science involved
|
|
|
Re: Best Performance for a 2D Game
[Re: Toryno]
#351976
12/30/10 12:57
12/30/10 12:57
|
Joined: Apr 2005
Posts: 3,815 Finland
Inestical
Rabbit Developer
|
Rabbit Developer
Joined: Apr 2005
Posts: 3,815
Finland
|
Only difference comes in loading times, there is no speed impact to rendering.
The speedup from moving from sprites to polygons is the fact that (please correct me if I'm wrong) Acknex uses quads for sprites which render slower (for whatever reason) than two triangles. Also the engine is 3D based, so the 2D stuff isn't as optimized.
I also concur on using 2^ bitmaps (32,64,128,etc) so the engine doesn't have to fill it in. I do also recommend merging same type of tiles (= less texel fill passes).
"Yesterday was once today's tomorrow."
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|