OpenXcom Forum

Modding => Work In Progress => Topic started by: tyran_nick on July 30, 2013, 07:55:14 pm

Title: Animated gifs
Post by: tyran_nick on July 30, 2013, 07:55:14 pm
Is there any way of using animated gifs for sprites? This should allow us to do a couple of neat tricks
Title: Re: Animated gifs
Post by: SupSuper on July 30, 2013, 08:24:36 pm
SDL_image doesn't support animated GIFs. What "neat tricks" can you do that you can't do with spritesheets?
Title: Re: Animated gifs
Post by: tyran_nick on July 30, 2013, 10:44:47 pm
I was thinking for instance to animate equipment, like armour, when a unit is stationary.
Is there a way to do this with spritesheets? From the little bit I understood of how to build new items, it seems that you have to point it to a single sprite. That would also be relevant to the equip screen and so on.
Title: Re: Animated gifs
Post by: xracer on July 31, 2013, 07:59:11 am
i think Sup meant something like how fire works, it stays animated in the battle field, until it burns out.

I don't know how is coded but i guess it could be just a loop, of course i do not know if an animated .gif will be easier or if to add that to supported format will be more complicated.
Title: Re: Animated gifs
Post by: 54x on July 31, 2013, 08:21:53 am
We could probably support animations for still units, but it would bump up the memory requirements and need some new draw coding, as I believe at the moment the number of sprites and what they're used for is hardcoded.
Title: Re: Animated gifs
Post by: pmprog on July 31, 2013, 09:15:38 am
Animated GIFs aren't "automatically" animated. Basically, the file contains several GIF images with some timing information. All animation has to be done by the application/game displaying them. So you gain nothing over a spritesheet.

If you want to get technical, a lot of libraries don't actually allow you to read more than the first image out of an Animated GIF file, which is a big restriction. Also, having to load frames seperately requires more overhead in terms of CPU and memory. So such filetypes are probably worse in this instance.
Title: Re: Animated gifs
Post by: moriarty on July 31, 2013, 11:39:20 am
wel, the celatid uses an animated image when "standing still", doesn't it? so do the hover tanks. the code should already be there. of course it would be kinda hard to keep animating stuff while moving, but animated stationary units shouldn't be a problem, right?
Title: Re: Animated gifs
Post by: kkmic on July 31, 2013, 11:40:33 am
The hover tanks are not animated when moving?
Title: Re: Animated gifs
Post by: tyran_nick on July 31, 2013, 12:16:52 pm
Indeed, I ll have a look at the code and see how this is done and if we can use this for animating the soldiers when they are still, or equipment. I think the animation during movement can be faked up to a point, so that should not be the problem.
Title: Re: Animated gifs
Post by: moriarty on July 31, 2013, 02:29:38 pm
The hover tanks are not animated when moving?

hmmm... I don't know, actually. my guess is that either the animated "particle flow" stuff is a separate sprite, or there is one animated version for the motionless tank, and the movement animation consists of something that just looks similar.
Title: Re: Animated gifs
Post by: 54x on August 01, 2013, 10:19:33 am
I don't think they're "animated" in the sense of cycling through sprites. I imagine their particle emission is currently hardcoded. (Didn't someone code a particle sheet at some stage? Are we using that code yet? Oh, wait, it's in the experimental TFTD branch.)

At some stage I'd definitely like to build a graphics data format, and just have the engine read preset data, so that people can mod a file somewhat like the ruleset to change what renders when, what displays particles, and how we choose various sprites to render, somewhat similar to the .nml format for OpenTTD.

edit: Was using the wrong file extension in my example. Whoops!
Title: Re: Animated gifs
Post by: Phezzan on August 02, 2013, 05:41:51 pm
Yes the hover tank uses a series of sprites in TANK.PCK.