Mirror Engine
How To
Mirror Engine Logo

Entities

What's an entity?

An entity is the base game object. It's lightweight and only has:

  • Name
  • UID (Unique ID)
  • Position
  • Rotation
  • Scale
  • Components
  • Tags
  • Other entities (children)

That's it!

You can think of an entity like a point in 3D space.

How to Create an Entity

Two ways:

  1. Right-click anywhere in-game and click "Create Entity"
  2. Open the entity-hierachy on the bottom and click the top "New Entity" button.

New entities have components added to them for visibility and collision - They'll just appear as a cube. More info to come as we release features.

Hierarchy

Every entity has a parent with one exception: The Scene Entity. The Scene Entity is automatically created for you - you don't need to manage it.

Any entities you add are children of the Scene Entity, unless specified otherwise.

Components

Components add features to an entity, such as rendering a 3D model, playing a sound, running a script, emitting particles, and more.

Alpha V3 note: Components are currently only made via the UI. We'll add much more detail here once we release scripting.

Assets

Assets are used by Components. Head to the Assets page for more info.

Scenes Organize Entities

A scene is a hierarchy of entities. Only 1 scene is active per player at a time.

Head to the Scenes page for more info.

Players Are Entities

This keeps with the principle that everything in-game is an entity.

Entity-Component-System (ECS)

TL;DR: Create entities & add components.

Mirror Engine uses an Entity-Component-System, ECS: a popular way of organizing a game so it’s clean, modular, and easy to scale.

It prioritizes composition over inheritance. Some game engines and languages use a heavy inheritance-based structure. For example:

  • Godot/Redot Engine: To create a directional light, you'll use a DirectionalLight3D node, which descends from VisualInstance3D, Node3D, Node, and Object.
  • Mirror Engine: Create an Entity, add a Light component, and set to Directional.

Instead of focusing on what descends from what, plus what node needs to be a child of another node to work correctly, etc., you can focus on what you want to add - Add away!

To us, this feels more like a "real-world" approach: You start with a blank canvas and simply add paint. You shouldn't have to figure out which paint bottle is a child of another paint bottle. It Just Works™.

All you need to do is create Entities and Components.

To other engines' credits, hot debates are common about the best approach, and that's okay! There's no perfect answer, otherwise everyone would use it. A key trade-off is that some engines aim to be general-purpose, while others are opinionated.

Mirror Engine is optimized for real-time 3D multiplayer and is thus opinionated. Because Mirror Engine handles multiplayer for you, an opinionated approach is needed. We particularly love our ECS framework and think it'll be the smoothest path to building and scaling your game.

What About Systems?

Mirror Engine takes care of this! Systems run the logic that acts on all entities with specific components. For example, a the Light System will update every entity that has a Light component attached to it. You don’t have to wire that up yourself; the engine handles it automatically.

This makes it easy to build complex behavior without deep inheritance trees or fragile code. Just think in terms of data and let the engine do the work.

In other ECS game engines, you may build Systems yourself, which may feel a bit more free-form. Technically, Mirror Engine isn't only an ECS architecture, but an ECS framework. The engine does its thing efficiently and exposes "slots" via Script Components that allow you to define an entity's behavior. This is an aspect of how Mirror Engine is opinionated.

Practically, your day-to-day workflow will only be with entities and components, but it's helpful to understand how an ECS framework operates conceptually.

Mirror Engine Logo