An artillery duel in curved spacetime

How Gravity Wars works

Gravity Wars is a free game that plays in your browser. Two ships take turns firing missiles across a universe of planets, stars and black holes, and gravity bends every shot. The physics is real enough to learn from: orbits precess near black holes, light bends around them, and a missile's clock runs slow as it falls in. This page explains what the game simulates and gives you universes to try.

PLAY FREE WATCH THE TRAILER
A missile trail curving past a black hole across a warped spacetime grid and into the other ship, which explodes
AURORA's shot bends past a black hole and into EMBER's ship. The grid (G in the game) shows space pulled into each body's well.

How to play

  1. Aim. Drag from anywhere: the direction from your ship sets the angle θ, the distance sets the speed v₀. You can also type exact numbers, as in the 1989 original.
  2. Fire with the FIRE button, Space or Enter. The missile flies until it hits something, falls into a black hole or escapes.
  3. Correct. Your last shot stays on screen as a trail. Read how it bent, adjust, and fire again. The first pilot to hit the other ship wins the round.

Play against a friend on the same device, or against a CPU pilot at three skill levels (cadet, navigator, astrophysicist) that plans its shots with the same physics you're fighting. On a phone, hold it sideways; Add to Home Screen installs it as an app that also plays offline.

Planets: Newton's gravity

Planets pull with Newton's inverse-square law. Each one's mass grows with its density and size, and, as in the original game, colour tells you density: red planets are the lightest (ρ = 1), green heavier (ρ = 1.5), blue the heaviest (ρ = 2). A small blue planet can bend a shot more than a big red one.

a = −GM / r²

A missile doesn't stop at the edge of the screen. It keeps flying until it hits something or reaches escape velocity, so a shot can leave, swing round and come back. Press O during a flight to see its osculating orbit: the ellipse or hyperbola it would follow if only the nearest body existed, with its eccentricity and the velocity and acceleration vectors.

A long missile trail sweeping across a crowded system of planets, looping a black hole and hitting a green planet
One shot sweeps the whole system, loops the black hole and comes back to hit a jungle world. The readout along the bottom shows coordinate time t, the missile's own time τ, and its speed as a fraction of c.

Black holes: Einstein's correction

Near a black hole, Newton isn't enough. The game adds the leading correction from general relativity for an orbit around a non-rotating (Schwarzschild) black hole:

a = −GM/r² · (1 + 3L²/c²r²)

Here L is the missile's angular momentum per unit mass. The extra term is tiny far away and grows fast close in, and it changes how orbits behave:

To make relativity visible, light is slow in this universe: c is only 900 units per second, and missiles launch at up to 0.67c. So the corrections show up in every match, not only in physics textbooks.

A ray-traced black hole with a glowing accretion disk lifted over its shadow, circled by the loops of a missile trail
A missile loops a black hole near its photon sphere. The disk's far side appears lifted over the shadow because its light bends around the hole.

Ray-traced lensing

Every pixel near a black hole is traced along a bent light path. That's why you see the far side of the accretion disk lifted over the black shadow, a thin photon ring at the shadow's edge, and an Einstein ring of whatever is behind the hole, including stars, planets and your own missile trails.

The disk glows with the colour of its temperature, hotter towards the middle (T ∝ r−3/4). Its gas orbits at up to about 0.7c, so the side moving towards you is Doppler-boosted and blazes, while the side moving away dims.

Time dilation

The flight readout (I) shows two clocks: coordinate time t, measured far away, and the missile's proper time τ, its own clock. Deep in a gravity well or at high speed, τ runs slow:

dτ/dt ≈ √(1 − 2Φ/c² − v²/c²)

The soundtrack hears it too: the missile's voice drops as its clock slows near a horizon, and the whole score sinks with it.

Try it

Open universe 95, start a two-pilot match and give AURORA θ = 42°, v₀ = 3. The missile drops toward the black hole, loops it several times near the photon sphere, then flies out into a lava world. Press O and I first to watch its orbit and its clock.

Stars: five kinds, five kinds of physics

Main-sequence stars
From 3,300 K red dwarfs to 9,500 K blue-white stars, each glowing with the black-body colour of its temperature and lighting the planets around it. Their light pushes on the missile (radiation pressure), so a star pulls with only part of its mass, and hotter stars push harder.
White dwarfs
A star's mass crushed to the size of a small moon: blinding, with enormous surface gravity. They bend light a little and make close orbits precess, but unlike a black hole they have a surface to hit.
Red giants
Huge and thin. The outer envelope drags on the missile, more strongly deeper in, so a shot can pass through, slow down or spiral in. Only the dense core destroys it.
Pulsars
Spinning neutron stars that sweep two lighthouse beams around. A beam shoves the missile outward, and since the beams keep turning during the flight, the same aim lands differently depending on when you fire. Listen for the tick of each sweep.
Binary stars
Two stars orbiting their shared centre of mass, by Kepler's law ω = √(G(M₁+M₂)/a³), slowed to stay playable. The gravity field moves while the missile flies, so timing matters as much as aim.
Try it

A pulsar, a binary, a red giant and a white dwarf, each alone at the centre of its universe. On the title screen, Stars: chaos mixes them all.

The spacetime sheet (3D lite)

Press V and flat space tilts up into a sheet, with every body sitting in a well as deep as its gravitational potential (Φ = GM/r, compressed to fit on screen). It's the textbook picture of gravity, and it makes a universe readable at a glance: deep wells are where shots bend most.

Planets and a black hole sitting in wells on a tilted, glowing spacetime grid, with missile trails curving between them
3D lite: the same match drawn as a spacetime sheet. The black hole's well drops away where time stops at the horizon.

It's a picture, not the cause. Missiles fly by the same equations in both views, and a marble rolling on a real rubber sheet wouldn't quite follow them. A black hole's well shows gravitational time dilation, which matches GM/r far away but plunges straight down at the horizon.

Under the hood

For teachers and students

Gravity Wars can make orbital mechanics something you can poke at. Some things to try in a lesson:

The game is free and needs no account or install; it runs from a link.

The 1989 original

Gravity Wars is a remake of Gravity Wars (1989) by Sohrab Ismail-Beigi, a DOS game he released to the public domain, itself a port of an Amiga original. This version keeps its rules: aim by angle and speed, planet colour is density, missiles fly off screen until they escape, and the original victory tune plays when you win. Everything else, from the black holes to the relativity, is new.

Questions

Is it free?
Yes. It plays free at gravwars.com and on itch.io, with no ads and no account.
Does it work on phones?
Yes, held sideways. Android phones in Chrome and Firefox are tested; iPhones and Safari aren't yet, so tell us how it goes.
Can I play against a friend?
Yes, taking turns on the same device. Online play isn't available yet.
Found a bug, or have an idea?
Press ! (bug or feedback) in the game, on the title screen or during a match.

PLAY GRAVITY WARS