All projects

Chemist's Box

An offline chemistry sandbox on a C++17 particle-simulation core with heat transfer and phase changes.

Role
Solo developer
Year
2026
Status
In App Store review
Stack
C++17, Godot, GDExtension, GDScript
Drawn live in the browser with the game's colours and reaction 1's numbers (2H + O → 2H₂O above 550 °C). An illustration, not a capture of the game.

Overview

What it is

Chemist's Box is an offline chemistry sandbox, built solo on a C++17 particle-simulation core exposed to Godot through GDExtension.

Shot 2 · First discovery: pour H and O into a closed box, ignite, H₂O card · 8–10 s recording
Draft: a device recording goes here.

Numbers

16
Elements
31
Compounds
66
Reactions
32K
Grid cells
60 Hz
Tick rate
285
Passing tests

Story

Why I built it

The idea came to me one night before I fell asleep: I wanted to build a chemistry simulator that's as close to real life as possible. My reasoning was that the rules of the real world, like gravity, energy transfer and the conditions under which chemical reactions happen, are already known and used in science. So if I used those parameters and gave every element and compound its own real properties, it should be possible to simulate chemistry that matches reality one to one. I started building it in October 2026 and developed it in about three weeks.

I also tried to make the elements and effects look realistic, so that playing with it feels satisfying.

Lab

Inside the lab

  • Shot 1 · Powders, water and gases at rest
    Draft: still
  • Shot 4 · Heat tool on water: bubbles, steam, level drops
    Draft: 8–10 s recording
  • Shot 7 · Thermite: Al + CuO above 850 °C
    Draft: 5–8 s recording

Engine

One tick, nine passes

The simulation core is plain C++17 with no Godot headers, so it builds and runs its tests on its own. It owns a single grid of 144 × 224 cells (32,256) and steps it 60 times a second. Every tick runs the same passes in the same order: pressure, tools, heat conduction, phase changes, reactions, dissolving, movement, explosions, and finally the fading of reaction flashes.

GDScript never touches the cells. It sends intents like "pour copper here" or "ignite there", and each frame it reads back five byte layers that the renderer turns into textures. Events the simulation notices, like a new compound or an explosion, come back through a queue and drive the discovery card, haptics, sound and effects.

Read back by the renderer every frame

  • matter
  • gas
  • info
  • phase
  • motion

Reactions

Reactions are data

Reactions aren't hard-coded into the simulation logic. Each one is described as data: what reacts, under which conditions, and what it produces. The simulation core stays generic and simply applies whatever reactions are defined. I chose this approach from the start because it keeps the engine and the chemistry content separate, so adding a new reaction or compound means adding data instead of changing the engine. That matters for a project whose whole goal is to keep growing toward real-world chemistry.

A reaction record lists its inputs and the states they must be in, a temperature window, a rate, the heat it releases and how violent it is. Each tick the engine checks a cell's eight neighbours against the reactions that start with that substance. Chains aren't scripted: the heat a product releases can push its neighbours over the next reaction's threshold. Every compound can be reached from the 16 elements: 18 are one reaction away, 7 are two away and 6 are three away.

{
"id": 47,
"equation": { "lhs": [[3, "CuO"], [2, "Al"]],
"rhs": [[1, "Al2O3"], [3, "Cu"]] },
"recipe": {
"inputs": [{ "sub": "Al", "states": ["s", "l"] },
{ "sub": "CuO", "states": ["s"] }],
"outputs": [{ "sub": "Al2O3" }, { "sub": "Cu" }]
},
"t_min": 850,
"rate": 0.8,
"heat": 2500,
"explosive": 3,
"fx": "#FFE6A8",
"vfx": "thermite_burst"
}
ambient 880 °Creacted 70/70 cells
Al meltst_min

3CuO + 2Al → Al₂O₃ + 3Cu

Reaction 47 from data/reactions.json (defaults trimmed), and what the engine does with it.
All 47 substances, derived from data/reactions.json.Explosive123

Data

Real-world data

