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
Well, let's start today's learning journey, and today we'll introduce you to the project's system development environment, version control tools, and a preliminary understanding of boost's smart pointers and memory pools. At the same time, I decided to start today in the blog to add a "daily charging station" plate, to introduce you to the field of game development related knowledge, every day to give themselves a little more power, I believe the accumulation will be a small fortune.
first, the system development environment
(1) Development environment:
Windows platform
Visual Studio
(2) Development technology:
Implementation based on C + + language
C + + Boost Library implements network bottom
QT for Client interface development
OpenGL for 3D scene rendering
(3) Build the development environment:
Install boost
Installing QT
Configuring the OpenGL development Environment
Configuring Visual Studio-related configurations
(4) Introduction to the Boost Program library:
The Boost library is a powerful, compact, cross-platform, open source, and completely free C + + library.
The Boost program library is the C + + "Quasi" standard library, which represents the newest and most advanced technology of C + + language.
(5) key points of boost technology used in the project:
(6) Introduction of QT:
About QT
Support LGPL Protocol
Open the QT source code base and encourage community involvement
Completely open the code of the Business platform
Increased strength for embedded platforms
(7) key points of QT technology used in the project :
(8) Description:
Specific installation configuration process due to the author of the computer has been configured so today no specific tutorial, follow-up I will write a blog to introduce you.
second, software version control tool SVN
(1) Thinking:
If a team develops a project together, how can the relevant documents and code of the project be managed properly? How can a reasonable and correct conflict be resolved?
(2) Introduction:
Subversion is a centralized system for sharing information, at the core of which is the repository, which stores all the data, and the repository stores data in the form of a file tree, including files and directories, and any number of clients can connect to the repository to read and write these files.
(3) Description: in this project I will give you a brief introduction of the use of SVN, because the author usually in the studio and team work with SVN so it is more skilled operation, of course, Git will also introduce to you, The source code will be put on GitHub for your reference when you start typing.
third, the first boost smart pointer
(1) Definition:
A smart pointer is a C + + object that behaves like a pointer, but it can be deleted automatically when it is not needed. Note that this is not a precise definition of "when it is not needed". This is not necessary when you can refer to a lot of aspects: Local variables Exit Function scope, class object is destroyed .... So boost defines a number of different smart pointers to manage different scenarios.
Shared_ptr<t> |
Internally maintains a reference counter to determine if this pointer needs to be freed. Is the most commonly used smart pointer in boost. |
Scoped_ptr<t> |
Automatically released when the scope of the pointer disappears |
Intrusive_ptr<t> |
Also maintains a reference counter, which has better performance than shared_ptr. But ask T to provide this counter yourself. |
Weak_ptr<t> |
Weak pointers, to be used in conjunction with shared_ptr |
Shared_array<t> |
is similar to shared_ptr, but accesses an array |
Scoped_array<t> |
is similar to Scoped_ptr, but accesses an array
|
(2) Smart_ptr class:
The smart pointers in boost are:
Scoped_ptr, which is used to handle unique ownership of a single object; Unlike Std::auto_ptr, scoped_ptr can be copied.
Scoped_array, similar to scoped_ptr, but used to handle arrays of
shared_ptr, allowing shared object ownership
Shared_array, allowing shared array ownership
iv. initial boost memory pool
(1) Introduction:
The pool in the Boost library provides a memory pool allocator for managing dynamic memory allocations in a separate, large allocation space. It is mainly used to quickly allocate memory blocks of the same size, especially when allocating and releasing memory blocks of the same size over and over again.
The pool library provides four memory pool interfaces, namely, pool, Object_pool, Singleton_pool, and Pool_allocator/fast_pool_allocator
(2) Advantages of use:
There are two main benefits of using pool memory pools:
1. The ability to effectively manage the allocation and release of many small objects avoids the memory fragmentation and inefficiencies that arise from managing memory on their own.
2. Say goodbye to the memory leak of the program, the pool library will automatically manage the internal memory, avoid the programmer accidentally caused by the memory leak problem.
Five, daily charging station-game plug-in introduction
(1) What is a game plug-in:
Some of the performance:
Automated management;
The main functions of the plug:
Decrease (Increase) the interval between the game instruction and the instruction;
Execute some commands that the client cannot execute directly because of the player's personal game information, but this command is allowed on the client side;
Modify the normal command of the client to send to the server to achieve a certain special effect, such directives are generally not compiled by the client to send, but the server can normally receive execution;
(1) Prevention of external plug:
For the standalone plug-in, because of the need to hacking client/server protocol, if the communication protocol is encrypted, then basically can prevent this type of plug-in.
For the non-independent plug-in, hacking is the client program, involving the technology is mainly on the Windows platform crack/anti-cracking technology. The client program can be shelled, combined with an anti-hacking system.
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 _05 Building system development environment and boost smart pointer, memory pool preliminary understanding