This series of blog mainly on the background of the game to introduce 3D PvP Network game Common Development technology and C + + advanced programming skills, with this knowledge, you can develop small and medium-sized game projects or 3D industrial simulation projects.
The author will be divided into the following three sections to introduce to you (daily update):
1, the realization of the basic communication framework, including the game needs analysis, design and development environment and the construction of communication framework;
2, the implementation of the network underlying operations, including the creation of thread pool, serialization network packets, etc.;
3, actual combat drills, to achieve similar to the CS counter-Strike 3D Battle Network game;
Technical points: C + + Object oriented thinking, network programming, QT interface Development, QT control knowledge, boost smart pointers, STL algorithm, STL, container, boost network library, OpenGL coordinate transformation, OpenGL load 3D model, MD2 model loading, MDL model loading
OK, let's start today's learning journey, today we will be a detailed server-side design, the next blog will be detailed design of the client.
introduction of Class Diagram
(1) Introduction:
Class diagrams describe the object models in the system and the various static relationships that exist between them. The class diagram also shows the nature and operation of the class, as well as the constraints applied to the connection of the object, and the relationships between the classes mainly include associations, generalizations, and combinations.
Ii. introduction of factory model
(1) Intention:
Define an interface that creates an object so that its subclasses decide which factory class to instantiate, and the Factory mode defers its creation process to subclasses.
(2) Main solution:
The main solution to the problem of interface selection.
(3) When to use:
We explicitly plan to create different instances under different conditions.
(4) How to solve:
Let its subclasses implement the factory interface, and return an abstract product as well.
(5) Key code:
The creation process executes in its subclasses.
(6) Application Example:
1, you need a car, you can pick up directly from the factory, without having to control how the car is done, and the specific implementation of the car.
2, Hibernate Exchange database only need to change dialect and drive.
(7) Advantages:
1. A caller wants to create an object, as long as it knows its name.
2, high scalability, if you want to add a product, as long as the expansion of a factory class can be.
3, the specific implementation of shielding products, the caller only care about the interface of the product.
(8) Disadvantages:
Each time you add a product, you need to add a specific class and object implementation of the factory, so that the number of classes in the system multiplied, to a certain extent, increase the complexity of the system, but also increase the system specific class dependency. That's not a good thing.
(9) Use the scene:
1, Logger: Records may be recorded to the local hard disk, system events, remote servers, etc., the user can choose where to log logs.
2, database access, when the user is not aware of the last system to use which type of database, and the database may change.
3, design a connection server framework, requires three protocols, "POP3", "IMAP", "HTTP", you can use these three as product classes, together to implement an interface.
(10) Precautions:
As a way to create a class pattern, you can use the factory method pattern in any place where complex objects need to be generated. One thing to keep in mind is that complex objects are suitable for Factory mode, and simple objects, especially those that can be created only through new, do not need to use Factory mode. If you use Factory mode, you need to introduce a factory class that increases the complexity of the system.
third, the network bottom -level design
(1) Class diagram:
(2) Thinking:
How do I apply the factory pattern in design mode to the creation of a network package?
Four, data storage design
(1) Class diagram:
(The class diagram design for data storage will continue to evolve throughout the next development process.) )
(2) Description:
In this project we will replace the database storage with the configuration file, then I will also record another similar "League of Legends" Moba game development process to share to everyone.
v. Game calculation and processing design
(1) Class diagram:
(The class diagram design of the game computing process will continue to evolve in the subsequent development process.) )
Welcome everyone to learn to communicate, if there is insufficient to criticize correct, reproduced please indicate the source, thank you for your support. If you also like my blog can continue to follow me, let us grow together and progress together.
Life is wonderful. Remove impurities, leaving the search for the poor pole of programming pure pursuit.
3D Battle Network game based on C/S architecture C + + Framework _03 server-side detail design