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

Post Reply
User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 278
Joined: Mon Feb 11, 2013 7:25 am
Contact:

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

Post 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.

vzybilly
Fast Inserter
Fast Inserter
Posts: 143
Joined: Thu May 14, 2015 6:10 pm
Contact:

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

Post 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.
Will code for Food. I also have 11+ mods!

User avatar
DaCyclops
Long Handed Inserter
Long Handed Inserter
Posts: 85
Joined: Mon Aug 25, 2014 12:37 am
Contact:

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

Post 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.)

vzybilly
Fast Inserter
Fast Inserter
Posts: 143
Joined: Thu May 14, 2015 6:10 pm
Contact:

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

Post by vzybilly »

I do like that, the ability to even change the animation is pretty nifty...
Will code for Food. I also have 11+ mods!

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

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

Post by Ranakastrasz »

This is absolutely manditory. Currently, my shield pulse mod uses 20 seperate entities displayed in or out of sequence, which is ridiculous.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

Bilka
Factorio Staff
Factorio Staff
Posts: 3133
Joined: Sat Aug 13, 2016 9:20 am
Contact:

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

Post 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 :)
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Implemented mod requests”