Last year I watched the Netflix Documentary called High Score and really liked it. I would highly recommend watching it if you haven’t already. It talks about the evolution of video games and how they started and what were the turning points in Video Game history. In the last episode, they briefly talk about the first video game ever made called SpaceWar!. That game inspired many including Nolan Bushnell, the founder of Atari Computers, to get into the field of making video games.

Spacewar! was made in 1962 by students of MIT and it quickly started circulating among other students and teachers. Atari released a remake of this game in the 70s also called SpaceWar!, I think it was a tribute to the game that started it all!

SpaceWar! The first video game made in 1962. Screenshot of an online emulator.

The gameplay of SpaceWar! was simple. There are two spaceships and they need to shoot each other. Your Space Craft can propel in the forward direction and to stop or slow down you need to rotate in the other direction and then thrust forward. There was also a star in the middle and if your spaceship gets too close to the star it will suck you in. The star also creates a gravitational field affecting the space crafts.

So, I thought, let’s see how long it will take me to recreate the very first known video game ever when I have the computer technology and an amazing game engine at my disposal. I will be using Godot 4 version 4.0.3 to recreate SpaceWar! I have never actually played original SpaceWar! I just understood the basics of the game through watching videos, simulation and Wikipedia.

I quickly downloaded some space assets from and created my player spacecraft. I felt it will be better to have a base class called SpaceCraft that extends from CharacterBody2D which will have all the logic for movement, rotation, firing, destruction etc. I could use this class to make my Player Space Craft as well as the enemies.


What I like to do before I start jumping to writing code is make a small document or drawing where I list down all the objects and characters I will need in the game and then write down their properties and functionalities to have a rough idea of what to code.

So here is the Board I created for this simple game.

Objects in the Game

It will have 2 SpaceCrafts at a time. One controlled by first player and the other controlled by another player. Since I want two people to play on the same computer, I will assign separate keys for each player.

I also needed a Celestial Body and I chose to go with Planet Earth instead of a star.

The SpaceCraft will rotate and will have engine to thrust forward. When Player presses the buttons for left and right the SpaceCraft will rotate in those directions. When the Player presses Fire Button, the SpaceCraft will fire a torpedo in the direction it is facing.

I created CelestialBody Class that will take care of adding to the velocity of every space object towards it’s own center.

I will have SpaceCraft Class that manages rotation, velocity movement, and self destruction when hit.

The Torpedos are not affected by Gravity, but it might be fun to see what if they were in another video.

So now that I have a working game, let me show you what all i did.

I started with the simplest object in the game. The Torpedo . I created a new Project and then added a 2D Scene. In my scene I changed my root node to Area2D type of node and then added an AnimatedSprite2D node. I used the burning asteroid sprite sheet as my Torpedo image. It needs to auto-start and it needs to run in loop forever till destroyed. I also added the CollisionShape2D node and created a circle shape to fit the torpedo.

Torpedo Scene

After being satisfied with the visual aspect of my torpedo I added a new script to the root node. In the Physics Process Function of the script, I made it move in the local x direction. I also wrote an if statement to make sure that the torpedo gets destroyed if it leaves the screen limit.

Then I added a signal on the Area2D node and attached it to a function. If the Torpedo hit an object that belonged to a certain group, it would call the collided object’s “hit” function.

Torpedo is ready!

I then created another new scene and changed the root node to CharacterBody2D Type.

I added an AnimatedSprite2D node for the body of the spacecraft, then added another Sprite to make the engine, and then another animated sprite node to make the fire coming out of the engine.

I created 2 animations within the engine fire animated sprite node. idle and thrust. When the player is not pressing Thrust button the idle animation will play, but when the thrust button is pressed, thrust animation will play.

Adding body and engine sprites
Adding animated engine fire

I created a base class and named it “SpaceCraft”. Both the Space Crafts will inherit this class to make Player 1 and Player 2.

In the base class I wrote the functions to rotate and move the Space Craft.

In the Player 1 Craft that i made earlier I added a new Script that inherits my Space Craft class. In the Physics Process function I called the Physics Process Function of the super class and then checked for Inputs. I called various functions already present in the base class based on the User’s Inputs.

I created a new 2D scene and named it Level 1. I added my space craft and tested it and to my surprise. It was flying around as expected. I then quickly added a background space and stars to make it look like we are in space.

It was time to add the functions to emit_signals when fire button is pressed. The signal will be connected to a function in the level manager script added to the root node of the level scene, where it will add torpedo to the scene when the fire button is hit. Why I chose this is because I wanted to add the torpedos in their own separate Node and not inside the player spacecraft to make sure that if the space craft is destroyed, the torpedos are not.

I used the same logic of emiting signals to add an explosion animation when a space craft is destroyed. Now we have a space craft that can fly and fire torpedos.

Space craft is able to rotate and thrust forward in space.

After fixing the sizes and speed of the torpedos I made a planet. In the original game of SpaceWar there is a star that keeps adding a gravitational field to the game and if the space crafts get too close they are sucked in and destroyed. I used an Earth like planet instead of a star.

After I got the earth animation to work, I added an Area2D and created a new circle shape. I could have used the simple formula to add gravity to the space crafts based on their distance from earth, but I wanted more dramatic change in the speed when they are near or far away from the planet. So, I used multiple Area2D nodes of circular shape, of different sizes, from small to big. Every time the space craft entered or exited these Area nodes, a different gravitational value was used. I used a very small value for the largest circle shape, and the highest number for the smallest circle shape. The other values transitioned in between.

This way, the planet added more velocity to the space craft when it was near the planet, while very little velocity when the space craft was far away. Also, the velocity was cumulative so it kept accelerating the space craft towards earth.

I was quite skeptical that this would work, but actually it did. Also, the space craft started forming elliptical orbit around the planet and once locked in orbit, would stay there for a very long time.

The planet creates a gravity field and the space craft orbits around it.

I also added a collision circle shape and an area 2d circle shape to the planet and with the help of some code, I managed to make sure that if the space craft hits the earth, it is destroyed. This time I used built-in signals of Area 2D to make this work.

I had to play around with the values of the gravity rings many times to get the effect right. but finally, I was happy at some point.

Adding the Explosion animation

It was time for just few more steps. I added an Animation Player node and animated the modulation of the Space Craft Sprite. This would help the Players see visually when they were hit.

Now all I had to do was to add the controls for the second player and make a copy of the player 1 Space Craft. I was thinking that i might be able to use the same script for both players, but for simplicity’s sake, i just thought it would be better to make two scripts for the 2 players, both inheriting from the base class SpaceCraft.

I had to tweak my code a little but to make the space combat work. I had to create two new groups “player 1” and “player 2” and add the space crafts respectively to be able to know who hit whom.

As of now, at the time of making this video, two players can use arrow keys and wasd keys to control their space ships individually from the same keyboard and use, / and Q keys to fire. The project is available on Github for you all to try as well

Final Game. Play it on

I hope you enjoyed this post. You can watch this entire post as a video on YouTube. I was able to recreate the very first video game of the world within a couple of hours although, if there were no gaming engines and modern computers, I might have taken weeks if not months to make the same back in 1962.

Last modified: June 19, 2023



Write a Reply or Comment

Your email address will not be published.