What do servers and clients handle in online games?

Source: Internet
Author: User

Depending on the situation, the client does different things.
The server must at least perform verification.
Compared with online games, data transmission can be ignored to a certain extent, and data back-and-forth time is more important. In general, for example, in wow, the latency of Ms begins to yellow. That is to say, in general, the time requirement is not very extreme. For example, if kof97 is switched to MMO, 200 can be a standard line of common MMO by default.
Specifically, for online games, an individual tends to put all logic processing on the server, and the client is like a media player. This is because, as in a book, the client is in the hands of the opponent. If you allow the server to only play a data exchange role, the plug-in can completely spoil your game.
On the ideal basis, the client needs to perform performances and play various scenes, actions, and special effects based on the input and processing of servers and users. Including role (Dynamic Object), scene (relatively static object), illumination, object, illumination sorting, and dynamic object animation playback.
Of course, this is based on the ideal, and there will be many changes in production. For example, casual games require fast response (for example, bubble Hall, the accelerated role runs fast. How can you ensure that other clients can view the other party's location in real time. Otherwise, the client will not be able to take on more plans. For example, the client is not only playing the function, but also making judgments, first, the client's judgment is executed to pursue the smoothness of the performance. Of course, in order to ensure security, the final data must pass the server-side verification. If the verification fails, it will be corrected. Because the correction is very rough, we are still adding some correction mechanisms to make the correction process look softer, such as in wow, sometimes you will see other monsters or roles dragging speed lines to other places quickly, that is, soft correction mechanisms.
For example, chat. A game is set so that when a player uses the "current channel", it can only be received by players around 50 meters.
So. Player A enters a bunch of words. At this time, the client receives the message and sends it to the server immediately.
The server processes all the chat information at a fixed time, for example, 200 milliseconds. When the client sends the message, the last 200 milliseconds has passed, so it is placed in the queue of the next 200 milliseconds. At this time, no client can see the chat information, including client a (assuming this is set, this is when you press Enter when you are stuck on the network, the dialog box does not display any chat information ).
As time passes, the server starts to run the queue and runs to this place, so it starts operations. The first is to judge whether the chat conversation is the current channel, world channel, or other, the result is the current, so the current channel is processed: Read the location where the player is located and search for other players with a radius of 50 meters, broadcast chat information to these players, including a (if there is a blacklist function, blacklist players should also be removed; if the paying user font has a special color, the style of the conversation should also be spread ).
All clients receive the message and then play it in the chat channel. So everyone can see it.
Basically, the entire process, including the player location information, including the player chat content, cannot exceed 1 kb, even after encryption. That is, the data volume can be ignored normally. This is also the data transfer standard for general online games. More importantly, there are two parameters: the time when the first player information package is sent to the server and returned by the server; the second is the time when the server processes events.
In addition to the UI location, there is no role information, and other information should be stored on the server side. Resources should be stored on the client, including role models, animations, scenes, and special effects. Some games also save a large amount of text on the client, such as task dialogs. Important information, especially any information that may affect yourself or other players, should be placed on the server. For example, the role experience, or even the tasks you have received (if you save them on the client, you change the server, and the tasks you have previously received are gone ).
When and how often the client sends messages to the server, it is generally a persistent connection, as long as the amount of information does not exceed kb, the impact is not very big. In fact, as long as you log on, the server and the client have been communicating with each other. Even if you don't move, the server will keep pushing messages to you because you may receive chat information. So this still makesProgramThey are professional.
This is basically the case.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.