Development [Asking for suggestions] - How to organize a lot of sprites in a GMS2 project?

gkri

Member
I am making an alphabet mobile game for kindergarten kids. In one of the mini games, the player will have to match up to 4 pictures (of total 6) to a given letter. E.g. If the given letter is "A", the player should tap on the airplane, ant, aligator, etc
As starting point I aim to have about 5 pictures per letter and expand later. Also worth mentioning that each letter may end up at any number of pictures. e.g letter "A" may will have 5 pictures total but may another 4 pictures will be added later. Each letter may have any number of pictures the project will be completed (not counting possible updates).

The organization problems starts when more than one language is supported. Same picture's word may or may not has same first letter. Thus making me skeptical that if I make poor organization choises I might re-do a LOT of work later...

The best way I came up with, is to put all those pictures as frames in a single object, and enumerate the frames. But I will really like to hear any suggestion/advice on how to handle this!
 

kburkhart84

Firehammer Games
I don't think there is any easy way to do it. You can put things by letter, and just consider the "primary" letter of a picture, and I think that is the best it is going to be. So 'Apple' pictures would be with the 'A' folder, even if in some other language the word doesn't start with A, simply because in the majority it does(just an example, it may not be accurate for the word).

Alternatively, I seem to remember something about the texture page system optimizing to the point of removing duplicates. It may be that if you have a duplicate sprite, it doesn't duplicate that texture space. I could be wrong on that, but it seems like I saw that somewhere. You could test it and see, just make 5 of the same sprite and look at the texture pages.

EDIT********

I just tested myself, and on 2.3.2.560, it IS indeed conserving with the same exact sprite. I have for sprites with the exact same image(just made as duplicates), and it only appears once in the generated texture pages.

So, if you don't mind duplicate sprites in your asset/resource tree, you can have them duplicated all over the place I'm assuming, and it will allow you to have each language have its own set of sprites if you want to. And though you will have more sprites on the list, at the least you won't be wasting runtime texture page space.
 
Last edited:

gkri

Member
kburkhart84 Thank you for your answer!

A small parenthesis with info that might be interesting for many, about sprites duplicates : (EDIT:TYPO)
I used duplicated sprites in my first gms2 project (pre 2.3 so no fancy after effects like time line) for lip syncing speech. Talking about A LOT of duplicate frames in sake of timing:
cards_picou.gif
I had the same conclusion when testing (gms2 detects duplicates). But in action it is not 100% true. It is misses some and they waste some space in the texture pages. But nothing dramatic to affect my project, because it is small and simple.

Maybe I do it as you suggest, but meanwhile I though another approach that worth investigating. Let's say I put all the pics as frames in a single sprite (lets say it "library"). Can I create at runtime new sprites with selected frames from the main "library" sprite?
 

kburkhart84

Firehammer Games
Maybe I do it as you suggest, but meanwhile I though another approach that worth investigating. Let's say I put all the pics as frames in a single sprite (lets say it "library"). Can I create at runtime new sprites with selected frames from the main "library" sprite?
You might be able to...but it would actually be better to just store the data that references the sprite(and frame) and just draw it from there. So each language could have some data saying what pictures are for what letters and then just draw the right sprite at the right time.
 

gkri

Member
Yes you got a point... Thank you!

If I come with a system that is worth mention it, I will post it here.
 
Top