I Made a Game with ChatGPT...

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey what's up guys it's Ben Bonk and chat GPT is taking over the world seriously it feels like I stumbled across it somehow wherever I go and if for some reason you don't know what chat GPT is it's basically an AI chatbot that can seemingly answer any question you throw at it and it can even write recipes for you or give you a workout plan or write you a full-blown essay in short it's absolutely mind-boggling what it can do but something that really caught my eye with it was how it has the ability to write code even c-sharp code that I can use in my game engine of choice Unity so I wanted to put this bot to the Limit and see if it could actually create an entire video game using only code written by chatgpt and let's just say the results shocked me to start off let's set some ground rules first I can only use code written by chat gbt so no code written by me at all although I will allow myself to make some small tweaks here and there just to view the process of it and secondly I only have three hours to make this game because I have other projects that I want to focus on and I really want to see if something like this is even possible in the first place so with that said I created a new Unity project and started dragging out some ideas for a simple game at least one simple enough that I think in AI could code eventually I settled with this game idea where the player would be this cube with a weapon and they could shoot up projectiles by clicking the mouse however once shooting the player will be massively knocked back and this would be the only way the player can move in the game so the shooting would serve as a bit of a dual purpose mechanic the player would then have to kill as many enemies as possible to increase their score and if they ran into an enemy themselves it would be game over with this idea in mind instead of getting straight into writing some code myself I hopped into chat gbt which felt really weird to start off we needed a player script slash chat gbt to write me one which would allow for the player to take damage and if they ran out of Health the game would stop in a moment of truth I hit enter and after a few seconds the chat bot started spewing out this now if you know the unity game engine at all you'll notice this code looks a little strange and this is because I've been celebrating the code in C sharp unity's main programming language chat GPT decided to write this script in Python which really caught me off guard it even addressed this in a paragraph below the code explaining how the code was written in Python using the unity engine API but from what I can tell Unity just doesn't support python so I had to give this another go but still this interaction was quite unexpected and interesting a modify mirror quest to include the keyword C sharp and just like that I had working code that I could use in my game I mean seriously how cool is that it even writes a paragraph or two in detail about what the code does and how to implement it now this is cool and all but I actually noticed something troubling this code was written for a 3D unity game by using the on collision enter function instead of the on collision entered 2D function so I decided to put the bot to the test in order to convert the code to work with 2D projects and boom it gave me a thorough explanation on how to convert the code to work with 2D projects and send the changes back to me now this code was perfectly usable but I noticed something a little interskine in this line right here the code checks if an object is collided with has the tagman enemy using string comparison and if you know a bit about comparing object tags in unity you may know that this is typically not the best practice out there and it's more optimal to use a function called compare tag so I wanted to put the chatbot to the test again and ask if they can optimize the code any further and it hit me back with this essentially all it did was add an unused rigid body reference to the script now I don't know too much about optimization in unity but to me it looks like this code does nothing at all but please correct me if I'm wrong in the comments the chatbot also recommended that I used is schematic on this rigid body to stop the game which is an optimization I guess but I wanted the whole game to be Frozen when the player dies not just the player themselves so I kind of just ignored this anyways I eventually copied the unoptimized code and dropped it into to a new player script in unity and look even my IDE is disgusted by this string comparison so I just manually fixed it I then spent a few minutes setting empty player object and headed back into chat GPT now I needed a weapon script that would be able to shoot projectiles and also add knock back to the player one question later and boom we had a script but I noticed that I forgot to specify that the code should be for a 2d project and I wasn't clear enough with who the recoil should be added to so with the modification request later we now had a weapon script for the game well almost something interesting I found was that the bot didn't fully convert the code to work with 2D I mean it did here but not here so that was kind of interesting also could we take a minute to recognize that this code right here is at least in my opinion good clean readable code it may be a little unoptimized with this git component con update but I mean if you had no experience with programming at all you could still understand exactly what this code does thanks to all the extensive documentation on practically every line so I just find that truly amazing and there's all always a paragraph or two below explaining exactly how the code works anyways I started setting up this weapon in game and just like that the player can now shoot projectiles and be knocked back at the same time but I noticed that this weapon wouldn't rotate towards the player's Mouse position size chat gbt to modify it and upon putting this into the game it didn't quite work again I realized I forgot to specify that I was working in a 2d environment and now the code still didn't work so let's chat GPT again to modify the code to only rotate the weapon on the z-axis and now it was just really glitchy for some reason so I asked chat jbt like dude why is this code so glitchy and my man responded with some in-depth paragraph about Vector three dot signed angle which is something that I've never seen before in my four years of working with unity it is definitely not how I would go about making this sort of rotation system but surely after this long-winded explanation the code would work right nope it was still glitching out eventually I realized that the code was written to only work with 3D games again even though I specified that I was working in a 2d environment before though I guessed a chat bot just forgot about that part anyways now we had things working finally and it was time to move on to making a projectile script I asked to weigh in the bud delivered this script I also noticed that I actually forgot to specify in my initial request that I was making this a projectile script but somehow the bot just guessed that this was what I was making and named The Script accordingly I mean seriously fascinating stuff but moving on I asked for some modifications to destroy the projectile after a set period of time if it doesn't collide with anything and destroyed the projectile if it collided with an object with deep ground attack this could worked but I noticed that again it didn't use compare tag so I requested it to use it and yeah it worked and changed the code so I fiddled around a bit and now the projectiles would destroy on hitting terrain or an enemy object but we still need a way for the enemies to take damage slice chat gbt to write me an enemy script that could take damage and after some more tinkering the player could Now kill enemies and speaking of these enemies we still need way for them to spawn and I decided to put chat GPT to the tests not only did I won an enemy spawner but I also wanted to spawn these enemies in a random position inside of his certain bounds while increasing the spawn rate over time to my surprise again it delivered perfectly except this time the bot kind of froze towards the end and won't let me send another message so I copied this code but before testing it I was a bit annoyed how it handled the spawning balance system so I copied this script and requested it update the script to use a box collider to visualize these spawn bounds and again the bot delivered and I could ask that this box collider and also requested it to add a few checks so that enemies couldn't spawn on top of each other the player or terrain and now we finally had a function in a response system but as you can see the player could kind of fling himself off the map so to fix this I requested chat gbt to make a smooth camera fall system and you get the deal by now it worked and it worked pretty well too also shout out to chat CPT for being so wholesome anyways next on the agenda I wanted to make a score our manager so the player could score points when killing an enemy It produced this and I was kind of impressed by how they bought made a separate function for updating the score text if I ever needed to use that function elsewhere once importing it I asked exactly how it go about updating the score from another script and yeah it told me exactly how I could do so I also pretended to not know how to make UI and it guided me through the process though my text was kind of blurry so why is it wides blurry and it told me to change the setting but I couldn't actually find the setting so I asked where that setting was and yeah I just kind of gave up and resorted using text message Pro after that I just started setting up the room for the game and now things are really starting to come together one of the final main things I needed to do to wrap up the game Loop was to get the enemies to move towards the player Chad gbt told me to try using nav mesh to create a pathfinding system for these enemies I tried for quite a while but I've never used unity's nav mesh system before and I was really struggling to figure it out even after asking Chad gbt for some assistance so I just had the bot give me a less optimal non-path lining solution but now the game was really starting to come to a close all I needed was a way to restart the game and you know the drill by now with that done I considered Indian development right there but I figured I might as well try to add a bit of audio I asked Chad gbt to make me a shoot sound effect and yeah looks like that won't be happening so instead I asked for some resources to get 8-bit sound effects and it delivered I searched through freesound.org and found an effect I like I also asked for a place to find royalty-free music and I found some on opengamemart.org now we have to set these sounds up in game so I got the bot to make me an audio manager and yeah now the game had audio and now for the final change I actually bought two tweaks the weapon script so the player could hold down the mouse button and chat GPT kind of froze before finishing the code but still I tried copying it and it sort of worked but there is no shot cooldown so I was like yo what's going on here chat gbt I mean it was like I don't know sorry man so I was like the shot timer doesn't get reset and this time it actually finished the code it couldn't be for turns out all I needed to add was this one line so I found that kind of interesting anyways I felt happy with the game by this point so I exported it I'll put it to it and yeah the link is in the description if you want to play it overall I think chat GP is actually insane I wasn't sure if Chad gbt would be able to actually complete this challenge but it did and seemingly with ease I undoubtedly think AI like this will revolutionize Game Dev a ton over the coming years and it's really interesting to see how it approaches programming challenges as many times it approaches things in a much different manner than I personally would in conclusion there's lots to learn and I'm excited to see how AI like this evolves in the future but before I go let's see what chat gbt thinks about my game oh uh okay then
Info
Channel: BenBonk
Views: 777,462
Rating: undefined out of 5
Keywords: chat gpt, unity game dev, dev log, I made a game with chatgpt, chatgpt game development, game development, I let AI make a game, I let chatgpt make a game, AI made this game, I made a game in 24 hours, I made a game in a week, chatgpt code, chat gpt code generator, computer science, game dev challenge, indie game dev, indie game, i made a game, making a game, benbonk, game jam devlog, openai, making a game with chatgpt, making a game with ai, I let ai make this game, game, pc
Id: L6vW0um5XTg
Channel Id: undefined
Length: 10min 32sec (632 seconds)
Published: Tue Dec 13 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.