Tristeon

A 3D game engine written from scratch in C++ by two students in five months, with a Vulkan renderer and a Unity-style editor. I was the engine tools programmer: the editor, reflection and serialization.

C++ · Vulkan · ImGui · 2017 · 70+ stars on GitHub

GitHub Showcase video
The Tristeon 3D editor with scene view, hierarchy, inspector and asset browser

An editor like the ones we used

Tristeon 3D was built in five months by two students. I wrote its complete editor in ImGui: a scene view with transform gizmos, a hierarchy, an inspector that edits any component, and an asset browser.

The asset browser scans the project folder and generates a metadata file for every asset, holding its import settings, so assets can be renamed and moved without breaking references. The editor lives in its own layer, separate from the engine and game code, so a game ships without it.


Reflection and serialization

C++ has no reflection, so we built our own. Every serializable type registers a factory in a static map before main runs. Scenes and prefabs are stored as JSON with the type name of each object, and the deserializer rebuilds any component from that name, including types the engine has never heard of, written by the game.

The same introspection drives the inspector: it can show and edit any component without hand-written UI.

template <typename T>
struct DerivedRegister : TypeRegister
{
    DerivedRegister()
    {
        getMap()->emplace(TRISTEON_TYPENAME(T),
                          &CreateInstance<T>);
    }
};

static std::unique_ptr<IntrospectionInterface>
createInstance(const std::string& s)
{
    const auto it = getMap()->find(s);
    if (it == getMap()->end()) return nullptr;
    return it->second();
}

// In a component's header:
REGISTER_TYPE_H(MeshRenderer)

Where it came from

Tristeon grew out of our first engine, built earlier that year for the puzzle game Orb. There I wrote the physics and made Unity the level editor; Tristeon was the step to a real editor of our own.

Choosing a scripting language for the engine led to a separate study: C# vs. Wren.

A level built in Unity on the left, running live in our first engine on the right
Our first engine, running a level built in Unity

Built with Leon Brands, who focused on rendering.

← Back to the portfolio