game development – Why do 2D games use storyboards instead of GIFs?

Question:

I decided to create a simple 2D game for self-education. The question came up: why do people use storyboards and not ready-made GIFs?

Answer:

Disadvantages of GIF :

  • very limited color gamut: usually 256 colors with poor anti-aliasing. (yes, you can use more than 256 colors , but these are very rare cases)
  • graphic processors (GPU) do not support GIF compression (compression), which means that one way or another it will have to be unpacked and at the same time at the expense of the central processing unit (CPU)
  • for transparency you can only use ONE color (unless you do your own custom processing)
  • no random access: to access the desired GIF frame – it is necessary to read and decompress the previous ones
  • you need to have a dedicated decompression function in your code. You won't be able to choose other (better) compression algorithms (yes, uncompressed GIFs exist too , but these are quite rare cases)
  • does not support vector graphics.

When you work with your own format, all issues are resolved quickly. You have more control over image format, quality, transparency, random access, and compression (including DXTs that GPU support). In addition, you can prioritize the features you need.

Some people think that GIF has an advantage over sprite sheets, that they don't have to worry about the frame going too fast or too slow and try to correct the speed in the code. But this is not the case. The frame rate sync of GIF animations and sync to sprite sheet animations are not much different. In both cases, you will have to know and manipulate the list of frames, set the desired frame rate and work with render events. GIF – will not create magic, in order to achieve the goal, you will have to unpack the GIF into a sprite sheet anyway.

Perhaps the only place where you do not need to worry about frames is HTML / CSS GUI , but they are now used there quite rarely … well, they are resource-intensive

+

As I wrote in a comment, in a simpler language: you have a GIF animation of flashing lights on a police and fire engine. At some point, you decided that the flashing lights were spinning too fast … Rebuild GIF ? Not an option. And if you didn't like it again?

And if the character has to move quickly, then slowly (for example, slow mo). And if the character makes a series of punches (combo), and can stop at any of the series of punches, and each animation of the interrupted combination is different (example of a combination: UMK3 ultimate – Liu Kang – 4 kicks. The animation of the return of the leg is different). Q: slice all sorts of GIF combinations?

Besides, where should the process of playing the GIF animation take place? The process of redrawing the scene takes place in the game. About 60 times per second (plus / minus). Where exactly should the GIF be located in order to start the animation from the same moment from which it was interrupted after updating the scene rendering? Or how should it sync? All this results in a big headache.


small translation with gamedevSE gag

Scroll to Top