The client server should use a uniform library

Source: Internet
Author: User

The client server should use a uniform library

Online Game servers and clients have many identical functions. Related functionsCodeIt should be shared.
However, the server and client use some specialized tool libraries, so that the Code on both sides cannot be directly shared.

For example, in the equipment upgrade function, which equipment is added with the materials, how much is spent, and which equipment is finally generated,
These are configured by a configuration file, and the server and client are the same configuration files.
The client checks in advance whether it can be upgraded and then requests the server. The server makes the same judgment.
Configuration File Reading and condition judgment are the same for the server clients.
Code for related functions should also be shared.

However, the XML library used by the client is tinyxml, and the server uses other XML libraries.
The client uses a large number of built-in tool libraries, such as a single piece, smart pointer,
That set of tools and server libraries cannot be used in general.
The client is on the Windows platform, and the server is on the Linux platform. They use platform-specific APIs,
The results will also cause unavailability.

To be able to share code on both sides, you need to unify the databases used by servers and clients.
This public library is used for all common functions, and private libraries and APIs are not allowed.

1. Try to use STL and boost libraries.
2. The tool libraries used in the client 3D engine are shared to servers.
3. Use the common libraries and APIs of the platform.

(Jinqing's column)

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.