Hacker News new | ask | show | jobs
by ThatPlayer 729 days ago
I think another issue with lockstep is that for it to work, each client needs all the input data from all the other clients to be able to simulate the next step, otherwise the simulations become out of sync. So how does the simulation handle both your input, and another clients input that comes in 100ms later? If you just pause until you get their input, your game is effectively pausing and running at 10 steps/second. For comparison Starcraft 1 ran at 42ms a step, or ~24 steps per second. You'd be playing in slow motion.

Games like Starcraft 1 would handle it by adding an artificial delay to your inputs (and all your opponent's inputs). Putting it into a buffer for future steps instead. If anyone remembers the latency option for "Extra high latency", this would increase the delay on inputs so that simulations did not have to pause while waiting for inputs from other clients. And then if any network fluctuations causes your input buffer of other clients to empty, you have to pause again.

In fighting games this is usually called delay-based netcode, and people hate it. It makes your inputs feel unresponsive, and in games that require fast reactions (like fighting games) gives you a smaller window to react.

2 comments

Some games that used a determinism based architecture, will actually provide immediate feed back faked on the client and then some how make that work when the real stuff happens later. See Starcraft providing instant audio response when moving units or for Factorio: https://factorio.com/blog/post/fff-83 https://factorio.com/blog/post/fff-412 (second half of post)
Fighting games still typically use a deterministic simulation too. The difference is the good netcode, called rollback, works by using save states and rewinding the simulation to the time of your opponent's 100ms late input, and then resimulating the 100ms from there. You can get away with little or no delay on your own inputs.

I doubt that'll scale to games like Starcraft and Factorio, because in my example, you would need to resimulate 100ms of simulations in ~16ms. In a fighting game with 2 characters and not much else to simulate, that's a lot easier.

https://words.infil.net/w02-netcode.html

This is all way above my understanding, but:

Recently I’ve been playing Arma Reforger with friends online on a dedicated server, and when driving vehicles the collision physics are off, especially when driving fast, making the whole scene “teleport” forward, with frames lost and the vehicle reappearing in unexpected positions.

I wonder if this is related to this type of code. The game is technically out of early access, but there’s lots to be added still on the roadmap.