Gravity Wars

Saved games stay in this browser only.

About the game

Two small ships sit on opposite sides of a dark field scattered with grey planets, and each wants to be the one that hits the other first. The catch is that every planet pulls on a shot while it flies: a bullet that leaves your ship in a straight line bends around the nearest world, swings past a second one and may end up somewhere you never aimed. Shots that hit a planet are swallowed by it, so the planets are both your obstacles and your help.

The game is an artillery duel in the tradition of the old tank games, played on one screen by two people taking turns. The planets are placed at random every round, with a margin around the ships so that nobody starts inside a planet, and a new layout is dealt after each hit. Every shot leaves a trail that fades slowly, and the game keeps your last angle on screen, so a miss tells you how to correct the next try.

There is no computer opponent: this is a hot-seat game for two people at the same keyboard and mouse. It was written by Boris as a LÖVE port of his earlier prototypes, which in turn go back to a gravity artillery game he once played on a Macintosh, itself a version of an Amiga original.

Playing it here

Click Play, and the first player's ship appears with two rings around it. Press inside the small inner ring and drag sideways to set the power, or press between the rings and drag sideways to turn the aim; the red number is the power and the white one the angle in degrees. When you are ready, click the blue button in the bottom-right corner or press Space. The shot is drawn live and, when the last bullet has left the field, it is the other player's turn.

Nothing is saved: there are no levels or scores, and the lives are counted on the screen only. Reload the page to start over.

Controls

Input Action
Drag sideways from the inner ring change the power (force)
Drag sideways from the outer ring change the angle
Click the blue button, or Space fire
Up arrow nudge the power up by 1%
N new random field (does not restore lives)

A few things worth knowing

Look at the trails. Shots stay on screen as thin lines that fade with each turn, and the difference from your last angle is marked. After a miss, change only one of the two values, so you can tell which one fixed the problem.

Use the planets. A planet near your ship can bend a shot around a blocker that a straight line cannot clear. Their pull is random and does not depend on how big they look, so test a low-power shot first to feel how strongly a world pulls.

Mind the health bar. The two bars at the top shrink as a shot passes close to a ship, so they show how near you came. A shot must pass within a few pixels of the ship to count as a hit and cost one of the three yellow lives.

There is no winner screen. When a player has no yellow dots left, the match is over by the rules of the game, but the game itself keeps running. Reload the page for a new match.

Frequently asked questions

Can I play against the computer? No. It is a two-player game on one screen, taking turns.

Does it work on a phone? The controls are drags and a button, which the game was first written for on a touch screen, but we have only tested it with a mouse and keyboard.

Is it free? Yes: the game is free software under the MIT licence and the source code is on the author's GitHub page.

Credits and licence

Gravity Wars was made by Boris (whyboris); the code and the two ship icons are his. It uses the basis33 pixel font by Tristan Grimmer, as packaged by Manchson, both under the same MIT licence as the game, and the licence text is linked from this page. The build served here changes only two things: the Esc key no longer tries to quit the program, and one place in the code that used a jump instruction not supported by the web player was rewritten with the same behaviour. The original is at github.com/whyboris/Gravity-Wars.