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)