LAN mode should never be used for Internet games - it is intended for networks where bandwidth is effectively unlimited and latency effectively zero, which is typically only the case with local area networks, and taking advantage of this can improve gameplay quality.
On up Arrow down
If Player.up_pressed = 0
Set Player.up_pressed to 1
Broadcast message "up arrow"
On up arrow released
Set Player.up_pressed to 0
Broadcast message "up arrow off"
ome6a1717 wrote:The good news is that Yes, you can do a multiplayer game with C2 in real-time that works really well! The bad news is the tutorials are unfortunately the wrong way to go about it. Syncing ANYTHING seems to be a giant pain. I've had much better luck sending messages back and forth and updating positions for each player instead of sending the data to the host and resending it back.
Ashley wrote:@ome6a1717's method won't work: both the runtime and network latency are non-deterministic, so only sending inputs will cause the games to diverge until both sides are seeing something completely different. Multiplayer programming is exceptionally difficult, you should really use the built-in syncing features, which have carefully tuned redundancy and compensation features that can adaptively handle things like changing average latency and latency variance, high packet loss and packets arriving in the wrong order, while keeping synced object movement smooth and very close to the position on the host. If you think you can just send a few messages and get a similar system, you are severely underestimating the technology behind the Multiplayer plugin.
If you run two tabs on the same machine, you should easily see <5ms latency between them. A poor quality long distance link from e.g. UK to Australia could be around ~500ms. So if you're seeing 600ms+ on the same machine, that indicates some kind of fault. The latency is 100% to do with the network connection, WebRTC won't add more than a few milliseconds. I did extensive testing of the feature at the time, and even long-distance games worked well with the multiplayer engine's features for compensating poor quality connections.
Users browsing this forum: No registered users and 1 guest