

The state of your current saved game has implications for how we decide to load animations. But even if he’s near the pool, we don’t need his swimming animation if the player doesn’t have swim trunks in their inventory. We don’t need Voodoo Detective’s swimming animation if he’s not near the pool. This may sound obvious, but sometimes it’s a little difficult to know which animations to load.
#BARSOOM BOOKS FREE#
If you’re interested in the gritty details of how it was implemented (using Unity’s Addressables library), please feel free to reach out and I’ll be glad to talk your ear off.īasically, I would only load animations into memory if I knew they were going to be used in the current scene. This is actually a whole can of technical worms I could drone on about for hours. The final technique I leveraged in Voodoo Detective to keep animation memory usage down was the dynamic loading of animations. In point of fact, it was the main reason I started using atlases in the first place.

But I mention it for the sake of being thorough. I sure don’t, but suffice it to say: your GPU has to do less work. Maybe you don’t know exactly what this means. They cut down on the number of draw calls you have to issue to your GPU per frame. I’m not actually sure what all accounts for the memory savings you’ll see below (possibly a consequence of the compression algorithms being used).

But to be fair, image compression algorithms are usually pretty good about taking advantage of unused pixels to compress images. When you put largely empty frames into a sprite atlas, by ignoring the empty space, you can arrange the sprites much more efficiently. When this is the case, the shape of your “cookie” isn’t really a rectangle, but whatever shape the non-empty pixels end up being. Sprite atlases are useful for two reasons:Īll of our characters are animated on frames with a resolution of 1920x1080, but the majority of those pixels are empty. These are the animations where characters are standing still and blinking every so often. The perfect example of where this would be most impactful is found in our idle animations. When the animations were played, I could simply repeat each frame twice.Īs I put this optimization into practice, I quickly realized that the principle could be further utilized by deduplicating all non-unique frames in any given animation. I realized early on that since we were planning to animate on twos, I could cut our animation memory usage in half by only storing every other frame of animation. I leveraged three main techniques to cut down on our sprite animation memory usage. The only place we used ones was in short bursts during tricky FX animations. All character animation in Voodoo Detective’s was done on twos. I think this video explains it all much better than any number of words ever could. Sometimes to save even more effort, animators will repeat each frame thrice to produce 8 unique FPS over a 24 frame interval. This technique is called animating “on twos.” Oftentimes, to save on effort, animators will repeat every frame twice to produce 12 unique FPS over a 24 frame interval. Hand-animated 2D animations will typically display frames at a rate of 24 frames per second (FPS).īut that doesn’t mean each of those 24 frames has to be unique. But first, here’s a little background on how animation works.īy displaying an ordered sequence of still images (frames), one after another, we’re able to simulate motion. As such, I’ll spend most (all) of this post talking about how I optimized animation memory usage. The single most gluttonous consumer of memory in Voodoo Detective is our sprite animations. you’re too CHICKEN to come play with me in this technical wonderland).īut if you do continue reading, I’m going to assume that you know what computers are, what computer memory is (RAM), and what persistent storage (hard drives) is.Īnd if you do stick around, I promise this will be a memorable one. So please, feel free to skip this one if you’re not interested (i.e. Having said that, what I write here is likely to be more technical in nature than what I’ve shared previously. I just realized that despite all the fuss we make about amnesia in Voodoo Detective, I never took the time to share how the game manages memory! In this blog post, I set out to remedy this gross oversight.
