Gameplay programming
How gameplay code is organized in Mowo, from actors and components down to the ECS, and a map of every gameplay system and plugin.
Gameplay in Mowo is C++ written against an Unreal-style object layer: you subclass AActor, compose it from components, mark fields with reflection macros, and let a world tick it. Under that layer sits a flat entity-component system (ECS) that the renderer, physics and animation iterate for speed. Visual Scripting builds its node catalog from the same reflection data, so every system on these pages is usable from graphs too. Wolang scripting gives an actor its behaviour in a script, through bindings generated from the same reflection.
This section explains how the two layers fit together, then covers each gameplay system: physics, animation, audio, effects, AI, cameras, narrative, save games and the first-party gameplay plugins. The object model, reflection macros and modules are covered in depth in Programming.
Two layers, one scene
Every actor has a backing ECS entity. Gameplay code talks to the actor. Performance-critical systems read the entity. AActor
- Your AActor subclass
- Actor components (MActorComponent)
- Mirrored ECS components
- ECS systems (render, physics, animation)
The layers split the work like this:
| Layer | What it is | You use it for |
|---|---|---|
MObject | The garbage-collected base class with a reflected MClass | Anything with identity and lifetime |
AActor / MWorld | Placeable objects and the world that ticks them | Gameplay objects, lifecycle, spawning |
MActorComponent / MSceneComponent | Object-oriented behaviors attached to an actor | Meshes, lights, cameras, your own logic |
ECS World, components, System | Plain-data components in archetype storage, processed by systems | High-volume data, engine subsystems |
An actor component such as MStaticMeshComponent also writes a plain MeshRenderer component onto the actor's entity, so the renderer's flat iteration sees it while your code keeps using the object interface. MActorComponent
AActor, MWorld and the scene live in the Game module. Below it sit SceneTypes (render components), AssetSystem, the ECS module and Components (the base TransformComponent and RelationshipComponent). Larger systems such as AI, narrative, sequencer and PCG are feature modules the engine loads by name. See Programming for the module layout.
Naming conventions
Mowo keeps Unreal's prefixes with one change: managed objects use M where Unreal uses U.
| Prefix | Meaning | Examples |
|---|---|---|
M | Garbage-collected object | MObject, MWorld, MActorComponent |
A | Actor | AActor, APawn, AGameMode |
F | Plain struct or value type | FName, FTimerHandle |
E | Enum | ETickGroup, ECollisionChannel |
T | Template | TObjectPtr, TWeakObjectPtr |
I | Interface | IDamageable |
ECS components are plain structs named with a Component suffix, for example TransformComponent and RigidBodyComponent.
Where your code lives
Your gameplay code lives in the project's game module, a shared library that depends on the engine and can be hot-reloaded while the editor runs; see Programming for game modules and plugins. MowoSandbox in the engine source is the reference template for a hot-reloadable module. The editor's class wizard, mbt newclass and the hot-reload loop are covered in Working with C++.
A typical game-module class looks like this, taken from the sandbox template:
- Derive from an engine class
Pick
AActorfor a placeable object,MActorComponentorMSceneComponentfor a reusable behavior, orAPawn/ACharacterfor something a player or AI drives. - Annotate it for reflection
Put
MCLASS()before the class andMGENERATED_BODY()inside it. Mark fields withMPROPERTY()so they are saved with the scene and traced by the garbage collector. - Build components in the constructor
Create components with
CreateDefaultSubobject<T>()and pick a root withSetRootComponent(). - Override the lifecycle
Override
BeginPlay,TickandEndPlay, and call the base implementation so components keep receiving their callbacks.
Every MFUNCTION you declare shows up in Visual Scripting automatically, because the node catalog is built by walking the class registry. You never register nodes by hand.
What happens each frame
When the game is playing, the scene runs actor ticks in groups around the ECS update, and the physics step happens inside the ECS update. AActor
- PrePhysics actors
- DuringPhysics actors
- ECS systems (physics step, transforms)
- PostPhysics actors
- PostUpdateWork actors
With p.OverlapDuringPhysics on (the default), the physics steps run on a worker while the DuringPhysics group ticks. ECS systems have their own phase order (PrePhysics, Physics, PostPhysics, PostUpdate) inside that update. System
Pages in this section
Foundations
Physics and animation
Presentation
AI and game systems
Worlds
Gameplay plugins
The engine ships 7 plugins. These four add gameplay; each is off until a project enables it in the Plugins window.
Networking and replication are covered in Multiplayer, and game UI in UI.
API reference
Engine sources
This page describes behavior implemented in these files of the engine repository, checked against commit 5922e6e5e.
- Engine/Source/Runtime/Game/Public/Game/AActor.h
- Engine/Source/Runtime/Game/Public/Game/MWorld.h
- Engine/Source/Runtime/Game/Public/Game/MActorComponent.h
- Engine/Source/Runtime/ECS/Public/ECS/System.h
- Engine/Source/Runtime/Core/Public/Core/MObject.h
- Engine/Source/Runtime/Reflection/Public/Reflection/Reflect.h
- Engine/Plugins/Combat/Combat.mplugin