• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Surface questions

D

Doulos

Guest
I read here http://gmc.yoyogames.com/index.php?showtopic=631986 that surfaces should be kept small, but are great for optimization.
This was a few years ago, thus I am asking.

What is the rule of thumb here?
"The English phrase rule of thumb refers to a principle with broad application that is not intended to be strictly accurate or reliable for every situation."
Generally speaking When should we use a surface vs when we should not?

I have a massive room that the player would may see all at once if they zoom out. 7680x3840.
I have 5 layers of tiles of various sizes to create a map look. ~ 200,000 tiles
I make this map dynamically, but exactly once at creation.

Should I put that all on 1 surface instead of a few hundred thousands of tiles?
 
A

Annoyed Grunt

Guest
When striving for importance, it is important to strive to make as few drawing calls as possible. Drawing a big textured rectangle (which is what a surface is in the end) is much simpler than drawing thousands of elements. This is the same concept as complex graphical formats in image editing software, where the resulting image is lighter and easier to draw than the source file and its multiple layers.
Be mindful however that a 7680x3840 surface would be "rounded" to a 8192x8192 surface (8192x8192 also happens to be the maximum texture size in GM, if that hasn't changed). So the first simplification you could make in this sense is using two 4096x4096 surfaces, which would halve the graphical memory expended. A desktop should be able to handle this ok, phones probably not (you would not put 200.000 tiles in a mobile game anyway).

Still, this is actually a pretty tricky topic and I would suggest doing what one does when there is a mystery regarding performance... TEST IT OUT!
 
D

Deleted member 16767

Guest
So does this mean background image of a level > tile mapped level in terms of performance?

Edit: In that case, I think GM should give us an option to save our tile mapped room into a png background image.
 
A

Annoyed Grunt

Guest
So does this mean background image of a level > tile mapped level in terms of performance?

Edit: In that case, I think GM should give us an option to save our tile mapped room into a png background image.
It depends on how much optimization GM does when it comes to tiles. The manual states they're efficient because they don't have the overhead of instances, but doesn't mention anything else. While it is totally possible there is more going on under the hood, given that GM has a generally pretty hands-off approach to handling complex stuff (you need to handle your structures manually, you need to handle the activation\deactivation of your instances manually, you need to handle the creation/freeing of surfaces manually) I wouldn't bet on it. But that's why I said one should really test it out when it comes to such large optimization choices.
 
Top