User Tools

There were many changes to the engine and I'm only starting to rewrite this documentation

Quickstart Tutorial

This tutorial assume you have installed Annwvyn on your computer. The simplest way to do this it to

  1. Install Visual Studio 2017 from Microsoft (Free community edition)
  2. Install latest version of CMake (Windows win64-x64 Installer) from here
  3. Install the Annwvyn SDK from here

Project creation

To create a new Annwvyn project, simply locate your Annwvyn installation and open the “Annwvyn” folder.

  1. Copy the “template” folder and paste it somewhere convenient,
  2. open the CMakeList file, change the “project name” on top of the file.
  3. Use CMake(-gui) to generate a Visual Studio solution (or a Makefile on Linux) and open/build it.

Engine presentation

The strictly minimal code for your Annwvyn application is :

#include <Annwvyn.h>
using namespace Annwvyn; 
	//Initialize the engine and give the name of the application
	//Start the main program loop. Loop will break if engine get signal to quit
	//Quit the engine

The code that you'll get with the template contains a little bit more details, and explication in comments.

Beside loading the engine and starting the render loop, this code does nothing really special. You absolutely have to specify a name for your application. This string of text is used to create the window of the application, and by other components, like the AnnFileSystemManager

Including libs

The only header you are required to include is Annwvyn.h.

#include <Annwvyn.h>

But, to speed up build times, the template uses a feature called pre-compiled headers. Visual Studio's compiler is pretty slow at pre-processing header files. If they doesn't change, we don't need to do this every single time we build the game.

This feature require every single .cpp file in the project to include a file called “stdafx.h” on top of it, and it must be the first one.

#include "stdafx.h"

The first time you hit compile, it will pre-built the headers via the stdafx.cpp file. This can take some time, but it should do it only once.

Initialize the engine

main function declaration

For diverse reasons (command line argument parsing. Selection of the entry point between multiple OSes, hook for per-initialization of development facilities…), the main function declaration is overridden by a macro when using Annwvyn. You application entry point should be defined as this:


Using this construct permit you to start and stop the engine with the AnnInit() and AnnQuit() macros. This is not mandadory but permit to hide some rough edges of the initialization process.


All Annwvyn classes, functions, types and other things are in the Annwvyn namespace. If you want you can declaring you use this namespace

using namespace Annwvyn;

Load the engine

AnnEngine object

The main class of Annwvyn is AnnEngine. AnnEngine initialize all Annwyvn's internal components.

AnnEngine is also the central access point for talking to other Annwvyn components. It's like the conductor of the Annwvyn orchestra ;-)

First thing you should do is to create an AnnEngine object. This can be done with the macro AnnInit().

You absolutely need to give your application a name, as a string, passed to AnnInit


The AnnEngine class is following the “Singleton” design pattern. You're program will crash if you dare to declare two different AnnEngine instance.

You can access the unique instance of AnnEngine via AnnEngine::Instance(), or (preferably since it's shorter) the getter function AnnGetEngine(). This call will return nullptr if the engine is not running

You can acces pointers to the important parts of Annwvyn via AnnEngine's getters. Notable mentions are the AnnPlayer, AnnPhysicsEngine, AnnAudioEngine, AnnLevelManager, AnnEventManager (more information on the API documentation). They are all avalable as AnnGetSomething

Loading Resources

Before anything else, you should load the resources you will use into the engine.

Resources are all the assets your game will use. 3D objects, textures, sound effects, script files, etc…

Currently, you have 2 choices :

  • Put your resources on directories and load them with AnnGetResourceManager()→addFileLocation(const char path[])
  • put them on a zip files and load them with AnnGetResourceManager()→addZipLocation(const char path[]). Note that you don't need that file to terminate with the .zip extension

Example :


The “media” sub directory is loaded by default by the engine, as the file in it.

This file contains vital data that Annwvyn itself need to initialize, and the data for the sample program.

When you are done adding the resource locations, don't forget to call;


Resources will not be available before this.

Annwvyn will load the resources in memory as the are used. There's a way for you to put them in “named groups”, and to pre-load them at will.

Annwvyn uses Ogre's own “resource group manager” internally. You still have access to it. Annwvyn also employ simple custom “Resource Manager” for Ogre internally to load audio file and gameplay scripts written in ChaiScript. All of your game resources are pulled from Ogre's system.

Annwvyn will always add ./media and ./media/ as resource locations. contains various elements that are expected to always be available for the game engine. Theses places are called Annwvyn Core resources

Resource format

Annwvyn uses Ogre for rendering graphics and handling most of the 3D geometry it needs to process, compiled with freeimage. Ogre is compatible with almost any image file format but 3D object needs to uses Ogre's own filetype.

Putted simply:

  • 3D Object: Ogre .mesh binary format, in version 1.x, with their accompanying skeleton format.
  • Material description: Ogre .material script, containing HLMS PBS or HLMS UNLIT materials. They can also be JSON scripts.
  • Textures: 2D image
  • Audio: Any file format readable by libsndfile. Basically everything relevant, except MP3, because patent laws.
  • Scripts: File written in ChaiScript. Notably Object “Behavior Scripts” that can be attached to them.

The Game loop

Annwvyn has an internal loop that will, by default, run infinitely until the user press ESC

You can start this loop by calling


If you haven't created and jumped to a level, or manually created GameObjects before, you'll be on an empty scene with a blue-sky background. This is normal and indicate that everything is working properly. And we will change that soon. but before that, you may want to control the gameplay loop yourself to add you own stuff (like if you need to put integration code for some weird peripheral like a LEAP motion or something). Although, Annwvyn is a framework that support being you to register “subsystems” that will be updated by the engine. So you can insert arbitrary code inside the default gameplay loop. The mindset to have is “I give code to be called by Annwvyn” once the loop started, not the other way around.

But, you are free to do what you want. And you can set-up that loop manually by doing :

//--Use the built-in termination check (has ESC been pressed)
//Custom stuff
//--Use you own termination
//Custom stuff
//Last thing to do: call engine refresh

Note: Annwvyn's level manager may take up to two frames to engage the level loading. This is due to the fact that level loading is a slow operation, and priority was given to the event processing. The LevelManager deffer the level loading to let all event-related call terminate. Thus, you may see that your selected first level isn't running for one or two loop iteration.