Provence ECS is a C# entity component system framework. Provence was created in, and initially designed for, the Unity game engine. Many steps have been taken to decouple Provence from Unity in-order to create a simple base ECS architecture for all needs.
The following will be a technical write up of the project. Starting with how to interact with the interface and different situations involved in it's creation.
In an Entity Component System architecture, we break apart the traditional OOP structure into pieces to allow for incredibly varied behaviour. Instead of creating an class for each type of object you want to make, like a car or a bike, we start with an entity. An entity is solely a unique identifier.
We use components in place of an objects fields. Components are only data, they don't contain any methods. We assign components to entities and through the combination of different components we can create unique objects.
Systems perform operations on collections of components. Taking our functionality away from objects. For example, we can abstract AI behaviours to their own systems. Instead of writing the logic in the object or inherited classes, it exists unattached allowing us to build complex muteable actors.
>
The following explains Provence ECS's implementation in Unity'. The manager is the central point for all our design tools. It was designed to display a world's entities in a customizable graph. Allowing the user to arrange their entities however they wish separate from their position in the game world.
Right clicking and dragging allows the user to reposition the whole graph. The coordinates are displayed in the top right. Next to them is a button to reset the graph to postion 0,0.
Left clicking and dragging an entity node allows the user to reposition all seleceted nodes in graph space.
Left clicking on an entity node selects the corresponding object in unity's world. The same is true in reverse. Selecting the gameobject updates the manager's selection. The "Select Only Entites" option bubbles up the selection from any subobject of an entity.
clicking on an entity node or box selecting will create a new selection. Holding shift lets the user add to their selection or remove a node from the whole selection
The user can create a new entity by right clicking in the open space of graph and clicking on the Add Entity option. When right clicking on an entity node options to open, duplicate and remove the selected entities are made available. Each of these options have customizable shortcuts.
The systems added to the current world are accesible by clicking the System List icon. Systems can be bundled into a packages. Packages are added when a world is loaded and do not exist while editing. Systems can also be added indivdually and do exist in the world during editing.
Originally this interface listed all entities in a list and was harder to navigate. The node approach has always been the intended design and is a great improvement. Future additions will include ways to label and group entites, and tools to show and edit parent/child relationships of entities.
When we open an entity we can edit the currently attached components. In the same fashion, similar to prefabs in unity, we can create preset actors in the Actor Manual. This section explores the functionality of the Actor Manual.
Adding a component to an entry is simple. The easist way is to click the "+ Component" button. From there the user can select the type of component from a searchable list. Controls for editing a component are automatically generated by Provence. Programmers can create hooks for any class or field they desire to make as complex controls as they wish.
Searching for a component or set of components is incredibly easy. The search bar at the top allows the user to search for any component by name or by any tag it belongs to. Search parameters are separated by a /. Clicking on an icon for a tag adds it to search parameters.
Tags allow users to easily query their actors. They can also have a set of required components. They're very easy to work with and help ensure your entities have the components they need.
If a model component is attached to your entity or actor entry then a preview window will be drawn allowing you to have an interactive turntable of the currently selected model.
The Model Bank is used to prep models for use in the Provence environment. The first column is a list of all the entries. We can edit, add, remove and search entries. When an entry is selected the second column appears. Here there is an input for the actual model file. If one is selected, an interactive preview will be displayed on the right.
Anchors
Often we'll need the location of something on the model. Which can vary between models. The location an attack is launched from, for example. We have a collection of these keys, and a bone/sub-object of the model can be chosen as these anchors. This way when we need to reference this location, we can simple look it up by the key.
Animation Keys
The animation system works very similarly to the anchors. We often need a model to animate based on an event. We can take that unified event key and connect it to the animation controller of the particular model.
Provence ECS started as a project on July 10, 2019. I had been doing a ton of reading on data oriented programming and had fallen in love with the idea. This was before Unity DOTS and I really wanted to build the architecture for an ECS enviroment. I've loved the entire project. My favourite part about it is how I've been able to define patterns for my game development that have grown over the entire project. In a following write-up I will cover Provence from a programmer's perspective, highlighting these patterns which have allowed me to create some amazing systems for Ransacked. There's a lot I want to add and refine about Provence but even as it is it's great. It may not be the most complex or powerful but I did complete what I set out to do. I've learn some much just by having it as a goal and I'm incredibly proud of it.
Michael Yull | 2023