This year we have had a lot of discussion going on about how we would like to go about building our game engine. With about a week and a month left before its due, most of us have decided to build it using a component based engine architecture.
This post was helpful for a good 5 min intro to the topic. Here is pretty much a summary of it:
The base concept is rather than having a giant monolithic class based game structure (above), we want to inherit from a base class that gives everything full functionality. Imagine the base architecture of Unity. Everything starts of as a GameObject. You can add scripts, models, and other functionality to it by dragging items onto it.
The problem with the monolithic class structure is that classes end up having the same functionality and in return things get really messy. Most games get around this by making a really large base class with lots of functionality while having the subclasses turn functionality on and off. This becomes a problem when adding new features because items have to be able to coexist with one another. Since we pretty much add functionality to our game engine the entire year, adding functionality has to be really simple and we don’t want to waste the precious time we have taking one step forward and two steps back.
Say we have three main game items in a component system: a Player, Enemy and Item.
Spatial Component – Allowing it to exist in the world
Renderer Component – Allow objects to be drawn into the screen
Movement Component – We may want to control the player through a keyboard system, enemy through AI and the Item through world physics
Misc Components – We may want some objects behaving different from one another. Like giving some objects health.
Our component class would look something like
We are currently working on some sort of implementation of this system. We have split up into 2-3 engine programmers and 1 person working on getting animation to work using a skeletal animation system. That latter job will most likely be mine, and it shall be quite the interesting job to take on! I have already done some research with the mesh skinning shader and we have a rigged character to test with. All thats left is to make a demo that will work.