Study notes (11): Game engine architecture

Through the course of the original blogger, this series is a general summary of the content of the game engine, but also a fairly comprehensive summary of the game development technology.
As mentioned at the beginning of the study notes, the study of the game engine architecture helps us build a global understanding of the game.

The following is a simple explanation of each concept from the bottom up in the order of the video, refer to the last architecture diagram in the text (the English version and the Chinese version can be compared).
1. Game engine
Just like Chinese characters were originally composed of patterns, the game engine was just a separate game from the beginning. When people continue to make new games, they find that many functions are universal, and there is no need to repeat content. Therefore, people began to abstract and summarize the functions in the game, so that the previous results can be used directly when developing new games, which saves time and avoids many pitfalls encountered by previous people.
A system abstracted from the experience and achievements of previous game development is the game engine. A mature game engine should be used as universally as possible for all kinds of game production and provide a complete production process. Each major game company generally has its own game engine, and other small companies generally use commercial game engines, such as Unity and UE4.

2. Architecture
Architecture is a sketch of a system, describing the abstract components that make up the system and the relationships between them. Any slightly more complex software system requires a suitable architecture, and of course it is even more necessary for such a complex game engine.

3. Third-party software development kits,
which are often referred to as third-party libraries, including static libraries and dynamic libraries. The packaged code library written by others can be called directly after introduction.

4. Platform-independent layer
The content here is not to say that it has nothing to do with the platform, but that its basic logic is roughly the same on each platform, and almost all must be used. The difference is adapted to various platforms through adapters.

5. Atomic types and atomic operations
This is biased towards the operating system level, so-called atoms are inseparable. At the bottom of the operating system, generally only bool, int and other types can be recognized by each system. The classes we write in high-level languages ​​will be converted to atomic data for operation at the bottom of the system.

6. Timer The timer in the
game is a very important content, and a lot of game logic is required, such as restoring 10 points of life every 2 seconds. In order to improve the accuracy of the game, it is necessary to provide a high-precision timer.

7.Graphics Wrappers graphics wrappers
graphics abstraction layer, dynamic switching DX/OpenGL

8. Moudule module The
game engine is quite complex, we need to split it into modules to facilitate our understanding and use. Such as rendering module, physical module, sound effect module, animation module, etc. Different engines have different module designs.

9. Strings
We see that within the core system architecture, strings are taken out separately to prove their uniqueness. The complexity of strings lies mainly in the encoding. Different encodings of the same content have different binary data. We have to face this problem when we localize (internationalize). In addition, hash string means converting a string into a numeric value, which is often used in server authentication.
Related explanations about encoding:
What is the difference between Unicode and UTF-8? https://www.zhihu.com/question/23374078
Character set detailed explanation (you can understand the series at a glance) http://blog.csdn.net/u012999985/article/details/77619368

10. Debugging is
generally divided into breakpoint debugging and log output debugging. Good debugging methods can quickly locate problems. It will be described in more detail in the next section.

11. Syntax analyzer
can actually be understood as a file parser such as XML, which is convenient for us to use XML to describe game objects and make related configurations

12. Performance analysis The
general engine will provide related performance analysis tools, such as the built-in Profiler of unreal. Of course, we can also choose some other tools, such as Intel's vtune.

13. Engine configuration
There are too many parameters in the game engine that we need to configure. How to modify the configuration and apply it conveniently? The common method is the ini file. By simply modifying the content in the configuration file, you can adjust certain built-in options when the engine starts, such as lighting accuracy, game control, and so on. Configuration files are often used in many game projects.

14. Curves
Friends who have studied graphics should be familiar with them. Common curves include B-spline and Bezier curve. When the camera moves in our game, curves are used in various rendering interpolations.

15.RTTI, reflection, serialization

  • RTTI is runtime type recognition, the basic concept of C++. Simply put, it is possible to determine the type of an object at runtime.
  • Reflection is to provide more detailed information about the class on the basis of RTTI.
  • Serialization is to save the class object to disk and load and restore it correctly afterwards.

16. Unique identifier
This is often used in the network, such as adding a unique identifier to a network player, and adding a unique identifier to a synchronization object, generally called GUID.

17. Game assets A
simple understanding is all kinds of files, animation resource files, picture files, font files, map files and so on. Of course, so many types of files need a unified management and analysis, resource management is also a very complex module, a bit like a small operating system.

18. Material and texture
Direct reference link: What is the difference between texture, texture and material?

19. Camera
The position of the camera determines what is rendered

20. Physics
Core content: dynamics and collisions
Other content: ray detection, generally in engines with physics, all ray detection is based on physics. Radiographic detection is very easy to use. Generally, our non-live ammunition gun hits and obstacle detection require radiographic detection.

21.
BSP tree What are the advantages and disadvantages of BSP tree and octree, and what are the applications? https://www.zhihu.com/question/29739023

22. About culling:
We only render the parts visible to the player, and other culling. For some large objects, we only load the ones near the player, and remove others.

23. Lightmap
Dynamic lighting consumes a lot of cpu and gpu, in order to reduce the cost. We can attach static lightmaps to objects instead of dynamic care.

24. Dynamic shadow
http://www.cppblog.com/shadow/archive/2005/12/23/1991.aspx

25. Decal
is to stick a patch on a designated model to show new pattern effects, such as bullet holes hit by bullets on the ground. The decal is a patterned model created temporarily when triggered, not directly drawn on the original model.

26.HDR and post-processing The
previous rendering part is explained http://blog.csdn.net/u012999985/article/details/79090657

