• 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 Performance: sprites vs drawing

P

Pano

Guest
Hi,
I have to create 10 objects and about their sprites I have two possible ways: the first one is to create 10 images (different colors and text) and load them as 10 sprites; the second one is to create 4 images (different colors), load them as 4 sprite and then use drawing functions to write the text on them.

So, I would to ask more expert users if is better, from a performance and tuning point of view, loading more sprites and use less drawing functions or loading less sprites and use more drawing functions. Targets are ios and android devices.

Thanks, regards
 
M

Marcus12321

Guest
If I had to guess, I would say more sprites. As far as I know, GMS handles fonts as a sort of sprite in the background, so a line of text would be almost like multiple sprites.

Edit to add:

You might make it even faster if you put all of the sprites in a sprite sheet, then there would be no texture swapping. But, it would be more work progmatically.

The truth is if you are just drawing 10 sprites, none of the methods are going to cause a big enough issue that it matters. Do it the easiest way possible for you.
 

❤️×1

Member
Honestly : don't worry about that. This is optimization too early for sure; and if you can't spare the 3 minutes it takes to actually test it by yourself, you shouldn't even think about it.
 
Sprites is far faster than drawing primitives. You can test this theory... draw 500 lines vs 500 draw_sprites of the same size and dimension. I've done it many times. Seems like drawing a giant surface is better performance wise than drawing a screen full of text.
 
Last edited:

Joe Ellis

Member
In complete accurist's terms, its fastest to draw 10 sprites with all the text pre drawn onto them, but takes more ram ( I hope your ram can handle it )
In my case I create surfaces with the sprite printed onto them and the text over the top, then draw them. Cus it's the slowest and pointless to draw the text every frame when you can save it to a surface and draw that.
But 10 or 4 sprites, plus 10 texts, isn't gonna make a screw's difference with performance, but times that by 100 (the amount of times your doing it) and it does make a big difference, between the various options, the amount of time between each method takes becomes 100 times further apart and thats the stuff that lags the game, when it's happening 100's 1000's times over, but if this case is just with 10 or 4 sprites, doesnt make any meaningful difference
 
Top