1 Requirements

  1. Tutorial 1 - First Steps

2 Introduction

This tutorial will show you how to register subsystems manually. Sometimes you don’t need all the subsystem being registered in the default implementation or you might have added an own subsystem, which is obviously not registered by default.

3 Registering a subsystem

The EngineController offers two overloads of the registerSubsystem method for the different subsystem types. Let’s take a look on both of them.

3.1 registerSubsystem with frameTime

Using a frameTime when registering the subsystem implies a constant ticking independent of other subsystems. The frameTime is the time until the next frame of this subsystem is scheduled. So a frameTime of 30ms implies about 33 frames per second. If a single tick of the subsystem exceeds the frameTime, one frame is skipped. Listing 1 shows an example adding the default object subsystem using a frame time of 30ms.

1i6e::api::EngineController::GetSingleton().registerSubSystem("Object", new i6e::modules::ObjectController(), 30000);
Listing 1: registering object subsystem

3.2 registerSubsystem with subsystem dependencies

If you want the new subsystem to wait for another subsystem, the second method is your choice. Here you just have to add a list of all the subsystem your subsystem has to wait for. In listing 2 we have an example.

1i6e::api::EngineController::GetSingleton().registerSubSystem("Graphic", new i6e::modules::GraphicsController(), { i6e::core::Subsystem::Object });
Listing 2: registering graphics subsystem waiting for object subsystem

Now, what happen’s here? We register the default Ogre3D graphics subsystem and make its ticking dependent of the object subsystem. That means that a graphics tick starts as soon as it gets informed of the finishing of the objects tick. So if the object subsystem ticks with 30fps the graphics subsystem will also tick with 30fps and always have the complete state of the object subsystem. So this approach is used to get a consistent state across more than one subsystem, but adds dependencies. So if the object subsystem exceeds its frame time, every following subsystem in the chain (here only the graphics subsystem) is triggered less often.