#How would you run an entity with a delay compared with another entity?

8 messages · Page 1 of 1 (latest)

steep raft
#

For example i'd like to run a system '100ms' behind the rest of my app.
The system would run on a fixed-timestep, but delayed by a certain amount compared with another fixed-timestep systems.

(This would be to perform entity interpolation between 2 updates received from the server)

dusty venture
#

I would write a system that gathers the data needed for the delayed system and stores it in a buffer. Then your "delayed" system can pull the data out of the buffer from the frame 100ms ago instead of reading up-to-date data from the world

steep raft
#

awesome, thanks

#

And is it okay if I used the function Instant::now()?

dusty venture
#

Since you're using FixedTimestep, it should be a constant number of frames that you could calculate ahead of time.

#

But in general you shouldn't use your system time, you should use Res<Time>, since it will give you exactly the same time if you are within the same frame

#

I'm not sure if Res<Time> works with fixed timestep though. I know some people were discussing that lately

bleak veldt
#

I've used Res<Time> in a fixed time step, can confirm it works!