Step-by-step guide for getting started with ChainedEngine.
- Requirements
- Building the Engine
- Running the Editor
- Editor Overview
- Creating Your First Scene
- Writing Your First Script
- Running the Game
- Exporting Your Project
- Common Tasks
| Component | Version |
|---|---|
| C++ Compiler | MSVC 17+, Clang 18+, or GCC 14+ |
| CMake | 3.28+ |
| .NET SDK | 10.0.x (for C# scripting) |
| Git | With submodule support |
Windows: Visual Studio 2022 or Clang from LLVM.
Linux: build-essential, libx11-dev, libxrandr-dev, libxinerama-dev, libxcursor-dev, libxi-dev, mesa-common-dev, libgl1-mesa-dev.
- Clone the repository with submodules:
git clone --recurse-submodules https://github.com/IOleg-crypto/Chained-Engine.git
cd Chained-EngineIf you already cloned without submodules:
git submodule update --init --recursive- Configure with CMake:
# Windows (Clang)
cmake --preset windows-clang-debug
# Windows (MSVC)
cmake --preset windows-msvc-debug
# Linux (Clang)
cmake --preset linux-clang-debug- Build:
cmake --build --preset windows-clang-debug --parallel- Binaries appear in:
build/<preset>/bin/Debug/
ChainedEditor.exe # The editor
ChainedRuntime.exe # Headless game runner
ChainedDecos.exe # Game executable
build/windows-clang/bin/Debug/ChainedEditor.exeThe editor opens with a default scene. You can open any .chproject file through File > Open Project.
The editor has these main areas:
| Area | Description |
|---|---|
| Viewport | 3D preview of the scene. Click to select objects. Gizmos for move/rotate/scale. |
| Hierarchy | Tree view of all entities in the scene. Right-click to add/delete. |
| Inspector | Properties of the selected entity. Edit components here. |
| Content Browser | File browser for assets (models, textures, scripts, scenes). |
| Console | Engine logs and errors. |
| Animation Graph | Visual state machine editor for animations. |
- Play — Runs the game inside the editor. Physics and scripts execute.
- Simulate — Runs physics only, no scripts.
- Stop — Returns to edit mode.
- Escape — Leaves simulation and returns to editor interaction.
-
Create a new scene: File > New Scene (or Ctrl+N).
-
Add an entity: Right-click in the Hierarchy > Create Empty.
-
Rename it: Double-click the entity in Hierarchy, type a name (e.g., "Player").
-
Add a Transform: The entity already has one by default. Adjust Position/Rotation/Scale in the Inspector.
-
Add a Model: In the Inspector, click "Add Component" > ModelComponent. Browse to a
.gltfor.objfile. -
Add a Camera: Create another entity, add CameraComponent. Set it as the main camera.
-
Add Lighting: Create an entity, add LightComponent. Choose Point, Spot, or Directional.
-
Save: File > Save Scene (Ctrl+S).
- Select your entity.
- Add RigidBodyComponent — choose Static, Dynamic, or Kinematic.
- Add ColliderComponent — choose Box, Sphere, Capsule, or Mesh shape.
- Press Play to see it fall under gravity.
Scripts are written in C# and live in your game's assets/scripts/src/ folder.
Create assets/scripts/src/MyScript.cs:
using Chained;
namespace MyGame
{
public class MyScript : Script
{
public float Speed = 5.0f;
public override void OnCreate()
{
Log.Info("MyScript created!");
}
public override void OnUpdate(float deltaTime)
{
if (Input.IsKeyDown(Key.W))
{
TransformComponent? transform = GetComponent<TransformComponent>();
if (transform != null)
{
transform.Translation.Z -= Speed * deltaTime;
}
}
}
}
}- Select the entity in the Hierarchy.
- In the Inspector, click "Add Component" > ManagedScriptComponent.
- Browse to your compiled script (the engine auto-discovers scripts in the assembly).
Public fields (like Speed) appear in the Inspector. You can edit them without recompiling.
| Method | When it runs |
|---|---|
OnCreate() |
Once, when the script is first attached. |
OnStart() |
Once, on the first frame after OnCreate. |
OnUpdate(float dt) |
Every frame while the game runs. |
OnGUI() |
Every frame for in-game UI drawing. |
OnCollisionEnter(ulong id) |
When a physics collision starts. |
OnDestroy() |
When the script or scene is destroyed. |
Move toward a target:
Vector3 direction = target - transform.Translation;
transform.Translation += Vector3.Normalize(direction) * Speed * deltaTime;Check collision with a tag:
public override void OnCollisionEnter(ulong otherEntityId)
{
Entity other = new Entity(otherEntityId);
TagComponent? tag = other.GetComponent<TagComponent>();
if (tag?.Tag == "Pickup")
{
Log.Info("Collected!");
}
}Teleport (use ForceSetVelocity for dynamic bodies):
RigidBodyComponent? rb = GetComponent<RigidBodyComponent>();
rb?.ForceSetVelocity(Vector3.Zero);
transform.Translation = spawnPoint;Press Play in the toolbar. The game runs inside the viewport. Press Stop to return to edit mode.
ChainedRuntime.exe --project path/to/mygame.chproject --width 1920 --height 1080| Flag | Description |
|---|---|
--project |
Path to the .chproject file. |
--name |
Window title (default: project name). |
--width |
Window width in pixels. |
--height |
Window height in pixels. |
ChainedDecos.exeOpens the default project defined in the .chproject file.
- In the editor, go to File > Export Project.
- Choose a Pack Mode:
- Fast (LZ4) — Quick export, larger file.
- Balanced (ZSTD) — Slower export, smaller file.
- Raw — No compression.
- Adjust Compression Threshold if needed (0.0 = compress everything, 1.0 = compress nothing).
- Click Browse Output Folder and select a destination.
- The export starts automatically. Progress is shown in the overlay.
- Distribute the exported folder — it contains everything needed to run the game with ChainedRuntime.
- Create an entity.
- Add LightComponent.
- Choose type: Point (omnidirectional), Spot (cone), or Directional (sun).
- Adjust color, intensity, and range in the Inspector.
- Create an entity.
- Add AudioComponent.
- Set the audio file path, volume, pitch.
- Enable Spatialized for 3D positional audio.
- Enable PlayOnStart to play automatically.
- Create an entity with SceneTransitionComponent.
- Set TargetScenePath to the destination scene.
- From a script, set
Triggered = truewhen the player reaches the exit.
AppWindow.SetSize(1920, 1080);
AppWindow.SetFullscreen(true);
AppWindow.SetVSync(false);Audio.Play("assets/sounds/jump.wav", volume: 0.8f, pitch: 1.0f);
Audio.Stop("assets/sounds/jump.wav");
Audio.StopAll();Entity? enemy = Scene.FindEntityByTag("Enemy");
if (enemy != null)
{
TransformComponent? t = enemy.GetComponent<TransformComponent>();
}Entity? clone = Scene.CopyEntity(original);Scene.LoadScene("assets/scenes/level2.chscene");Application.Close();For the full C# API reference, see Scripting API Reference. For component details, see Component Reference.