Wondrous Machine
Wondrous Machine is the name of the engine that my group made and worked on throughout the second year at The Game Assembly. It is written in C++ and uses DirectX11 as its graphics API, the interface for all of the tools are made using the Dear ImGui library. For the first project made in it, Spite: Blood Relic, we used Unity as the level editor for the engine. For the second project, Blob Lobber, we switched away from Unity and implemented full level editor functionality into the engine itself. I implemented most of the features for the level editor.
Features as of the first project:​
-
Deferred rendering with full PBR model
-
Skeletal animations with blending
-
Entity Component System using the entt library
-
Exporting of levels created in Unity
-
Construction of navmeshes exported from Unity
-
Pathfinding with smoothing using Simple Stupid Funnel Algorithm
-
Framework for easy ability to create tools for tweaking gameplay elements
Features as of the second project:
-
Baking of navmeshes and pathfinding using the recast & detour library
-
Full level editor functionality
-
Physics handled by PhysX
-
Visual scripting using the imnodes extension of Dear ImGui
Showcase of most basic features of the level editor
Member Registration
One of the big things I needed to implement for the editor was the ability to reflect the members of components to able to edit them in the editor and save them in the scenes in a convenient way. At first I thought about making an inheritance-based system where each component needed to have custom functions defined for serializing and editing. But I decided that it would be more fun to try and utilize templates and other C++ magic to automize the process as much as possible, both as a learning opportunity for me and to minimize the amount of work that would be needed to set up any new component.
To do this I found a small library called MetaStuff. It allows registration of members in a class or struct by creating a specialized template-function for your class, and then provides ways to loop over all members of a specified object while maintaining the type of each member. This allowed me to create generic functions for editing and serializing each type, including basic types, containers such as vectors, as well as custom structs.
​​
Below is an example of the registration for the spotlight component and the result in the editor. Except for a few edge cases, this is all you have to do for a component to work in the inspector and for scene serialization.
Undo/Redo system
I implemented a quite encompassing system for undoing most of the things you can do in a scene using the command design pattern. The system included commands for things like creating/destroying objects, moving them and adding/removing components. But the most complex case was for changing the value of a member in the inspector, which required usage of the previously mentioned member registration system to be able to correctly store what value a member had before and after the command.
Curve Editor
One tool I created specifically for the game we were making was a tool for editing bezier curves. We only ended up using it for one purpose which was to create custom camera movements for introducing new mechanics during some scripted sequences. The system links together multiple cubic bezier curves and presents them to the user in the shape of segments containing a main point that the curve goes through and two control points that are mirrored across the main point.