Tykun
Games

Small science games by Tykun

Sheet 03 · Physics note · Sandbox Reactions

The physics of Sandbox Reactions

Try the early version Try it on a computer

Status

A game in the works

An early version of Sandbox Reactions is playable. It may be unstable. This note is about the physics it is being built on.

Try the early version Try it on a computer

What the game will let you do

You can play an early version of Sandbox Reactions, and it may be unstable. This page is the physics behind it. Where the game does not do something yet, I say so.

You paint star matter onto a flat world with a brush that offers nine elements, from hydrogen to iron, plus an eraser and Heat and Cool tools. Or you drop one of three starting clouds, of 1, 15 and 40 times the Sun’s mass, meant to end as a white dwarf, a neutron star and a black hole. Then you press play. Time runs from a tenth of normal speed to a thousand times, and slows itself down at ignition, at a core collapse and at a supernova.

Nothing is scripted. The labels on screen, such as “supernova”, only watch the gas and name what they see. Sizes and times are squeezed so a life fits in minutes: the game keeps each law’s form and each quantity’s order, and shows Suns, kelvins and years only in the readouts.

A star is a ball of gas held up against its own gravity

Gas pressure pushes out, gravity pulls in, and a star is the size where the two balance. The Sun runs on three clocks: a fall under its own gravity takes about 1,600 s, shrinking while heat leaks out about 1.5 × 10⁷ years, and burning its fuel about 10¹⁰ years (Pols). Each is far longer than the one before. The game keeps that order, not those numbers.

A star that contracts slowly must get hotter, and that heat is what lights it. In the game it has to come out of the equations, so gravity is the real three-dimensional pull inside a flat world, a razor-thin disk in space. Every cell pulls every other with the potential

ϕ=−Gmr

with r measured across the sheet.

Packed tightly enough, electrons resist squeezing even at zero temperature. In two dimensions that pressure follows two power laws, x2 for slow electrons and x3/2 for fast ones (Chavanis), and the game blends them:

P(x)=11K1x2+1K2x3/2

In the sheet the second law is exactly critical, so a cold core holds up only to a maximum mass:

Mch=1.4331K~22G2

That number is my own computation; no published source treats a degenerate flat sheet.

Lighting up

Fusion is steep in temperature: the proton-proton chain goes as T4, the carbon cycle as T18, helium burning as T40 (Pols). So ignition is an event, and steady burning acts like a thermostat: hotter, more power, the star expands, cooler. The game has one registry of reactions, each with a rate:

ω=AΣa∏iXinif(T)g(Σ),f(T)=∑kwk(TTk)νk

The Xi are mass fractions; g is a gate only iron uses. Hydrogen, helium, carbon, neon, oxygen and silicon ignite in that order. Real ignition temperatures sit too far apart for a core that fits in a few cells, so the game keeps the order and squeezes the ratios.

My first constants failed plainly: the Sun-like cloud never lived a main sequence. Lowering the ignition temperatures to 0.56 of their values and making the light 100 times stronger fixed it. The cloud now bounces with a mild flash, settles and burns hydrogen steadily. The centre’s hydrogen fraction went from 0.7247 to 0.7179 between steps 3,000 and 5,000. It is supposed to end as a white dwarf, and the constants should be tuned so that it does.

A star’s life, and how it ends

In nature mass sets the ending: no ignition below about 0.08 Suns, a white dwarf up to about 8 or 9 (published estimates run from 6 to 11, Heger and others), a neutron star from about 10 up to 20 or 25, a black hole above. The boundary is soft, and in detailed models not even a steady climb with mass (Pols). The game keeps one threshold for each.

A massive star burns a ladder of fuels, each shorter than the last: in a 15-Sun star, helium lasts about 2 × 10⁶ years and silicon 18 days. Fusing iron gives no energy, so the ladder stops at an iron core, which falls from some 3,000 km to some 20 km in milliseconds (Pols). In the game that collapse is a reaction: iron turns into neutron matter once its electrons are packed to the fast regime, soaking up heat. Nature finishes the electron capture during the collapse, and grid codes treat the electron fraction as a function of density (Liebendörfer), so I set the rate to finish in about one dynamical time. Neutron pressure then stops the fall, and 5 % of the neutrinos’ power returns to the gas around the core. No source fixes that share.

The bounce is supposed to blow the envelope off, and light alone is supposed to strip a dying star down to a white dwarf. The constants should be tuned so that both happen. The game has two backup mechanisms, a thermal bomb and a dust wind, switched off.

A black hole forms when a neutron core outgrows its ceiling, a proto-neutron star pushed past its maximum mass (O’Connor and Ott). The game makes a sink particle that swallows bound gas. A neutron star on this grid never gets dense enough for a density test, so the sink forms when the mass within 4 cells of a neutronized core passes the maximum neutron-star mass. A cloud about 1.4 times the Sun-like one ended as a neutron star. One 20 times heavier formed a sink, after falling into a ring that broke into 8 to 16 clumps.

The grid cannot resolve remnants: a white dwarf is about 4 cells across, and in one test 71 % of a remnant’s light came from the temperature floor. I picked a fix, not built yet.

Rounding on a graphics card

The card does its sums in 32-bit numbers, about seven digits, and cards differ: the shader language lets one fuse a multiply and an add and flush tiny numbers to zero, so one shader gives slightly different floats on different cards (W3C).

Rounding turned out not to be the main cause of the odd behaviour. Cold remnants swelled and warmed on their own, and a 64-bit version of the same step did the same within 3 %, so the cause is the scheme: gravity added as a source term leaves a still atmosphere slightly off balance, and the small flows heat the gas. Only one small rule bends to the card: when the gap left to the neutronization gate is below the card’s resolution, the cell counts as at the gate.

References

  1. O. Pols, “Stellar Structure and Evolution”, lecture notes, chapter 2. https://www.astro.ru.nl/~onnop/education/stev_utrecht_notes/chapter1-4.pdf (accessed October 8, 2026)
  2. O. Pols, the same notes, chapters 5 and 6. https://www.astro.ru.nl/~onnop/education/stev_utrecht_notes/chapter5-6.pdf (accessed October 8, 2026)
  3. O. Pols, the same notes, chapters 12 and 13. https://www.astro.ru.nl/~onnop/education/stev_utrecht_notes/chapter12-13.pdf (accessed October 8, 2026)
  4. A. Heger and others, “How massive single stars end their life”, The Astrophysical Journal 591 (2003) 288. https://arxiv.org/abs/astro-ph/0212469 (accessed October 8, 2026)
  5. P.-H. Chavanis, “White dwarf stars in D dimensions”. https://ar5iv.arxiv.org/html/astro-ph/0604012 (accessed October 8, 2026)
  6. M. Liebendörfer, “A simple parameterization of the consequences of deleptonization for simulations of stellar core collapse”, The Astrophysical Journal 633 (2005) 1042. https://arxiv.org/abs/astro-ph/0504072 (accessed October 21, 2026)
  7. E. O’Connor and C. D. Ott, “Black Hole Formation in Failing Core-Collapse Supernovae”, The Astrophysical Journal 730 (2011) 70. https://arxiv.org/abs/1010.5550 (accessed October 23, 2026)
  8. W3C, “WebGPU Shading Language”, floating-point evaluation. https://www.w3.org/TR/WGSL/#floating-point-evaluation (accessed October 8, 2026)

Revised November 16, 2026.