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
  • Наука та технологія

КОМЕНТАРІ • 48

  • @deathflavouredfart
    @deathflavouredfart Рік тому +10

    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.

  • @Finnthedeer
    @Finnthedeer Рік тому +7

    Very good video I would love to see more of this maybe in a platformer

  • @drachenkeks42
    @drachenkeks42 Рік тому +4

    Interesting... I never heard of AI writing code before, thank you for introducing me to this topic :D

  • @vintagekyoshodotcom
    @vintagekyoshodotcom Рік тому +5

    I think from all I’ve seen there should be a hub for gpt created games. Well done.

  • @SusanAmberBruce
    @SusanAmberBruce Рік тому

    Gaming will never be the same again!

  • @theabyss5647
    @theabyss5647 Рік тому +2

    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).

  • @nathanbanks2354
    @nathanbanks2354 Рік тому

    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!

  • @slow-mow
    @slow-mow Рік тому

    yooo nice

  • @maikstroka8569
    @maikstroka8569 Рік тому +1

    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

  • @paulpolizzi3421
    @paulpolizzi3421 Рік тому +1

    can chatgpt write code for future pinball?

  • @daKewin187
    @daKewin187 Рік тому +1

    hey cooles Video

  • @Peter-S.
    @Peter-S. Рік тому +2

    Now that you've found out about the possibilties of AI assisted work, how will you implement it in your workflow?

    • @TrickOrRetreat
      @TrickOrRetreat Рік тому

      That depends on how good A.I is to document the structure and functionality of the code. But it´s a good question indeed.

  • @kassimbabika
    @kassimbabika Рік тому

    This is just the beginning...

  • @paulwoe
    @paulwoe Рік тому +3

    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.

  • @ThermalWorld_
    @ThermalWorld_ Рік тому +1

    If you know to much things about what code to use for any function you can easily wright the code by your self ;)

    • @RonIbarra
      @RonIbarra Рік тому

      If grandma had wheels she would be a bike!

    • @ThermalWorld_
      @ThermalWorld_ Рік тому

      @@RonIbarra and you end up eating makeroni for the entire life!

  • @Knightfire66
    @Knightfire66 Рік тому

    so its not something some one without any c+++ knowlegde could do. but I believe the process in extreamly faster right?

    • @prjohdev
      @prjohdev  Рік тому +1

      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.

    • @aarohanyt7374
      @aarohanyt7374 Рік тому

      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

  • @sumanthprasad9135
    @sumanthprasad9135 Рік тому

    the "continue" part never worked for me 😭

  • @noptrix4273
    @noptrix4273 Рік тому +1

    It comments the Code very well ;) I might wounder if it could comment uncommented code in a proper manner :-D

  • @gameshoot8571
    @gameshoot8571 Рік тому +1

    11:40 but still you have to understand the code

  • @eratera5836
    @eratera5836 Рік тому

    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?

    • @hiddendrifts
      @hiddendrifts Рік тому

      you learn whether or not an idea is actually worth pursuing before putting your own time and energy into creating a more refined version

    • @eratera5836
      @eratera5836 Рік тому

      ​@@hiddendrifts that is 'tarded

    • @hiddendrifts
      @hiddendrifts Рік тому

      @@eratera5836 saving time and energy? i'm sure you enjoy doing everything the hard way

    • @eratera5836
      @eratera5836 Рік тому

      @@hiddendrifts yes

    • @hiddendrifts
      @hiddendrifts Рік тому +1

      @@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?

  • @lennarttranborg6313
    @lennarttranborg6313 Рік тому

    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.

    • @danisob3633
      @danisob3633 Рік тому

      G P T jipiti. its easy to say. chat jipiti

    • @jedsiecz
      @jedsiecz Рік тому

      chatgpt stands for chat generative pre-trained transformer, so it makes sense to put it in an acronym

  • @v3n115
    @v3n115 Рік тому

    Actually are you german?

  • @Toofy43
    @Toofy43 Рік тому +4

    Deutsch

    • @DevonFroggy
      @DevonFroggy Рік тому +2

      glückwunsch das du dass erkannt hast 😂

  • @FrEeWaY7k
    @FrEeWaY7k Рік тому

    half life 3, freakin lost it