Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Two ships duel in a gravity field. Gravity doesn't affect the ships themselves (which have spanking new anti-gravity devices), but it affects missiles launced by the ships.

You can play against the computer, or two players can play with one keyboard. There is also a Gravity Wars mode, where the two ships do not move, and the players repeatedly specify the direction and velocity of their missiles.

Web page:

Bug tracker:


Quick start

Just run 'pyspacewar' and play. There is no need to build or install anything (although if you wish to do so, you can use the traditional 'python install').

Player 1 Controls

LEFT, RIGHT - rotate UP - accelerate in the direction you're facing DOWN - accelerate in the opposite direction RCTRL - launch a missile RALT - brake (lose 5% speed) 1 - enable/disable computer control

Player 2 Controls

A, D - rotate W - accelerate in the direction you're facing S - accelerate in the opposite direction LCTRL - launch a missile LALT - brake (lose 5% speed) 2 - enable/disable computer control

Other Controls

F1 - help ESC - escape to menu (pauses current game) PAUSE - pause the game O - hide/show missile orbits F, ALT+ENTER - toggle full-screen mode +, - - zoom in/out mouse wheel - zoom in/out left click - escape to menu (pauses current game) right drag - drag the viewport around

Command Line

  • start in full-screen mode
-m WxH
  • choose video mode for full-screen (e.g. -m 800x600)
  • show detailed timings for debugging/optimization


PySpaceWar was written by Marius Gedminas <>. It is released under the GNU General Public Licence (see the file named LICENSE).

Ignas Mikalajūnas <> contributed the computer AI code.

The planet images were borrowed from IGE - Outer Space, an open-source on-line strategy game (

The background image is a darkened version of a public domain Hubble Space Telescope picture of the NGC 3949 galaxy, downloaded from

Icons were contributed by Jakub Szypulka and licenced under the Creative Commons Share-Alike 3.0 licence. See


A game with Newtonian mechanics







No packages published