[2.0.11] Asteroid orientation snapping

This subforum contains all the issues which we already resolved.
User avatar
Gergely
Filter Inserter
Filter Inserter
Posts: 616
Joined: Sun Apr 10, 2016 8:31 pm
Contact:

[2.0.11] Asteroid orientation snapping

Post by Gergely »

In the attached save file, all asteroids can be observed to "snap" their orientation after unpausing.

If the snapping is caused by a timer being reset or a modulus overflowing, it can be fixed by ensuring that asteroids rotate around an integer number of times between timer resets.
Attachments
snappybug.zip
(7.33 MiB) Downloaded 18 times
Last edited by Gergely on Sun Oct 27, 2024 12:50 pm, edited 1 time in total.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3024
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.11] Asteroid orientation snapping

Post by boskid »

Thanks for the report however this is Minor issue.

In order for floating point math to not go out of hands, we only use tick value modulo 65536 to animate asteroid orientation and its done in a stateless way.
User avatar
Gergely
Filter Inserter
Filter Inserter
Posts: 616
Joined: Sun Apr 10, 2016 8:31 pm
Contact:

Re: [2.0.11] Asteroid orientation snapping

Post by Gergely »

In this case you can fix the bug by rounding each randomly generated period to the nearest value with no more than 16 fractional bits.

If P is the number of times the asteroid does a 360° turn per tick then P*65536 (P << 16) should be an integer to prevent snapping. Which is the case if P has no more than 16 fractional bits.

P = round(P << 16) >> 16
posila
Factorio Staff
Factorio Staff
Posts: 5356
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [2.0.11] Asteroid orientation snapping

Post by posila »

Oh, thanks for the tip with 16 fractional bits, it never occured to me, that this would work with floats too.

Fixed for 2.0.17. I ended up turning the random rotation computation to fixed point math.

(Duplicate: 120952)
Post Reply

Return to “Resolved Problems and Bugs”