RTS sprite methods. Need advice please!

I have been working with sprites in my RTS and while in most games that use sprites, there is one large texture map that has the animations for each direction and action. I was told that using lots of animations with sprites, you are limited on how many different animations you can have because the larger the image and lots of units it would start bogging down the engine. I think I have found a way around this using my own method which uses only one 256x256 image that gets updated (will go into more detial below). I haven’t tried using one large texture map yet. I am determined to find a solution so that I could have as many animations as I would like and with hundreds of units. I would like to know if there could be a problem in the future if I continue to build my RTS using this method. Some one might have already thought of this I just hadn’t come across it anywhere.

OK so the Starcraft Marine has around 229 frames that consist of idle, walk, attack ect… the size of this image is 1088 × 896 and I assume the image moves according to what command the unit is given (if that makes any sense). So if there were 50 marines in the viewport its having to process 50, 1088 × 896 images .

So what I came up with is having a plane designated for each frame for all the animations. For example, my infantry unit has 16 directions he can move, and between the walk, idle, attack and dying animations there are 338 frames for the infantry unit. So there are 338 planes for the infantry unit. All of these planes are kept on a hidden layer, and the script only calls the current frame from the hidden layer as it needs it. So when a unit is spawn, it calls the first frame for the idle animation, and on the next tick it adds the second frame in the idle animation and deletes the first one and so forth. So when I have 50 units in the viewport there would be only 50 256X256 images. I assume this way would allow you to have almost any amount of animations you want since it is only loading 1, 256x256 image (per unit) at any given time.

I tested this with around 700 units. It starts bogging down after 700 due to collision (and probably some sloppy code sinse this is the first version)

Hopfully the image I added helps make sense out of all that!
Any thoughts would be great!


add object/ end object each frame is not good.

check out replaceMesh()

you could also use a node material, and use object color to manipulate uv.

Noted! Thank you that will be helpful!