The properties of the elements and compounds and the conditions for reactions are based on real scientific data. Melting and boiling points and densities were checked against PubChem, RSC and NIST, and every substance has its own colour as a solid, a liquid and a gas. Some of the thermal values are still estimates, which is part of why the game is close to real chemistry but not one to one yet.

25 °C

12 solid · 0 liquid · 4 gas · at 1 atm

−2732000 °C
  • 1

    H

    Hydrogen

    gas

  • 6

    C

    Carbon

    solid

  • 7

    N

    Nitrogen

    gas

  • 8

    O

    Oxygen

    gas

  • 11

    Na

    Sodium

    solid

  • 12

    Mg

    Magnesium

    solid

  • 13

    Al

    Aluminium

    solid

  • 14

    Si

    Silicon

    solid

  • 15

    P

    Phosphorus

    solid

  • 16

    S

    Sulfur

    solid

  • 17

    Cl

    Chlorine

    gas

  • 19

    K

    Potassium

    solid

  • 20

    Ca

    Calcium

    solid

  • 26

    Fe

    Iron

    solid

  • 29

    Cu

    Copper

    solid

  • 53

    I

    Iodine

    solid

Melting and boiling points and state colours from data/substances.json. Carbon sublimes.

Thermal

Latent heat and pressure

Heat spreads from cell to cell, and a cell that reaches its melting or boiling point stops there until it has absorbed the latent heat it needs. So ice melts from the outside in, and boiling water sits at 100 °C while it turns to steam. Each cell's latent heat is varied by up to 25 %, so a block changes phase gradually instead of all in one tick. In testing, a 20 × 20 block of ice at 25 °C melts in about 22 seconds.

The boiling point moves with pressure. Drop the pressure to 0 atm and water boils violently, then most of what is left freezes, and the ice slowly sublimes.

Heating 1 g of ice at a constant rate

100 °C · boiling

latent heat

Water's boiling point vs pressure, the game's rule

2.7 atm · water boils at 138 °C

Left: water's real heat capacities and latent heats, the behaviour the thermal model reproduces. Right: Tb(P) = (Tb + 273.15) / (1 − 0.0945 · ln P) − 273.15.

Rendering

Seven passes, one frame

The grid is coarse, but the field shouldn't look like pixels. Each frame the renderer draws the simulation's byte layers in seven passes at different resolutions: material fields, liquid, gas, glow, heat, light and room light. A final composite turns solids into grains by material, merges liquid cells into a surface that refracts the wall behind it, blends gas clouds, and lets fire light up the scene with bloom.

A timing guard compares checksums after fixed runs, so a change to the renderer can't quietly change how the chemistry plays.

Testing

285 tests and a timing guard

98 C++ test cases with 29,576 assertions cover the simulation core, and 187 GDScript tests cover the game, the content and the reactions. Every one of the 66 reactions has a scenario that has to fire within a fixed number of ticks, and a baseline records when each reaction first fires across 8 fixed seeds, so changes to movement or rendering can't shift the chemistry unnoticed. The content is validated when it loads: atoms must balance, and every compound must be reachable from the elements.

98

C++ cases · doctest

29,576 assertions over the core: thermal, phase, reactions, aqueous, movement, inertia, explosions, containers and rendering.

187

GDScript tests · GUT

  • 147 unit
  • 27 content
  • 13 scenario

66 × 8

timing baseline

each reaction × 8 seeds: first-firing tick checked against the baseline

Status

Where it is now

Chemist's Box is currently in App Store review for iOS. It won't come to macOS; an Android version may come later, depending on how it does. Right now it has 16 elements, 31 compounds and 66 reactions. Not all elements, compounds and reactions are in yet, and while the physics and chemistry are close to real life, they're not one to one. My near-term goal is to turn it into a chemistry simulation that matches the real world exactly, and I'll keep improving the elements and effects along the way.

Next project

Pip-Pop

A bubble shooter on the App Store with a hex-grid trajectory simulation and an adaptive shot solver.

Shipped · 2026
  • Godot
  • GDScript
  • Objective-C++
  • Firebase

© 2026 Emre Tutal