Two types of online games with high latency requirements: first-person shooting (FPS) and instant strategy (RTS ),Latency less than MS is tolerable in RTS games, and latency between MS and MS is tolerable in FPS games.In real-time online gamesAlgorithmTo avoid the impact of network latency on game playability.
1. Main Problems in real-time online games
Main Problems in real-time online games include global time, bandwidth, latency, packet loss, synchronization, and security.
(1) Global time problems
This problem is well known in multithreading and distributed systems. It also exists in multiplayer online games. This problem can lead to a series of problems, such as synchronization, scalability, and security issues.
(2) network latency
Network latency refers to the time when a user sends a request to the remote system to respond to the request and send it back to the user. Generally, route processing, data packet transmission, and server computing will lead to latency.
Online Games require high latency, usually less than 500 ms. Generally, algorithms can be used to compensate for the impact of latency. Currently, the best solution to latency is to useDead Reckoning)Technology.This technology allows smooth and uninterrupted operation on the client. It uses a predictive method to process unarrived mobile messages and uses algorithms to smoothly move messages.
(3) packet loss
One way to solve the packet loss problem is to use guaranteed message protocols such as TCP/IP. Unfortunately, TCP has some behavioral characteristics that make network communication with high real-time requirements a wrong choice. For first-person shooting games, real-time requirements are high, soIn such games, TCP is generally not used, but UDP is used for network communication..
(4) Synchronization
The above problems will lead to synchronization problems. The current measures are to use some synchronization algorithms to reduce the impact of non-synchronous networks. These synchronization algorithms are used for reference from distributed military simulation systems.
(5) security issues
Plug-ins.
2. Basic architecture of online games
It mainly consists of P2P and C/S structures.
(1) C/S structure
Server performance itself becomes a bottleneck, but there is high security, because the server must confirm every movement of each client, so they have the right to deny a request.
(2) P2P structure
P2P games have a large number of communication streams, which may occupy a large amount of network bandwidth. However, the advantage of this structure is that the system is relatively stable. If a node crashes, other nodes can still run normally. In the form of network communication services, a floating server is generally used, that is, a player is the client and plays the role of a server. Generally, players who create a game board are used as servers.