27. Environment mapping EnvironmentMapping
is better translated into environment mapping here. Environment mapping is a technology used to simulate the reflection of a smooth surface to the surrounding environment. The environment map generally refers to CUBEMAP, which belongs to the basic implementation of environment mapping.

28.
PRT PRT refers to Precomputed Radiance Transfer, optical radiation transmission pre-calculation. Store the coefficients of the pre-generated spherical harmonics (SH) of the emissivity transmission (including the relationship between shadow and mutual reflection) in several textures (SH lightmap). Then, store the SH of the static light probe, or dynamically Generate SH from the light source, and after dot product, you can get the global illumination effect with ambient light, shadow and mutual reflection. [Quoted from knowing [Milo Yip answer]

](https://www.zhihu.com/question/264405382) Simply put, it is to realize global illumination.

29. Hierarchical object attachment
This translation to Chinese is a bit confusing. In fact, the original intention is bone association, we can attach any object to any bone. The bones are hierarchical, and the attached object will follow this bone and will not be affected by the bones of this bone.

30. MatchMaking is
related to the game mode of online games, and it involves direct play in the game lobby, or separate rooms, and how to match. Generally, the engine will provide related interfaces for docking, but many details need to be written by the game project.

31. Audio is
generally divided into sound effects and music. Sound effects are brief sounds of a few seconds, and music is generally background music played for a long time. The engine should provide gradation, mixing and other effects, and the 3D game engine also needs to provide a three-dimensional audio model.

32. FrontEnd FrontEnd
This piece mainly refers to UI, including HUD and built-in GUI.
IGC said that it uses game content to record animations in real time. Many cutscenes do this, which saves too much cost than CG.

33. Static and dynamic elements
Generally in the game world, those elements that will not move during the entire game are static elements, such as buildings, terrain, and vegetation. Dynamic elements, such as NPCs, animals, etc., can interact with the player. Of course, this is not absolute. You can make anything dynamic in theory, but it is obvious that there is a big difference in the realization of the two.

34. World loading
All objects in the game scene need to be loaded from the hard disk to the memory to run. This process is World Loading. There are many technologies involved in scene loading, such as streaming loading, which can be used for dynamic loading of scenes in the big world.

35. Script
Script is convenient for program modification and can be hot updated into the program like a resource.

36. Game dedicated subsystems
This refers to our common game logic modules, such as prop modules, weapon systems, achievement systems, etc. Of course, the game engine does not need to implement these contents, because they belong to the game project logic. However, since most engines are based on game projects, different engines will build different game GamPlay frameworks. For example, the game framework of Unreal 4 is based on FPS, which is very suitable for the development of FPS game projects.

37. Player mechanism
This blogger thinks that it can also be called the player character control module, which refers to how you control your character movement, action performance, camera position, collision and so on.

38. Game camera The camera
mentioned above is viewed from the bottom of the rendering, and it determines the content of the rendering. But in the game logic, we mainly care about his position. Whether to follow the player all the time, or to check from the perspective of God, this is all controlled by the game logic.

39. Artificial Intelligence In
theory, like the current popular AI technology, you can use deep learning and machine learning to manipulate the performance of AI characters. But in fact, most of the AI ​​characters in the game are relatively "low energy", as long as they can find simple paths and simple perception. The reason is simple. I can make players experience realistic AI with the simplest logic, so why bother to make it so complicated.
Of course, this is not a need to explore game AI in depth, there are still many people in the game field exploring this aspect.

40. Common development tools
Engine development IDE: Visual Studio
version management: SVN, Git

41. The
main differences between Debug and Release are as follows:

  1. The program is not optimized in Debug mode and can be broken
  2. Many codes in Debug mode will do more detection, such as array out of bounds. As a result, sometimes in the position where Debug has an assertion interruption, there is no problem when changing to Release.
  3. The program compiled in Debug mode is much larger than Release, and it may run much slower.

42. The main composition of the software The
lecturer's understanding in the video is: algorithm + data structure + design pattern

43. Mathematical knowledge commonly used in game development
vector operations, trigonometric functions, matrix operations, quaternion, random numbers, coordinate system operations (Cartesian coordinate system, polar coordinate system, spherical coordinate system), space transformation, and other geometry (The distance from the point to the surface, whether the point is in the geometric body, etc.), calculus

44. Memory management
involves memory fragmentation, memory allocation, memory leaks, virtual content, etc. You can find an operating system book to learn this part of the content.

45. Containers
are the data structures we often say, including heaps, stacks, arrays, linked lists, trees, graphs, queues, etc. Pay attention to their characteristics and usage scenarios, such as whether it is continuous memory, whether it changes size dynamically, etc.

46.
I /O I/O means Input/Output, generally refers to disk IO and cache IO. When we read and write, we may need to write the contents of the disk to the memory, write the memory to the cache, and write the cache to the register. Generally, these operations are time-consuming. So the CPU can't wait while IO, it will hand over the task to DMA for processing, so that the consumption of the entire IO on the CPU is greatly reduced. But even so, it consumes CPU time when switching up and down, so it is necessary to reduce the number of IOs.

47. Game loop and rendering loop
In fact, the entire game is essentially an infinite loop program, and all logic is processed in the loop.
In the same way, the rendering module itself is also a loop, which will update the camera, update scene elements, start rendering, and output to the screen.

48. Object component model
Many game engines use this mode to build game objects. The component model can be assembled or disassembled freely by packaging multiple functions into separate components. A good decoupling effect is achieved, and the versatility and flexibility of the components are increased.

Write picture description here
Write picture description here
Reposted from the link (please indicate if reprinted): http://blog.csdn.net/u012999985/article/details/79090524

Guess you like

Origin blog.csdn.net/qq_43801020/article/details/109016188