Menu
About me Kontakt

On the candlesan channel, the author set out to see if he could create a Flappy Bird-style game relying solely on code generated by ChatGPT. He started off by writing a brief description of the game's components and was quickly given a six-step action plan by ChatGPT. In the first two steps, he set up an empty Unity project and added the graphics, which led to the writing of a script that animated the bird in the game. Although the copy-and-paste method worked, there was a problem with the bird flying off the screen, prompting the user to ask ChatGPT for a fix. After making the necessary adjustments, the author was also able to implement a mechanic for the bird to fly only after the first click, making the game friendlier to players.

As the project progressed, the user started implementing obstacles like pipes that appeared on the screen. ChatGPT and the author worked well together in modifying the code and fixes, ensuring the in-game objects functioned as expected. In addition to adding obstacles, the author also decided to implement a tilting effect for the bird, further enriching the game's visuals. As the program progressed, the author could focus on different aspects, such as positioning text elements and background graphics.

Upon completing the code related to scoring and game over conditions, the user noticed several minor logic issues that ChatGPT helped to rectify. For instance, modifying the scoring system allowed points to be awarded only when the player passed through the gap in the pipes instead of before. The ground was also not initially included in the plan, but its addition significantly improved the game dynamics. This is where the author could concentrate, using artificial intelligence assistance.

When the game seemed to be complete, the author wanted to implement a high score system. Despite various challenges with the code, they managed to configure the scorekeeping system together with ChatGPT. This collaborative process between the user and the algorithm was enjoyable, as they faced problems and errors together during the programming. The different modifications resulted in the final game being more comprehensive than the original Flappy Bird.

In conclusion, reflecting on the video, the author noted that creating a game with no coding knowledge is still a challenge, though with ChatGPT's help, many aspects can be automated. The video has reached nearly 9,458,229 views and garnered 145,739 likes, indicating the strong interest in the subject. Candlesan also hinted at the desire to test his skills on more complex games in the future, inviting viewers to share the fun of game making.

Toggle timeline summary

  • 00:00 The speaker asks ChatGPT to create a Flappy Bird game without writing any code.
  • 00:10 The speaker will copy and paste code generated by ChatGPT for the game.
  • 00:22 ChatGPT provides a six-step plan to develop Flappy Bird using Unity.
  • 00:38 Step three involves writing a script for the bird's movement, which is done by ChatGPT.
  • 00:55 The bird initially flies off-screen, requiring ChatGPT to fix the camera movement.
  • 01:16 ChatGPT writes code to delay bird movement until the player clicks to flap.
  • 01:50 The game art is generated by AI, using Midjourney for visuals.
  • 02:07 Step four introduces obstacle pipes and physics for collisions.
  • 02:59 The bird's rotation is adjusted based on its movement direction after feedback.
  • 03:41 In step five, scoring mechanisms are implemented while design work continues.
  • 04:26 A ground is added to reinforce the game's sense of forward movement.
  • 05:07 Step six implements a game over screen triggered by collisions.
  • 05:37 Player input is disabled when the game over screen appears, correcting an initial flaw.
  • 06:25 A high score system is added, leading to a minor bug that is resolved collaboratively.
  • 07:03 The high score system is functional, showing score retention between rounds.
  • 07:15 The speaker reflects on the challenges of using ChatGPT for game creation.

Transcription

