I’m making a mobile vocabulary game for children that will include a large library of animations - for example a pig grunting, a horse neighing, etc.
Since videos run on the CPU with Godot, I converted them into 8×8 sprite sheets, with each frame at 512×512, so each sheet is 4096×4096. These are played back as 15 fps SpriteFrames animations.
The textures are imported as VRAM Compressed, so each packed sheet takes about 16 MB. Eventually there will be hundreds of words with animations, and I’m concerned users won’t like the game taking up multiple gigabytes on disk
Maybe I am not fully understanding your question/concern - sorry in advance. Maybe you could elaborate on how you plan to use these animations a bit more. Should they loop? Are they part of a larger movement set with transitions? Why are the video in the first place? These are just a few loose thoughts:
If you need to use video, there are a few pretty good encoders available that might help you in terms of overall size. This might be more taxing on the CPU but many codec have proper hardware acceleration available.
If your game is so heavily reliant on animations, I’d consider using another approach to those. Godot has some nice animation tools available with AnimationPlayer and Tweens. You’d have to prepare the visual elements for that of course. A 3rd party option would be an animation software like Spine.
Thanks for your response! No problem, I understand this is not quite traditional game development.
Since it’s a content-heavy game, with an animation for each word, I’m generating content rather than manually animating each and every individual animation as it would take forever. One game for example is to select the word they hear, the sound is played out - “cat”, and they select the word. When the right word is selected, they see a 2-5s animation played along with the sound - like the cat meowing. First environment is 60 words, manually animating every image would take forever.
I used to have a wheel that played the selected animation, so it would do a number on the battery usage. The game has changed a lot since and short animations are not played so frequently anymore. Maybe videos are the better way at this point.
I’d be inclined to suggest videos, or maybe even just one video with all the animations strung one after another. I’m assuming you’re planning on exporting this to mobile, and we’ve had at least one person show up on the forum here in the recent past with an Android phone that couldn’t handle any texture larger than 2048 pixels on a side.
You’ll have access to higher frame rates if you want, and movie codecs these days are pretty good at inter-frame compression, so they should take significantly less space than your sprite sheets. They’re also implicitly streamed, which means the code that handles them should be smart enough to keep only what it needs in memory, while the sprite sheets may wind up being cached. Movies get you audio “for free” as well.
Figuring out the right video compression will be an interesting thing. I wonder, if there is anyone with experience in dealing with video in Godot.
I’d probably take a look at heavy AV1 or VP9 en- and decoding and compare it to h.264/h.265 in a few different containers. Following your chain of thought, you probably should try VP9 first, as it is easier on the hardware decoding it and less problematic with its license. AV1 would be the best choice, but needs good target hardware and even better hardware on your end to encode all those videos in the first place.
The documentation says, that Godot at this moment only supports OGG Theora - which by no means is on par with any modern codec.
There is a repo for AV1 in Godot but it seems stale and rudimentary.
In case, you follow this path, consider changing the title of this thread to something with video and keep us posted
As a side note: assuming your animations are all 3D, you may still talk to the artist and ask them to try animating in engine. Performance, flexibility and size (or broadly optimization) are all so much better when using the game engine as the base layer of animation.
Or do you mean AI generated animation when you say “I’m generating content”?
Yes, AI generated - it’s a low budget project for a very niche market so creating hundreds of 3d models and animations for 2-5 second clips wouldn’t be sustainable
I’m aware of the outdated video technology in Godot, that’s why I tried to use sprite animations instead, but that comes with a different set of problems. So now I need to figure out the lesser of two evils. Third evil would be redoing everything in Unity…
Thank you, it would’ve been interesting to know which device they had a problem with as I’ve tried this on both very old and low end android devices and while the app might lag a little on the most low end device, it didn’t have an issue loading in the sprite sheets but anyway, the large app size I’d end up with feels awkward.
The painpoint with video is as @ximossi pointed out, the video technology natively supported in Godot is very outdated, and I’d prefer to not have to take long detours.
Although Theora isn’t a modern codec it doesn’t mean it can’t do the job with the kind of animations you’re working with. Unless you’re playing several videos on screen at the same time, performance shouldn’t be an issue. The Theora decoder uses little resources, more modern codecs will require more powerful hardware. I think it could be a good fit for this case.
But be aware that using Godot 4.4.1 or, even better, 4.5 when it comes out, is heavily recommended for videos.