Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

10 years ago by Firegael

I've just started working on another game, and decided to use a very simple repeating background for testing:
/><br />
<br />
When I set this layer as a 1x1 repeating layer with a distance of 3, my draw latency goes up to 15ms.<br />
<br />
Setting this up as a 3x3 reduced the latency to 5ms, and now, using a 20x20 pattern I'm back to <1ms.<br />
<br />
Just thought I'd add this here in case anyone is having lag issues and are using small repeating layers.<br />
<br />
If anyone could also enlighten me as to why this is the case, that'd be great. I assume the repeating image is being rendered as one image object on the canvas, so the larger it is, the less draws it has to do, but that's just a guess.			</div>
		</div>
			<div class=

10 years ago by stahlmanDesign

I wondered about this. I haven't done the test but I presumed that if you had bigger tiles to make your pattern it would be faster. It seems this is the case.

10 years ago by Joncom

Hmm. This sounds very strange. The size of the repeated layer shouldn't make a difference. Unless you're pre-rendering. Then maybe it would because maybe the biggest chunk it could pre-render would be the size of the layer.

10 years ago by Firegael

Quote from Joncom
Hmm. This sounds very strange. The size of the repeated layer shouldn't make a difference. Unless you're pre-rendering. Then maybe it would because maybe the biggest chunk it could pre-render would be the size of the layer.


I seem to have the opposite effect; when turning pre-render off, even with the large size, my latency goes up to 25ms and draws up to 4000+ from 23.

10 years ago by Joncom

Quote from Firegael
I seem to have the opposite effect; when turning pre-render off, even with the large size, my latency goes up to 25ms and draws up to 4000+ from 23.
Yes, that makes sense. Pre-rendering merges many "small tiles" into fewer "big tiles" for drawing purposes. This means less draws, which is faster. Turning pre-render off will make your draw count increase and will generally slow things down. It does this at the cost of memory consumption.

However, I'll try to explain my original post more clearly:

Let's say your tiles are 16 by 16 pixels.

If you have a 1x1 pre-rendered map, then the pre-rendered "big tiles" will be 16 by 16 pixels. You therefore gain nothing from pre-rendering. And maybe even made things worse by enabling it?

If you have a 3x3 pre-rendered map, then the pre-rendered "big tiles" will be 48 by 48 pixels. You got a small reduction of draws.

The default chunk size is 512 by 512 pixels however and you're not even coming close to this. Perhaps don't use pre-rendering on such small maps. There may be some overhead it's introducing that the "payoff" of the feature does not outweigh.
Page 1 of 1
« first « previous next › last »