Developing a game with ChatGPT

I decided this past weekend that I would see how far I could go, using a Large Language Model, writing a relatively simple game. I used ChatGPT 4o to create a game.

I knew I wanted to build some form of a platformer, my favourite genre, and decided to go with a jungle theme. I adore playing Donkey Kong Junior, and this is kind of an homage to a game I have spent hours playing.

I’ve had a dream of buying a Panic! Playdate and the API is freely available. I decided I would build something for a platform I knew nothing about and also using a language I’ve never written code in – Lua. I don’t actually have the Playdate hardware, but I’m ready to buy one.

Developing a game, in a new language and API, for a platform I don’t even own.

I might go into detail about how I did this in future videos, but I started with building the player code getting jump and ground pound functionality working.

I then focused on the vines, ensuring that I could move left and right and only up and down on the vines.

I wanted two kinds of enemies – on the vines and in the air.

Of course I needed some form of collectable, which was inspired by Boulder Dash – another game I loved during my childhood.

I had fun trying to figure out collision and overlap detection as the vines behave differently than the enemies, which behave differently from the diamonds. Sprites can can push you or you can make them overlap. Really useful!

All the artwork was also created with ChatGPT – backgrounds, characters – all of it.

Here are my thoughts on using an LLM for coding:

I learned heaps. I have been interested in game development for years and have studied, but I’ve never spent the time to finally build a game. The classes make sense, how they interact with each other, the states. It made sense to me, but finally putting these together in my own game, there was so much I learned.

Despite using generated code, I know this code inside and out. I had to to figure out bugs as there were times I’d fix one thing with the LLM, and then it would break something else. It would go back and forth breaking the same bit of code until I called out, “Could it be this area” after realizing what was going on.

I look at AI as a tool to inspire, especially when you have the right tools, and I had the right tools – ChatGPT, Microsoft Visual Studio, the Playdate SDK, and Aseprite.

Is this lazy? I think not. It shows how efficient and quick I can be when developing code and want to get my ideas out. Anything I can do to speed up my development process, I support. For example, I am a huge proponent of reusable code which also speeds me up – referring to my own templates and design patterns.

If I were to write this from scratch, every line of code, it would have taken me two to three weeks. I did this in a weekend. I figure I spent 24 hours creating this. It will probably be 36 hours with tweaks, bug fixes, adjustments, etc.

I definitely want to do this more. This was the most fun I’ve had writing code for a personal project.