Tag Info

Hot answers tagged

3

You need to have a future command queue that will only be acted upon once all parties will have confirmed reception of the command. This queue will include no-operation null commands if no new command is to be executed. The delay for each command can be dependent on the ping/lag. The simulation on every peer only executes to the point (call it frame ...


2

Even if there's no host or server, one of the players needs to be in control, be the "host". Assume there's host A and any number of players B (in your case just 1). A pings B and records the average delay. When the game is about to start, A sends to B that it needs to start within N msec (delay value obtained above) after that message arrives. Now when ...


2

Your client never moves you. The server moves you. Think about it this way: A client sends a movement request packet to the server to start moving. The server says sure you can start moving, there's nothing in the way. The server begins moving the player in x direction. The same client ask the server to start moving again. The server says, you're ...


2

With a multiplayer >2 game like StarCraft you can do a best out of X to figure out who's lagging. With a 2 player game there is no way to know who's at fault as it's a single connection, its that one connection that is having issue. Again, there is no such thing as player B being disconnected as the one single connection gets broken, both A and B gets ...


1

When you say "Javascript" you certainly mean "running in the web browser". In that case, peer-to-peer networking isn't possible because there is no browser-independent standard for this. But what you can do is having a server. One technology which is quite well-suited for real-time games are websockets. You can prevent most kinds of cheating by having an ...


1

Welcome to the beautiful world of thread safety and race conditions. The problem you see is very real and a nasty source of impossible to reproduce bugs. A solution I am using is to not process received network messages immediately. Instead, I have the network system add all received input events into a synchronized list. One step of the general update ...



Only top voted, non community-wiki answers of a minimum length are eligible