by Isaac » Wed Apr 20, 2005 10:22 pm
Multiplayer games (and simulators) are not too more difficult to make than single player ones. Pre-Flight for instance is multiplayer, and was coded by a single person (afaik): Jose Pena.
It's only a matter of sharing all the data needed to synchronize the software in all the computers involved.
Games and simulators are deterministic software. From an equal initial condition for all computers, if you feed them with the same inputs (including user inputs, random generators, etc.), the results will be always equal.
Games and simulators are also iterative (work in "rounds") and interactive , i.e. From an initial state it takes the data inputs and calculates the next state. In the next round, the previous state is used as initial state, new inputs are gathered and new calculations are made. Each state represents a time slice (1/50 s for instance). This calculation is repeated 50 times (in our example) per second.
Before calculating the next round, all computers send their inputs to all other computers. So they all have the same inputs for calculating the next state.
Each computer calculates the new state for all elements (planes) of all computers, applying the right inputs to each one. Then generates a screenshot to show to the user.
As more players are involved, more data needs to be transfered and more calculations need to be made each turn, so more computing power is needed.
Of course all computers should be powerful enough to keep in pace with the others. If no, out of synch situations may occur.
Spectator's computers just need to receive the data and calculate the screenshots to show to their users. They don't send anything and the players' computers don't even need to know they exist. As data is sent via broadcast, there isn't a (theoretical) limit to the number of spectators.
Isaac