Basic idea:
The engine should only provide an enviroment to code certain aspects of the game. There should be standard measures of getting meshes, textures, functions and alike to work. Engine should encapsulate APIs used.
For example none of the actual game logic should call
Code: Select all
glTriangle3f(float, float, float)
Code: Select all
::Renderer::draw(&meshObject)
This is the rough sketch of the engine architecture written as an UML class diagram.
The idea is as such:
core - the basic part of the game, responsible for dispatching 'functionality' threads. Also passes all messages between various objects.
core works with several players by sending them all the info they need. Core runs the game's logic.
network - uplink between player and core objects. Usually with use of TCP/IP, but other protocols are also possible.
player - this class is responsible for dispatch of "game content" classes and manages gui and other client side multimedia trivia
gui - for displaying windows, widgets and such
viewport - this class is the 'camera' - eg whatever it sees, modifies it etc. A player can have several cameras looking at several places.
renderer - this class is used for display of game graphical content. Either using openGL, d3d, software or some other rendering pipe.
now two most important classes.
functionality - this class is a prototype of the classes that implement certain game aspects. each of these objects is a _thread_ of execution. functionality classes can talk to each other via "message" interface, but cannot read/write to each other. This is to assure thread safety.
gameContent - this class is a prototype of the classes that implement _collections of game content_ that being models, textures etc. Each of these is a _thread_ of execution.
functionality and gameContent classes work with each other. eg - each functionality class should have an accompying gameContent class.
The second diagram is more complicated - so if you have questions - go for it.