begginer question about background creation

For questions about using Classic.

Post » Mon Jul 06, 2009 3:38 pm

I am used to tile engines for creation of backgrounds and "rooms". Tile engines are efficients, memory and display wise, it only displays the part of the tilemap that is on screen, so you can build a 1000x1000 map if you want and there should be no slowdown.
I know construct doesn't have one (yet) and aims more for a free-form engine where the background is created with sprites (a la Aquaria)
My question s: how efficient is it?
How are the sprites that are not on screen managed? are they all 'ticked' even when not on screen?
How many sprites can I use for a background before the engine starts to slow down?
B
3
S
1
G
3
Posts: 45
Reputation: 1,140

Post » Mon Jul 06, 2009 3:47 pm

It'll vary on each person's computer based upon their processing speed, but a tile engine will still use sprites for the tiles. If a sprite is offscreen it is not drawn. I can have upwards of 100,000 offscreen or invisible sprites in a layout without slowdown on an athlon X2. Onscreen/visible, that number would be quite lower.
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Mon Jul 06, 2009 3:53 pm

Normally a tile engine doesn't use sprites for ALL the tiles of the map.
It should use just enough sprites to cover the screen, and then map these sprites to the relevant tiles on the memory map.
B
3
S
1
G
3
Posts: 45
Reputation: 1,140

Post » Mon Jul 06, 2009 4:17 pm

you can code this yourself directly in construct, but it can be a bit tricky for beginners.
Also, there is no need to do this unless you notice slowdown in your game, because the runtime is hardware accelerated and very fast.

[quote="declan_gage":3q9y9eug]How are the sprites that are not on screen managed? are they all 'ticked' even when not on screen?[/quote:3q9y9eug]
Yes, but you can add code which stops cpu-intensive events if the sprites aren't onscreen.

sprite is on screen
subevent -run checks
subevent -more tests

this way, sprites are only checked to be onscreen, and won't eat up cpu doing all kinds of other tests and checks when not needed.

Unless your game is a very small resolution (320x240), then optimizing graphics will be your main concern.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Mon Jul 06, 2009 4:59 pm

another useful fact might be that sprites which are offscreen are not rendered and don't impact performance in this regard; that means that you won't need to set them to invisible when not on screen or something similar to save resources - directx/the graphics hardware does that automatically.

as far as i remember, sprites stop drawing as soon as their center is further than 1 (or 2) times their width away from the screen's edge... i stumbled upon that when messing with distort maps :P
B
2
S
2
G
4
Posts: 171
Reputation: 1,792

Post » Mon Jul 06, 2009 6:58 pm

Okay, thanks for the info, Construct might be able to handle large levels it seems.
B
3
S
1
G
3
Posts: 45
Reputation: 1,140

Post » Mon Jul 06, 2009 9:07 pm

Construct does need to do a tiny bit of processing on each off-screen sprite every tick, but it's little more than a passing glance, computationally. You'd need thousands of sprites before the overhead became anywhere near the processing time of drawing those objects which are actually on the screen!
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,498

Post » Mon Jul 06, 2009 9:20 pm

Well my maps in newest project can be 5000x5000 as I use tiled background and not so many sprites its very fast still.
B
11
S
3
G
4
Posts: 622
Reputation: 3,186


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests