Main Object Relational Diagram
3D Engine
The rendering engine will use
Managed DirectX with C#.
A lot of lighting calculations and
special effects will be done in the graphics card using HLSL shaders.
Using these shaders allows us to do complex calculations in
real-time and keep the framerate high.
To provide for future extensibility we want to keep a separation between data (mass object) and algorithms (physics equations).
Renderer
The Renderer also handles
drawing the appropriate viewports for split-screen and single-screen
play.
We also pass it the Object Library (which contains all
players, props, particles and the terrain) for it to render
appropriately.
Renderer takes the entire
ObjectLibrary as a parameter.
It cycles through all Game Objects
calling their draw methods.
Then it renderes the HUD .
All of this is collected into
a Frame Buffer Object which contains a texture.
The texture is
supersampled and anti-aliased before being displayed to the screen on
a SpriteBatch quad in orthographic mode.
Each Game Object in the Game world uses two coordinate systems:
We are using a quaternion
rotation system and Carteasion coordinate system.
Positive Y-axis
is up. Negative Y-axis is down
Lighting model
The lighting model will be
defined and implemented using a per pixel approach implemented in
HLSL shader language.
The lighting will be defined according to
the standard Phong model which is a component based approximation of
lighting.
Phong uses the specular,
ambient, diffuse qualities of each light.
These component are
combined with the objects colors to produce the final lighting
equation.
total illumination = ambient + diffuse + specular
Shader engine
Each shader will implement
certain minimal common techniques.
-Pixel Based Lighting
-Vertex
transforms based on world space transforms
-Normal and Bump
Mapping
-Single and Multiple Texture mapping
Specialized shader will to
accomplish additional effect including:
-Vertex modification to
simulate natural fire and clothing movement.
-Transparency
Incremental Loading Sequence
Load
Sequence is tied to the MenuSystem class.
It contains two
demo loading sequences:
LoadLevel – Loads the user selected terrain in the preview menu.
LoadPlayer – Loads the user selected character model in the preview menu.
It contains four sequenced loading stages:
LoadDarkMatter – Creates all the mass objects, or clears them to default values if already loaded. Method sequence is called when user presses start from TitleScreen. DarkMatter is a list of pointers that are passed into the game objects. Calling LoadDarkMatter will create the masses if null, or Clear the masses to default values if already initialized.
LoadMatter – Initializes all new GameObjects. Since the DarkMatter List is a list of pointers, this method call is only necessary after the first call to LoadDarkMatter. A call to DarkMatter can be used to reset all values in the masses without destroying the GameObjects.
LoadGame – Called to set or reset non-content related variables in the GameObjects to their starting values.
LoadLevel – Called to set or reset content related variables in the GameObjects.
ElementalGame calls MenuSystem to handle all pre-game loading and game screens.
Once the game has started, the engine loops through the GameFlow Update and Methods as follows:
Update
Calls Collision, passing in the ObjectLibrary and dt. Collision processes all dynamic objeccts.
Calls the ObjectLibrary UpdatePosition function, which applies movement to the GameObjects.
Calls CheckForGameOver, which applies the scoring system logic.
Draw
Calls
Renderer, passing in the ObjectLibrary. Renderer calls any shadow
passes that are enabled, then processes each viewport, calling the
draw call for all GameObjects that fall within the LookupMap's LOD
boundaries.