Page 1 of 1

The ablity to programatically set an animated entity's animation frame at runtime

Posted: Wed Sep 16, 2015 7:36 am
by Narc
Currently, Nixie Tubes works by some trickery involving a fake "car", because setting its rotation controls the animation state. Unfortunately, the fake car also confuses the map display with arrow pointers where there shouldn't be any.

The easiest solution would be to have the ability to set an animatable entity's animation frame directly.

Re: The ablity to programatically set an animated entity's animation frame at runtime

Posted: Mon Sep 21, 2015 11:15 pm
by vzybilly
I am behind this but I'm not to sure how... workable it is...

it works well when FPS==UPS but on my computer I get 57/60 to 27/57 or worse. in these cases, if the animation is updated each tick, some frames will jump 2 animation-frames, worst case could be 6+ animation frames skipped per frame. at just the right skippage, it could play the animation in reverse or seemed paused.

The part that I could really get behind would be to change the picture/sprite. though, right now the way to do that is cars (nixie way) and animations.

Re: The ablity to programatically set an animated entity's animation frame at runtime

Posted: Tue Sep 22, 2015 1:19 am
by DaCyclops
I too would see use in a system for "defining" animation frames. In fact, if they decoupled animations from the specific entitys, it could lead to some much more interesting graphic options, both for the vanilla game and mods.

Lets take the Roboport's "spinner" on the top.
the current Prototype for it is as follows.

Code: Select all

    base_animation =
    {
      filename = "__base__/graphics/entity/roboport/roboport-base-animation.png",
      priority = "medium",
      width = 42,
      height = 31,
      frame_count = 8,
      animation_speed = 0.5,
      shift = {-0.5315, -1.9375}
    },
Lets say all animations were added to their own table, and tweaked a bit to be non-entity-dependent. It would be great if you could pass something like ani = entity.animations["base_animation"] to work with the animations. It could have vars like ani.animation_speed to allow dynamic changing of animation speed (im working harder, so show it). or ani.animated to define if the animation is actually cycling. combine the previous with an ani.frame_count to allow setting a specific frame, so in the example of Nixie Tubes, showing a certain "number". And maybe something like an ani.visible which could allow animations to be "toggled off" (or changed to a different animation by toggling one off at the same time another is toggled on.)

Re: The ablity to programatically set an animated entity's animation frame at runtime

Posted: Tue Sep 22, 2015 2:15 am
by vzybilly
I do like that, the ability to even change the animation is pretty nifty...

Re: The ablity to programatically set an animated entity's animation frame at runtime

Posted: Wed Jul 06, 2016 11:51 pm
by Ranakastrasz
This is absolutely manditory. Currently, my shield pulse mod uses 20 seperate entities displayed in or out of sequence, which is ridiculous.

Re: The ablity to programatically set an animated entity's animation frame at runtime

Posted: Thu Jan 31, 2019 7:59 pm
by Bilka
DaCyclops wrote: Tue Sep 22, 2015 1:19 am In fact, if they decoupled animations from the specific entitys, it could lead to some much more interesting graphic options, both for the vanilla game and mods.
This is how this problem was solved: I have added animations to LuaRendering, so you can now draw any animation anywhere and anytime you want :)