Page 1 of 1

[16.25] Express belt animation stops at a specific time

Posted: Sun Feb 25, 2018 11:30 am
by metriy
After a certain time of the game, the animation of Express belt just stops. But it does not stop working. Animation T1-T2 belts continues to work fine.
This does not depend on the graphics settings or mods.
I played a very long time in this save, with the release of 0.15. Maybe at the specified second there is some overflow of the animation counter?
P.S. i'm using google translate, sorry for that.
situation 1.webm
(848.26 KiB) Downloaded 416 times
situation 2.webm
(1004.24 KiB) Downloaded 286 times

Re: [16.25] Express belt animation stops at a specific time

Posted: Sun Feb 25, 2018 12:50 pm
by posila
Thanks for the report.
Fixed for 0.16.26
I think this makes you record holder of the longest played map with belts :)

Re: [16.25] Express belt animation stops at a specific time

Posted: Sun Feb 25, 2018 1:31 pm
by orzelek
Did it really overflow some counter? ;)

Re: [16.25] Express belt animation stops at a specific time

Posted: Sun Feb 25, 2018 1:52 pm
by posila
You could say that. There was

frame = (int32_t)(tick * animation_speed)

where result of (tick * animation_speed) is double, so when it got larger than max int, casting it to int clamped it to max int (because that's how float -> int cast behaves, it doesn't wrap around as normal integer arithmetic)

Re: [16.25] Express belt animation stops at a specific time

Posted: Sun Feb 25, 2018 1:59 pm
by Rseding91
posila wrote:You could say that. There was

frame = (int32_t)(tick * animation_speed)

where result of (tick * animation_speed) is double, so when it got larger than max int, casting it to int clamped it to max int (because that's how float -> int cast behaves, it doesn't wrap around as normal integer arithmetic)
People using signed types when they never needed or wanted the negative variant -.-

Re: [16.25] Express belt animation stops at a specific time

Posted: Sun Feb 25, 2018 4:41 pm
by SQLek
Dude! Do You really gamed over 9942 hours on this save? Without speeding up ts's like 3.4 years gaming 8 hours a day O.o

Re: [16.25] Express belt animation stops at a specific time

Posted: Sun Feb 25, 2018 4:59 pm
by Supercheese
SQLek wrote:Dude! Do You really gamed over 9942 hours on this save? Without speeding up ts's like 3.4 years gaming 8 hours a day O.o
He could have been playing on a higher game.speed setting.

Re: [16.25] Express belt animation stops at a specific time

Posted: Sun Feb 25, 2018 9:07 pm
by metriy
132 days = 3200 hours, and all at normal speed, just 24/7. And I know, I'm a little crazy :shock: - but someone mining bitcoins, well, I'm the mining ores in Factorio. So meditative... :D
Thanks for answer.

Re: [16.25] Express belt animation stops at a specific time

Posted: Mon Feb 26, 2018 6:32 pm
by metriy
Yes, 16.26 fixed belts. However, the same problem still remained for express splitters and underground belts. :roll:

Re: [16.25] Express belt animation stops at a specific time

Posted: Mon Feb 26, 2018 8:33 pm
by retep998
posila wrote:You could say that. There was

frame = (int32_t)(tick * animation_speed)

where result of (tick * animation_speed) is double, so when it got larger than max int, casting it to int clamped it to max int (because that's how float -> int cast behaves, it doesn't wrap around as normal integer arithmetic)
If you're doing this in C++, it's much worse than merely "clamping". Casts from floating point types to integer types that result in overflow cause full blown nasal demon undefined behavior!

Re: [16.25] Express belt animation stops at a specific time

Posted: Mon Feb 26, 2018 8:37 pm
by Rseding91
retep998 wrote:
posila wrote:You could say that. There was

frame = (int32_t)(tick * animation_speed)

where result of (tick * animation_speed) is double, so when it got larger than max int, casting it to int clamped it to max int (because that's how float -> int cast behaves, it doesn't wrap around as normal integer arithmetic)
If you're doing this in C++, it's much worse than merely "clamping". Casts from floating point types to integer types that result in overflow cause full blown nasal demon undefined behavior!
That's fine. It does the same thing on all of the platforms we support or multiplayer wouldn't work (and it does). We also rely on signed integer overflow/underflow which works as you'd expect it to on all of the platforms we support with tests and everything.