I’m currently thinking of how to implement the count down timer. Let’s say my games duration is 4 minutes. Let’s further assume that I do not have a lobby room but you can enter a running game any time. If player 1 joins the game 30 seconds later, then his count down should start at 3:30.
I started to analyse how timing is done in sim-eth-es and I found that in the ModelViewState.class you have this
// Retrieve the time source from the network connection
// The time source will give us a time in recent history that we should be
// viewing. This currently defaults to -100 ms but could vary (someday) depending
// on network connectivity.
// For more information on this interpolation approach, see the Valve networking
// articles at:
// https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking
// https://developer.valvesoftware.com/wiki/Latency_Compensating_Methods_in_Client/Server_In-game_Protocol_Design_and_Optimization
//this.timeSource = getState(ConnectionState.class).getRemoteTimeSource();
//
// We now grab time from the TimeState which wraps the TimeSource to give
// consistent timings over the whole frame
this.timeState = getState(TimeState.class);
so you use the time from TimeState which is kind of a local time (the getRemoteTimeSource() is deactivated).
But for the HudLabelState.java
// Retrieve the time source from the network connection
// The time source will give us a time in recent history that we should be
// viewing. This currently defaults to -100 ms but could vary (someday) depending
// on network connectivity.
// For more information on this interpolation approach, see the Valve networking
// articles at:
// https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking
// https://developer.valvesoftware.com/wiki/Latency_Compensating_Methods_in_Client/Server_In-game_Protocol_Design_and_Optimization
this.timeSource = getState(ConnectionState.class).getRemoteTimeSource();
the remote time source is used. And due the comment above, I somehow have the feeling this is the correct one and I also think maybe ModelViewState should also use the remote time source. Or what is the reasoning behind to have a local and a remote time source?
Back to my problem, so I would solve my problem by the player entity and attach the game state and the current time and remaining time. That means the remote time. So shouldn’t I use the remote time on the client or the local time. I guess as this count down is not super critical the local time source is ok. Are there any down sides using the remote time source?