Skip to content

A study to see how well ChatGPT can be used as a pair-programmer for video games. Here the goal is to develop a 2D platformer video game coded in Python (Pygame, an open-source library).

Notifications You must be signed in to change notification settings

Nayrobie/ChatGPT_Python_Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

I used ChatGPT to create a video game

(this project is not finished yet)

image

Image from pngitem

🎮 What is it About?

OpenAI just released ChatGPT , a new language model that can chat with you, give you detailed answers to inquiries, and even help with programming.

I wanted to test the limits of this new AI bot and see if chatGPT could be a good pair programmer for designing video games. I wondered how well the AI bot can help game design learners build their own video game, I believe that with some help, anyone can build their own games.

Description of the Project

Pygame is an open source Python programming language library for making video games. It's not a game development platform like Unity or Unreal Engine which are very popular among game designers. Pygame is easy to install lightweight, but has a lot of limitations and is better suited for light video games such as a 2D platformer. Unlike the popular game engines, when using Pygame, every aspect of the game needs to be written in a line of code, which can quickly become tedious. That's why I wanted chatGPT to provide some help.

Video of the current progress:

Screen.Recording.2023-03-17.at.17.32.37.mp4

Let’s Get Started!

First of all, I checked if ChatGPT can help:

image

That's a good start. I then asked the bot to create the basic structure of code for the game. He gave me a few lines of code, importing the pygame library, setting up the game window, the game loop that starts the game; fill the screen with a colour and stops the game when you quit.

image

Building the background and the player

I used the code from ChatGPT with a few modifications and continued with the background. I wanted a depth effect, so I chose a parallax background (it has 4 layers that moves at different speed depending on how far they are from the player). I had to learn from Coding With Russ on YouTube.
Then I incorporated the player that I wanted to animate, for this I used a sprite sheet. ChatGPT helped with the event handling of the game, to associate the animation frames to actual keys pressed by the player. I gradually added some of ChatGPT lines of code, then made some changes, and he helped with fixing bugs.

image

Optimising the code

When the code got a bit messy, I asked ChatGPT how to optimise it.

🏗️ Built with

The libraries used

  • Pygame

Game assets and graphic content

  • Parallax background from Luis Zuno on itch.io
  • The player sprite sheet from Elthen on itch.io
  • Font from

Contributors

  • Yonah Bôle
  • ChatGPT by OpenAI

About

A study to see how well ChatGPT can be used as a pair-programmer for video games. Here the goal is to develop a 2D platformer video game coded in Python (Pygame, an open-source library).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages