Skills Projects About Contact

Maths Engine

Maths Engine is a Unity plugin that allows designers to visually configure mathematical formulas using ScriptableObjects, Prefabs, and config assets instead of hardcoded code. It transforms math into data. Designers build formulas visually. Programmers evaluate them at runtime.

Documentation
← All Projects

Role

Programmer, Owner

Tech

Unity, C#, Editor Scripting

01

The Problem

Gameplay systems often rely on complex, frequently changing formulas — damage calculations, economy scaling, AI weights, and progression curves. These are usually hardcoded, making iteration slow and error-prone.

Designers depend on programmers for even small tweaks, and as formulas grow, the code becomes difficult to maintain, debug, and extend.

Math Engine solves this by introducing a node-based, data-driven formula system — allowing complex expressions to be built visually, modified without code changes, and evaluated efficiently at runtime.

02

How It Works

01
Build formula graph
Create formulas using a node-based editor. Each node represents an operation, constant, or variable.
02
Serialize as data
Graphs are stored as assets, making them reusable, versionable, and editable without touching code.
03
Evaluate at runtime
A runtime evaluator traverses the graph and computes results efficiently with minimal allocations.
03

Features

Node-Based Architecture
Formulas are represented as graphs of interconnected nodes, enabling modular, reusable, and easily debuggable expressions.
Efficient Runtime Evaluation
Custom evaluator traverses graphs with minimal allocations, supporting deeply nested expressions without performance overhead.
{ }
Extensible Node System
New operations can be added easily by defining new node types, making the system scalable for different gameplay needs.
#
Strongly-Typed Inputs
Supports structured input data, allowing formulas to safely reference gameplay variables without string-based lookups.
Editor Tooling
Custom Unity editor for creating, editing, and debugging formula graphs visually.
Reusable Graph Assets
Graphs are stored as assets and can be reused across multiple systems like combat, economy, and AI.
04

Why It Matters

Bridging designer flexibility with runtime performance

Math Engine sits at the intersection of tooling and runtime systems. It required designing a graph architecture that is flexible enough for designers, while still being efficient enough for real-time gameplay evaluation.

One of the key challenges was handling Unity serialization limitations, especially around cyclic graph structures and asset persistence. Ensuring graphs remained stable across reloads without duplication required careful data design.

The runtime evaluator was built to avoid unnecessary allocations and handle deeply nested expressions, making it viable for use in performance-critical systems such as combat and AI.

05

Links

Unity Asset Store
Coming soon. Will be available as a package directly importable via the Package Manager.
Stack
Unity3D · C# · Editor Scripting · Graph-based architecture · Runtime evaluation systems