The Modular Game Engine

Build games with hot-compiled scripts, real-time physics, and a fully integrated editor. Native C++, open architecture.

Modularity Engine - 2D Game EditorModularity Engine - Pixel Sprite EditorModularity Engine - 3D Model EditorModularity Engine - 3D Scene ViewModularity Engine - Landscape Environment

Write Code Your Way

Pick the language that fits. All options compile to native performance.

PlayerController.moducpp
ModuCPP
1#include "ModuCPP"
2
3public class PlayerController : ModuBehaviour
4{
5 public float moveSpeed = 5.0f;
6 public float jumpForce = 8.0f;
7 private bool grounded = false;
8
9 void Begin(MODU_obj)
10 {
11 ctx.EnsureCapsuleCollider();
12 ctx.EnsureRigidbody();
13 }
14
15 void TickUpdate(MODU_obj, float dt)
16 {
17 if (!lobj || dt <= 0.0f) return;
18
19 ctx.ApplyMouseLook(0.2f, dt);
20 ctx.ApplyVelocity(moveSpeed, dt);
21
22 if (grounded && ctx.IsKeyPressed("Space")) {
23 ctx.AddRigidbodyImpulse(0, jumpForce, 0);
24 }
25 }
26}
RotateObject.cpp
C++
1#include "ScriptRuntime.h"
2
3static float rotationSpeed = 45.0f;
4
5void TickUpdate(ScriptContext& ctx, float dt) {
6 if (!ctx.object) return;
7
8 glm::vec3 rot = ctx.object->rotation;
9 rot.y += rotationSpeed * dt;
10 ctx.SetRotation(rot);
11}
12
13extern "C" void Script_OnInspector(ScriptContext& ctx) {
14 ctx.AutoSetting("rotationSpeed", rotationSpeed);
15 ImGui::SliderFloat("Speed", &rotationSpeed, 0.0f, 360.0f);
16 ctx.SaveAutoSettings();
17}
FollowPlayer.cs
C#
1using ModuCPP;
2
3public class FollowPlayer
4{
5 [DragSpeed(0.1f)]
6 public float smoothTime = 0.3f;
7
8 public void TickUpdate(IntPtr ctxPtr, float dt)
9 {
10 var ctx = new Context(ctxPtr);
11
12 var player = ctx.FindObjectByName("Player");
13 if (player == 0) return;
14
15 var targetPos = ctx.GetPosition(player);
16 var currentPos = ctx.GetPosition();
17
18 var newPos = Vec2.Lerp(currentPos, targetPos, dt / smoothTime);
19 ctx.SetPosition(newPos.x, newPos.y, currentPos.z);
20 }
21}
simple_mover.c
C
1#include "ScriptRuntimeCAPI.h"
2
3static float speed = 3.0f;
4
5void Modu_TickUpdate(void* ctx, float dt) {
6 float x, y, z;
7 Modu_GetPosition(ctx, &x, &y, &z);
8
9 if (Modu_IsKeyHeld(ctx, "W")) z -= speed * dt;
10 if (Modu_IsKeyHeld(ctx, "S")) z += speed * dt;
11 if (Modu_IsKeyHeld(ctx, "A")) x -= speed * dt;
12 if (Modu_IsKeyHeld(ctx, "D")) x += speed * dt;
13
14 Modu_SetPosition(ctx, x, y, z);
15}
ModularityModularity Engine

Native C++ engine for real-time applications.