How I Used ChatGPT to Make a Game from Scratch
Вставка
- Опубліковано 29 гру 2022
- Source code: bitbucket.org/prjoh/chatgpt-g...
You can try the game here: prjoh.itch.io/chatgpt-shooter
Lex Fridman’s interview of Andrey Karpathy: • Andrej Karpathy: Tesla...
0:00: Intro
1:09: Create a window and render a sprite onto the screen using C++.
1:52: Instead of loading a “sprite.bmp” I want to load a file called “player.png”.
2:10: To load the “player.png” image from the previous example, create a path variable that stores the base path and appends “res/player.png”.
2:23: Can we modify the code to render the image with its original size?
2:44: Write an Entity Component System.
3:01: Can you integrate this code with our previous SDL code and add an input component for the player?
3:27: Can you create a RenderComponent and a RenderSystem to render the sprites of entities?
3:45: I would like to refactor the previous code. Instead of passing references to our component maps in the game loop, I would like to store the references at initialization. Can you show me how to do that?
4:06: You made a mistake in the MovementSystem. Since the velocity components are initialized as 0, the position never changes. Can you fix this bug?
4:17: Can you show me hot to calculate delta time and make the MovementSystem depend on it?
4:38: How can we create an AI for the enemy?
4:49: Please create an AISystem and AIComponent that uses state machines.
4:56: That seems too complex. Let’s forget about it. Instead, create an AISystem that follows the player position. If the AI has reached a certain range it stops chasing the player.
5:34: Modify the enemy AI such that the enemy shoots a projectile at the player once it is in range.
6:02: Show me how to render the projectiles on screen.
6:19: Show me how to implement an attack cooldown for the enemy.
6:34: Can you add a rotation component to the player, which rotates the player sprite and gets modified by the left and right input keys?
6:54: Please change the velocity based on the current rotation.
7:13: How can I calculate the rotation of the enemy sprite based on the difference of the positions between player and enemy?
7:44: Please show me how to implement a ShootingSystem that lets the player spawn Projectiles once the spacebar key was pressed.
8:04: How can we change the code such that we only spawn one projectile once we switched from keyup to keydown state for space bar?
9:04: Let’s add a HealthComponent to the player and reduce health if a collision happens between an enemy projectile and the player.
9:42: Show me how to render a health bar.
10:11: How can we modify the code to show a game over text once the player has reached 0 health?
10:45: How can I play sound effects using SDL?
11:05: Closing remarks - Наука та технологія
Wow, I wasn't expecting it to be so good at c++! Very impressive, especially given the amount of code it wrote and had to be aware of in every step.
Very good video I would love to see more of this maybe in a platformer
Interesting... I never heard of AI writing code before, thank you for introducing me to this topic :D
I think from all I’ve seen there should be a hub for gpt created games. Well done.
Gaming will never be the same again!
The future is really exciting. But at the moment the AI is very limited in some cases like computer vision or embedded systems (which I'm currently working with).
Hello from the future! GPT-4 is so much better that I'm never going back. It's a pity, because I don't want to give OpenAI and Microsoft money every month. It's particularly good if you cut-and-paste all your code each time you ask a question because the machine only remembers the last 5000 words.
Here's hoping Open Assistant can catch up to where ChatGPT was soon!
yooo nice
Cooles video und schon Krass dass es schon so weit mit Ai getrieben wird, Kann es sein dass du deutsch bist ?? Dein Accent hört sich voll deutsch an
can chatgpt write code for future pinball?
hey cooles Video
Now that you've found out about the possibilties of AI assisted work, how will you implement it in your workflow?
That depends on how good A.I is to document the structure and functionality of the code. But it´s a good question indeed.
This is just the beginning...
What really triggers me is that you made chat gtp make you a game and than not implement in the end that you actually won rather than being game over if you take the enemys health to 0.
If you know to much things about what code to use for any function you can easily wright the code by your self ;)
If grandma had wheels she would be a bike!
@@RonIbarra and you end up eating makeroni for the entire life!
so its not something some one without any c+++ knowlegde could do. but I believe the process in extreamly faster right?
I am not a strong believer in replacement of coding skills by using AI. I think what this video shows is, that if you are familiar with programming, the time to get explanations and examples for certain code concepts is pretty fast and the quality is much better than I would have expected. So I would say, anyone from beginner to advanced programmer can hugely benefit of such tools in the future.
yea , you kinda need to know the basics and mostly know what is being done by the code . It's mainly for 2 reasons . First is to debug the code , you need to know what is wrong and why it is . Secondly , GPT is basically your autocorrect on steriods , it doesn't actually understand what it is saying . Although code has logic and thus GPT can actually piece together most things with reason , unlike regular text where GPT has actually no idea what the hell it says, it still lacks comprehension . So you need to be the brain . It's great for stuff you already know and reduces the time taken to do things but if you ask it about topics you aren't familiar with , you can't be 100% sure at all
the "continue" part never worked for me 😭
It comments the Code very well ;) I might wounder if it could comment uncommented code in a proper manner :-D
Yeah it can, even really well in a lot of cases
11:40 but still you have to understand the code
not really sure if it's a good idea to just copy/paste code from AI ... because then what did you learn or how did you exercise your brain as a software engineer?
you learn whether or not an idea is actually worth pursuing before putting your own time and energy into creating a more refined version
@@hiddendrifts that is 'tarded
@@eratera5836 saving time and energy? i'm sure you enjoy doing everything the hard way
@@hiddendrifts yes
@@eratera5836 then what are you doing on the internet? shouldn't you be chopping trees for firewood? hunting wild animals for food? filling up your water reservoir?
ChatGPT must have a better name! I sounds stupid and impossible to say. I told him/her to response to the name Eddie. Fits better. Eddie is an irritating smart and friendly ship computer that just always say too much you already knows. But geeeee thanx for you work with this video.
G P T jipiti. its easy to say. chat jipiti
chatgpt stands for chat generative pre-trained transformer, so it makes sense to put it in an acronym
Actually are you german?
Deutsch
glückwunsch das du dass erkannt hast 😂
half life 3, freakin lost it