Demo Addon and Demo Vehicle to Detect if You Are Host (Server) or Client (Participant) Using a Vehicle Indicator
----- Purpose -----
Utilizing the fact that physics calculations are not performed on the client (or perhaps only slightly), this is used to reduce client load by executing vehicle autopilot processing only on the server side.
*Reducing client load can lessen the possibility of clients being unable to keep up with the server's processing speed, thus reducing lag.
----- Mechanism -----
・Stormworks' vehicle Lua runs on both the server and clients but is not synchronized.
・Output from vehicle Lua is also not synchronized (it synchronizes periodically for only a few ticks).
・Addon Lua does not run on the client; it only runs on the server.
1. Use math.random() to ensure that different values are output for each observer (each client).
2. The addon Lua receives the random number via a dial.
3. The addon Lua outputs the received random number directly to a keypad.
4. The vehicle compares the keypad value with its own random number.
- If the keypad value and its own random number differ: The observer of the indicator is a client.
- If the keypad value and its own random number match: The observer of the indicator is the server.
>search
sync async check client server