1 Requirements

  1. Basic knowledge in C++.
  2. i6engine.ini and *.cfg files offered by engine have to be in bin directory of your project
  3. On Windows also all dlls of the dependencies have to be placed in the bin directory

2 Introduction

This tutorial series is intended to help developers to create their own games using the i6engine. The i6engine is an open-source game engine first developed at the chair 6 (data management) at the FAU (Friedrich-Alexander University Erlangen-Nuremberg) and later continued as a hobby project.
Following this tutorials, you will learn the basics to create your own game. We will start with nothing but an empty text file and end up with a programm containing many features you will probably need in your game. The programm will be very minimalistic to make it easy for you to find errors and to increase the tutorial speed. Of course, you are free to implement additional objects etc. during the tutorial.
The tutorials of this basic series cover the following topics:

  1. Tutorial 1 - First Steps Create the main.cpp and get the engine running (but no output)
  2. Tutorial 2 - Adding GameObjects Add a simple GameObject being visible on the screen
  3. Tutorial 3 - Loading Levels Load a level
  4. Tutorial 4 - Physics Adding physical objects and collision detection
  5. Tutorial 5 - Motion Adding Movement

3 Application

3.1 How do I interact with the engine?

 
1#include "i6engine/api/Application.h" 
2 
3#include <iostream> 
4 
5class MyApp : public i6e::api::Application { 
6public: 
7    MyApp() : i6e::api::Application() {} 
8 
9    ~MyApp() {} 
10 
11    void Initialize() { 
12        std::cout << "Initialize() invoked\n" << std::endl; 
13    } 
14 
15    void AfterInitialize() { 
16        std::cout << "AfterInitialize() invoked\n" << std::endl; 
17    } 
18 
19    void Tick() { 
20        std::cout << "Tick() invoked\n" << std::endl; 
21    } 
22 
23    void ShutdownRequest() { 
24        std::cout << "ShutdownRequest() invoked\n" << std::endl; 
25    } 
26 
27    void Finalize() { 
28        std::cout << "Finalize() invoked\n" << std::endl; 
29    } 
30};
Listing 1: MyApp.cpp

Now let’s take a look at the five functions implemented: Initialize(), AfterInitialize(), Tick(), ShutdownRequest() and Finalize(). These are the functions called by the engine on five different times, giving you the chance to execute your own code. Now follows a short description, when the functions are called. If you need detailed descriptions, please consult the API documentation.

  1. Initialize() Called after the very basic initialisations. Nearly nothing is created yet. E.g. You may register for messages here, initialize basic data structures or show a splash screen. Don’t try to interact with other subsystems yet!
  2. AfterInitialize() Now, the engine is completely started. All subsystems have processed OnThreadStart(). This is the perfect place, to create your initial world, e.g. a menu.
  3. Tick() This is the only function that is called more than once. It is called in every frame. Meaning you can do some repeating stuff. Keep in mind, you don’t have infinite time.
  4. ShutdownRequest() This function is called, just before the engine will shut down. This corrensponds to AfterInitialize().
  5. Finalize() This function is the last one being called. It is invoked just after nearly everything is cleaned up and shut down. This corrensponds to Initialize()

These five functions should be enough for nearly every thing, you may want to do, but it is not very easy for some tasks. Therefor we have some more functions that are called on specific events. We’ll discuss them later. Furthermore, you can register for keyboard and mouse events as well as messages. How to do this is discussed later as well. We just want the smallest programm first. And we’re nearly done. What remains is a main function starting the engine. Here is an example for a small one 2.

 
1#include "i6engine/api/EngineController.h" 
2 
3#include "MyApp.cpp" 
4 
5int main() { 
6    // create Application 
7    MyApp myApp; 
8 
9    // register basics 
10    i6e::api::EngineController::GetSingleton().registerDefault(false); 
11    i6e::api::EngineController::GetSingleton().registerApplication(myApp); 
12 
13    // start 
14    i6e::api::EngineController::GetSingleton().start(); 
15}
Listing 2: main.cpp

Code Listing 2: First, we create an object of our application class MyApp. Then we tell the engine which subsystem should be started. You can specify your own subsystems using registerSubsystem(), but this is a really advanced feature. registerDefault() will be enough for most games. You have to pass a parameter indicating, whether you want to create a client or a server. Here we use false because we just want a client. This will register the default systems for Graphics, Object, Physics, Input, GUI, Audio and Scripting. Using true indicating a server, Graphics, GUI and Input wouldn’t be registered as they are normally not needed on servers. registerApplication() now registers our game in the engine. Now we can call start method on EngineController to run the engine and start our game.

4 What’s next?

In the next step we will add a GameObject to the scene so we can see something.