Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,486 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Best Performance for a 2D Game #351709
12/28/10 01:10
12/28/10 01:10
Joined: Apr 2009
Posts: 138
Germany
T
Toryno Offline OP
Member
Toryno  Offline OP
Member
T

Joined: Apr 2009
Posts: 138
Germany
Hi everybody,

i'm planning a 2D Game where you will see up to 4000 objects at the same time, because the floor is build from little pictures.
I could simply use sprites, but it slows down the pc extemly. Have you a better solution?


Thanks for reading, thinking, answering wink
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 Offline
Serious User
Rackscha  Offline
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
T
Toryno Offline OP
Member
Toryno  Offline OP
Member
T

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... wink 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 wink

Code:
#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 wink
Re: Best Performance for a 2D Game [Re: Toryno] #351816
12/28/10 18:16
12/28/10 18:16
Joined: Apr 2009
Posts: 138
Germany
T
Toryno Offline OP
Member
Toryno  Offline OP
Member
T

Joined: Apr 2009
Posts: 138
Germany
I tried models with 2 polygons and they are faster than sprites! I don't know what's the reason for this but ok... But if anyone knows a better solution for a tilesystem, please let me know. laugh


Thanks for reading, thinking, answering wink
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
F
fogman Offline
Expert
fogman  Offline
Expert
F

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: fogman] #351821
12/28/10 18:56
12/28/10 18:56
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Combine equal tiles (models/ sprites) into bigger ones, f.i. 2x1 tiles, 2x2 tiles or even bigger ones. When you want to remove a tile (by digging), delete the big tile and recreate 2 or 4 tiles respectively.
I've used this method in 3D with models (see Projects: MeinKraft) and 2D with panels.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Best Performance for a 2D Game [Re: Superku] #351824
12/28/10 19:32
12/28/10 19:32
Joined: Apr 2009
Posts: 138
Germany
T
Toryno Offline OP
Member
Toryno  Offline OP
Member
T

Joined: Apr 2009
Posts: 138
Germany
Two very good ideas grin thank you.


Thanks for reading, thinking, answering wink
Re: Best Performance for a 2D Game [Re: Toryno] #351839
12/28/10 20:22
12/28/10 20:22
Joined: Apr 2009
Posts: 138
Germany
T
Toryno Offline OP
Member
Toryno  Offline OP
Member
T

Joined: Apr 2009
Posts: 138
Germany
Is there any different in speed between using pcx, bmp, tga or other files?


Thanks for reading, thinking, answering wink
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 Offline
Rabbit Developer
Inestical  Offline
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."

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1