I wanted to know if ChatGPT could make a video game, so I asked it to make Flappy Bird for me, but we're going to have one rule. I'm not going to write a single line of code. Any code that we use is going to be written by ChatGPT. I'm just going to copy-paste it over. This could go very wrong. I wrote a brief description of all the components that go into Flappy Bird. Real quick, it spit out a six-step plan to make Flappy Bird in the Unity game engine. So following the instructions for steps one and two, we're going to set up an empty game project and add our art for the background and the bird, which brings us to step three, which is to write a script to give life to the bird so it can flap its wings while flying to the right. But we're not going to write the script. ChatGPT is. We're just going to copy-paste the script over. Ta-da! It works, but there's a problem. The bird is flying off the screen, so we're going to ask ChatGPT to fix that and write us some code to have a camera follow the bird as it moves to the right. But you may have noticed that the bird is flying off the background. That was a mistake I made setting up the background in the first place, so I'm going to chalk that one up to human error. My bad! With a quick adjustment, we now have a script working great. At this point, I realized we don't want the game to start right away when the game loads. We have to wait for the player to click at least once to flap their wings before the bird starts moving. Otherwise, you go barreling into the ground as soon as the game starts. As per our main rule, I had ChatGPT write all of the code to delay movement until the player had flapped their wings for the first time. And success! The game now waits until the first click, and then you can flap, flap, flap your heart away. Have you been wondering where the art we've been using came from? Since ChatGPT is writing all of the code, well, if you haven't guessed already, the art is generated by AI as well. I fed rough blockout sketches into Midjourney and had it fill in the details for the background environment, the bird, and the pipe. This brings us to step number four. Things are going to get really interesting. In step four, obstacle pipes are going to start appearing. ChatGPT has given us instructions to hook up the physics for the pipe, which will cause the bird to collide with the pipe, which is how the game is going to end. But as I was reading the instructions ChatGPT had provided, this line caught my eye. ChatGPT was planning to create the obstacles off to the right of the screen. That seems fine. But then it proposed moving the pipes left at a constant speed. I can see why it suggested that, since the pipes do appear to move to the left when you're playing. You see, the bird and camera are already moving to the right, so the pipe should actually remain stationary and allow the bird to fly up to them. I pointed this out to ChatGPT, and ChatGPT agreed. You're right, it said, and it proceeded to correct itself. I copy-pasted the code back in, and now it works great. Except, wait, wait, what's going on? The bird's flipping around like some kind of cuckoo bird. This is the first curveball that I'm going to throw at ChatGPT, because this was not part of the original design specification. We're going to ask it to rotate the bird based on whether the bird is moving up or down. Without any hesitation, ChatGPT said, sure. You want the bird to tilt up and down? You got it. And it gave me the code to do so. And now we've got this awesome little bird that tilts up and down based on the direction it's moving, rather than spinning around like a pinwheel. And that brings us on to step number five, to implement game over and scoring conditions. What I really like about this process is that while ChatGPT is taking care of the code, I get to focus my attention on design work. I get to position text elements on the screen, I decide the distance between the pipes, or the exact tuning numbers for how hard the bird flaps its wings. So now we have scoring working, but if you'll notice, the points are actually incrementing before I get to the pipe. That seems wrong. I actually want the score to increment when the player passes through the gap in the pipes. So we're going to ask ChatGPT to adjust the code to give us more control over the exact moment in time that the point is awarded to the player. The player now gets points when they actually pass through the pipe. At this point, I realize that we're missing a ground for the game. The ground in Flappy Bird is really helpful to provide that constant sense of forward movement other than the pipes. The ground was not part of the original specification, but I said nope, we're gonna need it. I let ChatGPT know that we're going to be adding a ground to the game, and it gave me step-by-step directions for how to set up a never-ending ground that the bird would be able to crash into. And now we have an infinitely long ground along the bottom of the screen, reinforcing that sense of forward movement. And then move on to step six, which is to have a game over screen come up when the player makes a collision with the pipe or with the ground. Our coding assistant ChatGPT didn't hesitate to provide us with detailed instructions as well as all of the code to set up the game over screen. Once again, I was able to focus on the design elements like deciding what font size and color to use, the sizing of the buttons, and then paste the code that ChatGPT had provided me to make the whole thing work. And now we have a proper game over screen. But wait, there's one problem. After the game over screen pops up, the player input is still being received, which means the bird can jump up after it has fallen to the ground. That's kind of ridiculous. So I told ChatGPT that when the game over screen pops up, we need to stop the camera and stop movement so that the player shouldn't be able to control the bird anymore. But here's another mistake ChatGPT made. There was a simple coding error and the game wouldn't run at all. I just told ChatGPT that the error existed to see what it would do. Polite as always, it apologized for the error and provided the correction. After following its instructions, we now disable player input when the game over screen is reached. Now this is where we're going to get to our second curveball. We're going to add a high score system. Let's see how well ChatGPT adjusts this brand new request after we had basically finished all six steps of the original plan. I copy pasted all the code it had provided me, but watch what happens when I run the game with the new high score code enabled. I scored two points on this flappy bird run, but my high score was only listed as zero. ChatGPT wrote all this complicated logic with a simple error. I told ChatGPT I thought the problem was with the add score function and it replied, you're right. It's almost like we're working together. We now have a high score system that works. On this round, I got a high score of nine and the score is retained between rounds. So could somebody with no coding knowledge use ChatGPT to make a game? Probably not yet, but we're getting there. I'm definitely going to repeat this exercise with more complicated game types on future AI models, so I hope you'll join me for that. In the meantime, happy game making.