当前位置:网站首页>Structure and development layering of games104 b1+b2 engine

Structure and development layering of games104 b1+b2 engine

2022-07-23 05:45:00 Liu jingyiru

Preface :

You can't have fear or illusion about things you don't know , But to keep understanding , Demystify the !

The harvest of this class is still relatively large , Mainly let me from the right “ How to make an engine is unknown ” Deep fear , To do the engine of things have a relatively specific understanding , To think that there is a way to make an engine .


( One ) Introduction to the engine :

1. myth : Once thought that engine development is graphics . However , Complete an engine development , In graphics knowledge only 5% The rest are extensive 95% Good computer knowledge . For learning , When building an engine , Learn to design architecture , Extensive access to knowledge , But graphics knowledge is still the only main line . But for work , There should be a professional ! So we still need to dig a deep field in graphics .

2. Virtual and real-time rendering . The engine constructs a virtual world in limited time and space , It can be big or small , It can have different features and functions . This is what attracts me behind boring knowledge , We will observe more laws of the world .

Real time rendering . This aspect introduces many cutting-edge technologies , Such as multithreading , Real time lighting , Multi person online synchronization ( Synchronous frame technology ) Many involve network knowledge .

3. Engine several major systems :

An engine can start from update Function start . It means in different time periods , The program should run again quickly . First of all, a sigh , Programmers will change the world .

MVVM: This should be well understood .View--->ViewModel<===>Model.. stay MVVM In the frame , Data and views are not allowed to communicate directly , Only through ViewModel To communication , and ViewModel Observed data changes , Update the view content ,ViewModel Monitor view changes , And be able to notify the functional data of changes . So it reflects the encapsulation of the engine .

Render System : How to make the rendering speed of the picture reach the required frame rate .

Animation system : Play with the model , How to do the transition of animation .

Physical systems : Interaction with the world , But we need to describe realistic laws as realistically as possible . Physics this is a huge challenge !

GamePlay System : This part is the core architecture of the whole game . The rules of the world are expressed by the event system and script system , Combine into one tool .

Special effects system , Camera system , Wayfinding system, etc , These are not necessary , But it also reflects the designer , Game developer's for effect “ High customization ”, I'm afraid it's a system designed by techno beauty .

It can be seen that these major systems still have different emphasis on the capabilities required by developers . Rendering system is more suitable for learning status and career choice .


( Two ) Engine layering :

In the project of large-scale system development , We often advocate “ More combinations , Low coupling ”. Therefore, the engine layered development can reduce the development complexity .

The development of engine can be divided into five layers :

1)Tool Layer Tool layer    2)Function Layer: Functional layer    3)Resource Layer:  Resource layer    4)Core Layer: Core layer    5)Platform  Layer: Hardware and software platform layer

Overall, the complexity of developing an engine is very high , For different layers, we should learn relevant knowledge , No less than the development of an operating system , So in terms of learning , We should grasp the main roads , Then how long is one specialty !

First of all ,Resource Layer: Resource layer , Mainly manage the life cycle of assets , To achieve an effect, our demand for resources actually seems to be the most intuitive . A few key points :(1) Efficient format of resources (importing), from resource become Assets; For several MAX,PSD If the file is directly put into the engine , It often brings more burden to the engine , So we should first convert them into an efficient format and then use them for the engine , Each asset has a unique identification number .(2) Real time asset manager . For war games , Because players need to operate in real time , Therefore, resources should also be loaded in real time . So we should set up a better system GC To manage resources .

Solved the problem of resource layer , It's about to be solved Function Layer: Functional layer . On a function is a game effect , It still belongs to engine effect , This aspect is controversial , therefore “ Carding logic ” It is very important to embody in the function layer . For example, in the third person shooting games : The shaking feeling of the camera .

The process of the game can be regarded as the time process of the program (unity Li Cheng update). With a moment (tick) The continuous advance of time , Logic will change , The scene will change .Logic+Render Constitute a game process . Therefore, when writing logic, writing the two separately can better sort out logic . The better way to organize the game process is multithreading , So try to design the underlying code of the engine from the perspective of multithreading , The tricky part is that there may be complex dependencies between threads , You can't simply ignore logic and distribute a threaded task to multiple threads !

Next , say Core Layer: Core layer . The core layer can be regarded as a huge Mathematical Library , It should serve the efficiency of the engine and require high code quality .(1) linear algebra . It generally involves the application of matrices and vectors . Continuous optimization of the engine requires a lot of algorithmic knowledge , such as Carmark Calculation 1/sqrt(x), You need to consider SIMD( Single instruction multiple data instruction )(2) Data structures and containers . Mainly used in memory management .C++17,C++21 Of STL The library expands a more efficient data structure is the implementation . So I'm putting C++98 Of STL After thorough understanding, I think I can experience . In addition, memory management , Hardware is also part of the solution . Be close to CPU The cache of is sometimes the core card . General engine developers mainly face the function layer and tool layer , So this part is also a watershed for engine developers .

Let 's talk about it again Platform  Layer: Hardware and software platform layer , The entry point is to hide the differences of platforms . At present, the platform only knows Windows, But you can also learn in the future linux.

Finally, let's talk about it Tool Layer Tool layer , It is mainly used to improve the generation efficiency , Such as graphic editor ,Ui Editor ,shader Editor . Another function is DDC, Let the assets of other software be imported into the engine without damage , You need to be an exporter of assets , And asset importer .

As the superstructure of engine development , Tool layer and function layer , It is often modified . So be more flexible . But it is relatively stable for the core layer and platform layer , Generally no modification . For example, you can use Qt Development interface ,C# Development controls .


Some newly released software supplements

CMake:

Compile applications for complex projects ---CMake It's a cross platform Makefile Generation tool . Read in all source files (.c;.h;.oc) after , Automatic generation makefile. Different platforms and languages have their own Make, however CMake It's still outstanding .

Git:

Git It's a version control system , Is the main content of any software development project . It is mainly used for code backup and code version control .


Conclusion :

Start from understanding , Go deep , The knowledge to learn is endless .

原网站

版权声明
本文为[Liu jingyiru]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/204/202207221754337934.html