r/GraphicsProgramming • u/squeakorca • Oct 14 '24
Question atm bugged animation, why?
Hey beloved Reddit users, what could be the problem that causes something like this to happen to this little old ATM machine?
3d engine bug? stuck animation loop?
35
6
4
2
u/huttyblue Oct 15 '24
If I had to guess its old software running on a new machine, the animation time is probably tied to cpu cycles in some way, and the new machine is such a big jump in power the animation plays back really quickly.
1
1
u/davidc538 Oct 15 '24
My best guess is that it’s some bug related to the clock causing it to play way too fast
1
u/ninetailedoctopus Feb 01 '25
Most of them are using IE. No, not edge… the old IE.
Source: I worked on ATMs for a while
0
Oct 14 '24
[deleted]
0
Oct 14 '24
[deleted]
2
u/fgennari Oct 14 '24
Anything with a 32-bit counter that overflows at 4B is likely to never overflow in its lifetime due to user events like button presses. But even something with a 16-bit counter that overflows at 64K events is probably not going to be noticed. Plenty of things can overflow, then they typically wrap back around to zero. Anything important enough will probably be recorded and whoever maintains the logs will know when it wrapped back around to zero.
It can sometimes be a problem. I work in the EDA field and we sometimes have integer overflow bugs with internal counters in our software. Usually the fix is to add more bits to the counter.
1
u/Agitated_Marzipan371 Oct 15 '24 edited Oct 15 '24
The thing about clocks in particular is there's a limited amount of values that you will ever need to represent so you can reset to 0 every 12 or 24 hours. For example you could count each second then do some math to get your HH:MM:SS format then reset after you get to 11:59:59 (or 23:59:59). If you did want to keep increasing one value you can use the 'modulo' (like a remainder) operator to remove the extra orders of magnitude (days in this example). If you used the regular numerical data types in most programming languages (they don't all work the same) then you would in theory overflow at some point even if you had to wait many lifetimes for it to happen.
Edit: I just realized after typing all that you probably meant timers, not clocks. Those count up time like I mentioned above but the button will only make a value go back and forth (true<->false or 1<->0) so there's no risk of overflow
0
Oct 15 '24
[deleted]
1
u/Agitated_Marzipan371 Oct 15 '24 edited Oct 15 '24
Integer division using binary long division is O(log(n)) which is faster than you might think, O(n) would be the time complexity of division by just subtracting over and over until you get your result.
If you wanna learn more Google asymptotic notation / big O notation / time complexity of a computer program. YMMV though that stuff doesn't get taught until usually like 2nd semester or later in most CS programs.
(Edited a few times for more detail): as for your 2nd question the if statement is O(1) or constant time, or asymptotically as fast as it gets. Because the division happens inside the if statement it's O(1 * log(n)) which is in the same complexity class as O(log(n)). Multiply that by each second you do this check is O(s * log(n)) total operations. The concern isn't doing a few operations N times but doing those N2 , then N3 , then N5 etc which can make a simple program if written inefficiently take longer than the known age of the universe on a large enough set of inputs. (This is the general case that most CS majors focus on in their undergrad, context matters).
1
u/ShotSquare9099 Jan 28 '25
I solve this by AND-ing ( & ) the value with the max value that I need.
result = value & <max_value>
Eg
result = value & 0xFF
would keep the value between 0 and 255 overflowing until the reminder is less than 255.
Sorry old post
0
Jan 28 '25
[deleted]
1
u/ShotSquare9099 Jan 28 '25
Yeah essentially it would freeze. You would use Modulo if you needed a value in that range
14
Oct 14 '24
[removed] — view removed comment
1
u/Eklegoworldreal Oct 14 '24
1: it's z fighting not z fighting 2: it's not z fighting either
14
Oct 14 '24
[removed] — view removed comment
3
u/Eklegoworldreal Oct 14 '24
Oh that's mb, I'm in a graphics dev discord server where worse has been said unironically
46
u/thats_what_she_saidk Oct 14 '24
possibly incorrect time step for the animation. Someone might have pushed some change which changed some function to return second instead of milliseconds. Or if it’s a static time step it could have become corrupted somehow.