[1.1.41] `constant_speed = true` in `working_visualisation` plays animation when machine idle

Bugs that are actually features.
Post Reply
User avatar
kirazy
Filter Inserter
Filter Inserter
Posts: 416
Joined: Tue Mar 06, 2018 12:18 am
Contact:

[1.1.41] `constant_speed = true` in `working_visualisation` plays animation when machine idle

Post by kirazy »

Title. Specifically with `always_draw = true` to override the animation disappearing when idle.

Expected behavior:
When the machine is idle, animations pause, even if `constant_speed` is set to `true`.

Actual behavior:
The animation plays, always, idle or not, powered or not.

Speculation:

The animation pausing when the machine is idle/unpowered is probably a side effect of how animation _speed is calculated, being a function of the speed the machine is crafting at, in that moment. So when the machine is idle, the speed is 0, and so the animation speed is 0.

But since constant_speed makes that a constant, it's never 0, and so always plays. This is... not entirely undesirable behavior, but it's an issue in this case. I would not like a fix for this issue that makes it so you can't have an animation play even when idle... (e.g. the Roboport antenna being replicated on a crafting machine). An ideal fix would be an additional parameter that makes the animation pause when idle.

The problem I am attempting to solve:

Without constant_speed = true, the animation playback speed is impacted by speed modules, which in the modded environment I am designing for gets quickly out of hand and breaks the animation (it do look bad). I had hoped to get around they by setting the animation to play at a constant speed. I use `always_draw = true` here, so that when idle and when active the frames line up and it doesn't look jarring when it goes inactive.

And because this is an entity with fluid boxes, I cannot use idle_animation to get around this.

And here we are.

posila
Factorio Staff
Factorio Staff
Posts: 5202
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [1.1.41] `constant_speed = true` in `working_visualisation` plays animation when machine idle

Post by posila »

"constant_speed" parameter works as intended. Non-existance of parameter that would allow you to achieve what you want to achieve is not a bug.

It is intended for animation state to be as light-weight as possible. For entities with working visualization, there is 4 bytes (one uint) as frame counter, which is progressed in an update based on machines "performance"(*) ... And there is some non-gamestate state to do fade ins/outs - this is why machines using fade out, play it when save is loaded. constant_speed parameter makes the animation use game tick instead of machine's frame counter. Implementing parameter you want would require adding another frame counter.

*) crafting machines have property "match_animation_speed_to_activity" ... which changes this behavior

User avatar
kirazy
Filter Inserter
Filter Inserter
Posts: 416
Joined: Tue Mar 06, 2018 12:18 am
Contact:

Re: [1.1.41] `constant_speed = true` in `working_visualisation` plays animation when machine idle

Post by kirazy »

posila wrote:
Sun Sep 26, 2021 9:48 am
*) crafting machines have property "match_animation_speed_to_activity" ... which changes this behavior
Ah! Perfect. This is why I included the problem attempting to solve. :D Thanks for this!

Post Reply

Return to “Not a bug”