3D Game Engine Design and Implementation (2)
After a few days, I thought I thought it was the architectural details of the 3D game engine. It turned out that it is necessary to use the DLL implementation like the COM component, so how to write the public part of the game, the change is written together, so that the source program is reused, but also maintains work. At the same time, different function modules are separated as possible, and each module becomes a single function, so that the complexity is lowered.
At present, it is generally divided into: loading program, DLL management module, engine management module, UI module, rendering module, file management module, game logic function module, game AI function module. It is also possible to add the modules that you think in the future, because all DLLs have their own interfaces based on the interface.
Here is the role of these modules:
l loading program
This module is mainly relocating the game directory, or some other initialization work.
l DLL management module
This module mainly implements all DLL load, create objects, which is all DLL object plants, which are created all objects and responsible for deleting all objects.
l Engine management module
This module mainly combines other modules and performs game state machine update and maintenance, as well as message processing, window maintenance, input control, and pass the current control message to the game logic module.
l ui module
This module mainly implements the UI configuration of the window, such as creating a new game, parameter configuration, etc.
l Rendering module
This mainly used render functionality on the 3D API, of course, in this module to DLLs in this module, so that the game can be run on a different platform, the platform difference mainly refers to the display card Differences, because different DX display cards use different acceleration functions. There is a user who has money to buy the best DX9 graphics card, there is not much money, maybe the DX8 graphics card. But you can't write the game into a DX8 standard method, because users who buy DX9 graphics cards are certainly thinking: I spent so much money, and playing this.
l File management module
This mainly realizes the loading and management of resources, such as MDL, or DX's X file format. At the same time, the game screenshot is also possible.
l Game logic function module
This is a different game product, certainly different, such as FPS-based games and RPG games, different game logic. So this is mainly implemented in a specific function of game, such as how characters walk in the map.
l Game AI function module
This feature mainly implements a part of the AI, such as the path search algorithm, NPC control.
At present, I think so much, more things have to analyze and design more deeply, more need practice.