OCESS / orbitx

Rewrite of OrbitV, maintained by Patrick, Gavin, and contributors
MIT License
10 stars 18 forks source link

Network commands are only reflected in the next networked get_state #129

Open pmelanson opened 3 years ago

pmelanson commented 3 years ago

Currently, sending a network request with a command like TOGGLE_COOLANT_LOOP only shows an effect on the next request. This is the relevant timeline:

simtime = n: client sends a get_state command, with attached TOGGLE_COOLANT_LOOP command
simtime = n + 0.00001: request TOGGLE_COOLANT_LOOP occurs in the simulation

The physics engine will then send the state of the simulation at time n, before the request has been applied. This is okay for eventual consistency of the simulation, but it means we're delaying input feedback to the user by exactly 1 second more than we have to.

I should fix this.