aliens

Author Topic: Animated gifs  (Read 8894 times)

Offline tyran_nick

  • Captain
  • ***
  • Posts: 59
    • View Profile
Animated gifs
« 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

Offline SupSuper

  • Lazy Developer
  • Administrator
  • Commander
  • *****
  • Posts: 2162
    • View Profile
Re: Animated gifs
« Reply #1 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?

Offline tyran_nick

  • Captain
  • ***
  • Posts: 59
    • View Profile
Re: Animated gifs
« Reply #2 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.

Offline xracer

  • Commander
  • *****
  • Posts: 565
  • X-COM lover, we've gone at it everywhere
    • View Profile
Re: Animated gifs
« Reply #3 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.

Offline 54x

  • Colonel
  • ****
  • Posts: 208
    • View Profile
Re: Animated gifs
« Reply #4 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.

Offline pmprog

  • Commander
  • *****
  • Posts: 647
  • Contributor
    • View Profile
    • Polymath Programming
Re: Animated gifs
« Reply #5 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.

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: Animated gifs
« Reply #6 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?

Offline kkmic

  • Commander
  • *****
  • Posts: 582
  • Undefined
    • View Profile
Re: Animated gifs
« Reply #7 on: July 31, 2013, 11:40:33 am »
The hover tanks are not animated when moving?

Offline tyran_nick

  • Captain
  • ***
  • Posts: 59
    • View Profile
Re: Animated gifs
« Reply #8 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.

Offline moriarty

  • Commander
  • *****
  • Posts: 1421
    • View Profile
    • Luke's OX mod site
Re: Animated gifs
« Reply #9 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.

Offline 54x

  • Colonel
  • ****
  • Posts: 208
    • View Profile
Re: Animated gifs
« Reply #10 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!
« Last Edit: August 03, 2013, 10:32:36 am by 54x »

Offline Phezzan

  • Sergeant
  • **
  • Posts: 37
  • Twilight
    • View Profile
Re: Animated gifs
« Reply #11 on: August 02, 2013, 05:41:51 pm »
Yes the hover tank uses a series of sprites in TANK.PCK.