Legacy GM Sprite_index VS Image_index

zendraw

Member
Hi, so for some time now ive been wondering about this, which is better to use for static images like on the HUD or just some object in the room, 1 sprite with 100 images or 100 sprites with 1 image? ive heard that its better to use sprites with single image.
 
A

Aura

Guest
One sprite with hundred images obviously. Why do you need so many images anyway?
 

zendraw

Member
i have an object called fruit and the sprite of that object has all the types of fruits which are going to be many.
btw can you explain a bit why a single sprite wuld be better then many sprites? how i think about it is that it loads the sprite with all its images thus a sprite with many images takes more then a sprite with less. but i dont really know.
 

chance

predictably random
Forum Staff
Moderator
...1 sprite with 100 images or 100 sprites with 1 image? ive heard that its better to use sprites with single image.
Any performance difference by putting all your object images into a single sprite is probably small. Your frame-rate will be limited by other factors.

And consider the hassle of having every object in the IDE show the same image (the first image in the sprite). Plus, you'd have to put image_index = whatever in the CREATE event of every instance. Or specify it in the DRAW event.

bleh... why make your life miserable?

EDIT: I just read your last post. Sure, there may be a convenience having your fruit images all in the same sprite. Like a form of parenting. And it's easy to switch between apples and grapefruit (say).

But I'd limit this to objects that are essentially the same. Not all objects, as your first post implied. In other words, make the decision based on convenience.
 
Last edited:

Yal

🍋 *lemon noises*
GMC Elder
I like to group together multiple animations in the same sprite for convenience so that changes I make to one character's graphics are easy to make in batches, I have to keep track of less character-sprite variables, don't have to worry about resetting image_index when changing between animations (since it's the same thing), and things like that. As long as I don't need to play the animation automatically, have different collision masks for parts of it, or have lots of empty space on 90% of the subimages, I put everything in the character's "main" sprite; I make separate sprites only when it'd be more cumbersome to put it in the main sprite.
upload_2016-8-11_15-14-53.png
 

zendraw

Member
i know how to make my life easyer, but what i want to know is the difference in performance betwean using a sprite with meny images and meny sprites with 1 image. it may seem a minor thing but its good to know the details.
 
B

bojack29

Guest
It IS a minor thing. Dont get caught up in this micro optimzing nonsense. Literally the performance gain or loss will be minute that its almost not even worth considering at all. The amount of headache and frusteration to do this kind of thing is painstakingly terrible in terms of the amount of little gain you stand to achieve.
 

TheouAegis

Member
It ultimately boils down to how many texture pages would be required, I think. If they're all different sprites, then GM wouldn't have any qualms about spreading them out across multiple texture pages. If it was all one sprite, GM would try to fit it into one texture page if possible.

If it's anything like GM8, the difference in memory use was something like 1K or less. The fps gain/loss was so small that it's hard to track.
 

zendraw

Member
doesnt game maker write the images procedurely like first sprites form 0 to last sprite then backs from 0 to last back. and for me its not tedious to learn how the program that i work with works. it gives more freedom. knowledge is freedom.
 

Yal

🍋 *lemon noises*
GMC Elder
I agree that it isn't really a performance issue... and that means it's a convenience issue. So do whichever you think is the easiest to work with.
 
Top