Details
Description
Primrose is a work in progress game engine that contains many standard features that are common in game engines and some profiling tools. The editor is created using Dear ImGui, and the engine uses OpenGL for rendering. Primrose's cornerstones include Asset Management, Entity Component System and a Logger for debugging.
The Editor of Primrose is built using Dear ImGui. The default layout consists of Hierarchy Window, Details Window, Content Browser, Directory Explorer and the Title Bar on top. Other editors and windows exist within the engine and can be opened through many different means.
The Title Bar includes different tabs that contain different options. The Window tab contains options for opening and closing all parts of the default layout including the log windows as well. The About tab opens a small window that contains info on the game engine while the File tab is currently empty and contains placeholder options for testing purposes.
The Editor contains many editors and windows that serve different purposes. The Material Editor for an example presents the data contains within a material asset and allows the user to easily modify it. Attempting to modify which textures a material uses opens the Sprite Selector. This window is scalable and it's content is presented in consideration to it's current scale.
Windows in the editor can also be stacked on top of other windows including the main parts of the default layout. This allows the windows to turn into tabs instead and provides the user with the means to tidy their workspace further.
All found assets of type ".rose" are serialized into engine content. In the material asset as an example, simple data is serialized as is byte by byte while references to other assets and other more complicated data is serialized through unique ids and other light-weight and easy to look-up solutions.
The structure of a ".rose" file is simple and consists of a header that contains asset type and asset file version, followed by primitive data and instructions for the Asset Manager to create the asset in the engine.
The Asset Manager performs a scan at the start of the engine in search of 2 folders named "Editor" and "Content".
The Editor folder contains assets that are used by the engine for many purposes such as editor icons and such. The content folder contains the assets of the project which can be files of different supported formats.
Primrose uses a custom file type with the extension ".rose" for unique engine only assets such as materials. All found supported files are stored in a different data format in the engine and presented to the user using GUI.
All these systems work together to present the user with the project content through the Content Browser. Assets can be selected in the Content Browser and modified through a context menu that includes options such as Rename, Delete and Save. Any modified assets with unsaved changes get a small icon on the top left as indication. The user can also create new folders and material assets through a context menu that can be opened by right clicking in the Content Browser without selecting an asset.
Marigold is an allocator-aware contiguous container that is equivalent to the Standard Vector but performs better when it comes to storing large amounts of objects. It is fully compatible with the STL and is used all over the different systems of Primrose. It brings many performance benefits to the ECS. Marigold's custom memory allocator keeps track of all allocations and deallocations which helps monitor memory usage in Primrose.
Architecture
Primrose uses an entity component system for managing entities and components while also providing an easy to use API inspired by Unity's. For the sake of achieving this goal, the ECS takes advantage of 2 custom data structures, MemoryBlockBucket and Marigold. The custom data structures provide many performance benefits for the ECS while facilitating affordance for future extensions of the system.
MemoryBlockBucket is essentially a linked list of memory blocks. Its purpose is to allocate fixed sized blocks of contiguous memory for the ECS to use for creating components and GameObjects. The contiguous memory reduces CPU cache misses and look up clock-cycles considerably while also minimizing memory fragmentation. The linked list aspects allows for no reallocation cost and also guarantees iterator validation after allocating new objects and memory blocks.
Marigold (Generic Container)
Container that is equivalent to the standard vector and uses a custom memory allocator and is fully compatible with the STL.
Marigold (Generic Container)
Container that is equivalent to the standard vector and uses a custom memory allocator and is fully compatible with the STL.
Personal
2 Weeks
None
C++
All GameObjects created by the ECS are presented to the user through the Hierarchy window. The user is able to create, rename and remove GameObjects through a context menu that can be opened by right clicking on an element in the Hierarchy. Most importantly, the Hierarchy allows the user to manipulate the child-parent system in Primrose. The user is able to parent GameObjects to one another and create hierarchies of relativeness. A child GameObject's transform would be relative to the transform of it's parent. By dragging and dropping, the user is able to easily reorder GameObjects in the Hierarchy.
An essential debugging tool of Primrose is the debug log which provides an API that allows the user to print out messages of 3 different verbosity levels directly into a Unity style message log. Messages can be filtered by verbosity level and the log can be cleared on command.
The system log of Primrose details all major operations performed by the different systems of the engine. User action such as creating and deleting assets is also logged in here.