Hacker News new | ask | show | jobs
by ape_key 856 days ago
respectfully you haven’t written enough games

> real game

turn-based and real-time games have different kinds of complexity, so a platformer won’t expose you to all of it.

turn-based games are roughly going to give you an easier time separating the game code, but the UI code is going to feel like a debilitating slog.

> Many games are 100% deterministic

Until you use floating points, networking, or different platforms.

This is more likely to be true in turn-based games, and super unlikely in anything real-time and multiplayer.

Most games like that periodically sync state instead of relying on applying actions on each client

1 comments

Are you saying that IEEE 754 floating point (which everybody is using) is not deterministic?
For 32-bit x86 it's certainly not. The C standard permits intermediates to preserve excess precision, and the only way to avoid that is by flushing to memory, which is slow. On Windows you usually get 64-bit intermediates and on other OSes usually 80-bit.

64-bit x86 and modern non-x86 architectures are usually deterministic for primitive operations at least, but libm differences abound.

Simple operations like addition and multiplication are generally bit-for-bit deterministic, even across different architectures. More complex operations like fused multiply-add can have slightly different rounding behavior. But the big issue is with the more complicated operations, like trigonometric functions or non-integer exponentiation. Those often have differing implementations between platforms, and the only way to guarantee determinism is to essentially roll your own sin/cos/tan/sqrt/etc.
You have to be careful with comparisons. In JavaScript, for instance, `(0.1 + 0.2) != (0.3)`.
Well that doesn't make it non-deterministic in behavior.
(a+b)-a doesn’t always equal (a-a)+b

It’s different behavior if the order of operations are non-deterministic.

Plenty of room for such things in games. Most of the time the effects are too small to notice. They can chaos-theory out of control, though.

So real time games nearly universally sync state instead of relying on deterministic synchronization via events/actions.

For a good read, look up lockstep deterministic networking.

There’s way too much nuance here to be so dismissive

Chaotic behaviour is deterministic
Weird how I write complete thoughts and supply references but this site full of tech geniuses mostly produces downvotes and single-sentence drivebys.

Come back when you have things worth contributing.