If you decided to create a network game, it is necessary to know that you can meet with implementation of this idea certain difficulties.
Today a qualitative game should work in the Multiplayer mode, that is it is a game of several users who are connected among themselves by the Internet or a local area network.
Two players – the simplest case
The simplest network game is intended for two players. In this case one of computers will be the main thing – the leader, and another – slave. The main machine manages movements, collisions and all play space in general. To synchronize the game worlds, events are transferred to the second computer, that marks them on the map (it is identical to the card of the computer host).
All random elements, for example, cartridges and first-aid kits which are placed in different places of the game field should be also transferred to a slave device. It becomes only once before beginning a game. All map can be transferred. The slave computer transfers to the leader information on clicking of keys.
How to create a network game on the Internet
It is more difficult to transfer data to the Internet, than on a local area network. It should be considered if decide to make a network game. The fact is that at data transmission there are delays from time to time, and it is necessary to take additional measures that a game continued to function normally. The movement of mob usually happens on a certain template therefore the computer can transfer a command like "be protected according to script B" or "run away according to script C". Thus, the amount of information transferred to them will be reduced, and it will be much easier to provide synchronization – it is necessary to transmit periodically signals which demonstrate that the object crossed some cage of the game field. It is good to use this transfer protocol during the work with the loaded channels as it is resistant to delays.
How to make a network game: fight against cheaters
Those who is going to create a network game should think of methods of fight against a possible cheating seriously. To protect computers from cracking, it is necessary to interchange the position of the slave and conducting devices from time to time – it is simple to carry out it.
If it is more players, than two, there can be new problems. That the leading computer could service a set of conducted, rather powerful processor is necessary. However the main complexity consists not in it. The situation when between computers it suddenly is disconnected can become problem. Installation of the dedicated server can become the solution. It is also possible to establish connection not only between the computer host and the others, but also between all leading computers. Thus, each computer will periodically become the leader, and if the main device is disconnected, there will be nothing terrible. There is one more option. It is possible to refuse the "main" computer in general. Each machine will manage movements of the mob and the player, sending data to the rest. This scheme will help to solve practically all problems.