I created an Asteroids clone with chatGPT

I was reading some articles about people creating simple games with ChatGPT so I wanted to give it a try.

I have no game programming experience and the most I have is some high level understanding of functions and a general understanding of code syntax. I couldnt write code form scratch but I can fiddle with code to tweak it a little.

First I had ChatGPT recommend a mobile game where you randomly appearing dots on the screen without clicking a blank area or missing a dot before it disappeared. I was able to get ChatGPT to walk me through setitng up Android Studio and in about 30 mins I had a very simple working game based on some of my criteria loaded on my phone. I got as far as adding some sound, 3 difficulty levels, and game over/restart screens. I hit a wall when the code got too long for ChatGPT to ingest and when I tried breaking it up, it quickly forgot what we were doing and started just throwing darts at fixing errors. I gave up.

Then I decided to try an old school arcade game and thought Asteroids was simple enough.
I told the AI I wanted it to be an HTML game and it recommended Phaser 3 game library and the matter.js physics engine. I had it walk me through setting up python on my Mac and getting the dev server running. I tried having it attack the entire thing based on a full description of the game but it was quickly overwhelmed and started choking on fixing errors though it mostly worked.

The next day I started over and decided to let it describe what functions were needed to build the game baed on my description.

I had it create the skeleton of the main JS file and we started building out each of the functions.
I think I got pretty far over the course of a few hours knowing NOTHING about HTML 5 game development.

You can see how far I got here…


Left/Right Keys - rotate ship
Up Key - thrust
Z - Fire

When game is over you have to refresh to play again.

I tried to create a start screen that handles startgin the game and displaying recent high scores but chatGPT has hit its limit for ingesitng code and coherently replying with suggestions. Anything it implements at this point just throws errors it can’t seem to fix.

I’m sure the code is TERRIBLE but it’s something.

Feel free to have a look at the code on github

That’s actually impressive for someone who has minimal code experience, I had fun playing around with it :slight_smile: