Synchronize water wave phase between clients - #5380
Conversation
|
This is a good idea. Great job! I think it makes sense to expose "serverTime" to Lua. This way developers can use the same time variable to sync other things created in scripts. This will eliminate the need to sync server time using events. Similar approach could be used to sync randomly generated grass between clients. Like syncing server start tick and using it to generate grass (obviously it will not be random anymore but that is the point). |
|
PR #4821 introduces synchronized time, but it isn't available in Lua. |
Maybe it's a good idea to make synchronized time a separated system with Lua interface. And then other features will use this time variable (like your animations sync PR and this PR). |
|
Id love to have server time in client side Lua. In milliseconds if possible, for precise synced operations |
Summary
Synchronize water wave phase using server timestamps appended to existing map-info and return-sync packets.
Clients advance the phase using elapsed real time and smooth timing corrections.
Closes #2536
Motivation
setWaveHeightsynchronizes wave amplitude, but GTA calculates wave phase using each client’s local game timer. Players can therefore see different waves.Test plan
Checklist