Can AI code Angry Birds in AR? Watch ChatGPT try

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in the last few videos chatgpt has helped us code three iconic games an asciard version of Tetris and python Doodle Jump for Android and kotlin and beat saber in unity now these projects have all demonstrated the incredible power and versatility of AI guided coding but we do have one more thing Apple recently revealed the highly anticipated Vision Pro headset proclaiming that spatial Computing also known as augmented reality is the future of technology and that made me wonder can AI code in AR to answer that question let's challenge chat GPT to code another classic mobile game in unity but this time we're doing it in augmented reality can Chachi BT make me an AR developer so I asked chatgpt to code Angry Birds AR in unity and this is what happened sorry you have been blocked what oh I forgot I have to turn off VPN chatgpt provided a step-by-step guide to coding in angry birds-like game in augmented reality the rules are still the same chat gbt writes all the code I just copy paste and debugged till the game is done by the end I hope to have something that I'll be able to run on the Apple Vision Pro headset when it comes out next year rest in peace to my bank account step one Unity scene setup first I created a new Unity 3D project for the game assets I searched sketchfab and found an asset I could use for the Angry Bird seems pretty angry and the pig I made some minor adjustments to the models in blender then exported them to the fbx 3D format and imported them into Unity then I applied the textures and adjusted the scale in blender I started to model a basic low poly slingshot first I switched to a front orthographic View I added a cube entered edit mode and selected merge to Center to get a single vertex I added the mirror modifier so I can make the arms of the slingshot symmetric I added the skin modifier and a subdivision modifier to build out the body of the slingshot at this point we kind of have a low poly sphere to work with I moved up the cube to give space for the base of the slingshot then I simply used the extrude tool to build out the shape of the slingshot and just like that I had a basic slingshot model I exported the model to the fbx 3D format and imported it into my Unity project to create the levels I used the cube primitive game object in unity and made them into rectangular blocks I created a material with a simple wood texture Image level 1 was based on the first level of Angry Birds AR Isle of pigs level two is based on the first level of the original Angry Birds level 3 was my own creation All Glass Blocks just for fun and now let's get things working in augmented reality step two AR support first I asked chat gbt how to set up AR Foundation I added the AR Foundation package since my primary device is an Android phone I started with ar core but planned to switch to iOS later once the game is ready I set up the AR scene by placing the slingshot in front of the camera and the level blocks facing the camera to initialize the AR framework I needed to add the error session game object to my scene along with the AR session origin that helps align the virtual objects in the real world next I added the AR camera so that we can render the mobile pass-through camera view then I deployed to my Android device and quickly had my AR passer video feed working The Next Step was to use the air framework's ability to detect flat surfaces on which we can place our game objects I asked chatgpt how to do this and it pointed me to the airplane manager component I added the airplane prefab to the scene and provided it to the airplane manager so it could be used to draw the plane outlines I set the plane detection Direction horizontal Chad GPT provided code for the plane detection controller which automatically detects flat surfaces and draws a default plane outline Chad GPT also created the plane placement controller script that allows the user to select one of the detected planes so that we can then place our game at the center of the selected plane looks good now that AR is working we can work on making the bird fly step 3 slingshot mechanics I asked chat GPT to provide code that handles the touch and drag on the screen to initiate the pull of the slingshot chat gbt provided a slingshot pull controller script that uses the unity input class to detect a touch and drag event the code to launch the bird apply to force to the bird's rigid body component in the forward Direction so I added a rigid body to my bird's prefab eventually I got the bird shooting forward in a straight line I asked Chad GPT to update the code to rotate the slingshot to the left or to the right depending on the drag direction we know that in Angry Birds the bird falls in Arc trajectory Chad gbt provided code to create trajectory dots using semi-transparent spheres the dots are positioned using time velocity and gravity to calculate the arc path I asked Chad gbt to provide code that launches the bird along with the same Arc path as the trajectory dots we ran into issues when used gravity was enabled as the bird would immediately fall Chad GPT updated its code to apply a continuous vertical force with Force mode.force to offset the pull of gravity the launch force is applied with force mode.impulse in the direction and angle of the launch as time progresses the launch force will dissipate and the force of gravity will pull the bird down along the desired Arc path the next thing I wanted to work on was the sling of the slingshot I asked chegebt and it suggested using a line renderer to act as a rubber band it provided the code and I did get to a somewhat workable solution but it was kind of janky and I figured I could probably do something better so I jump back into blender and modeled the sling I used a cube and shaped it into a thin rectangle for the rubber band I subdivided the band sufficiently so we'll be able to deform it later then I used the skin and mirror modifiers to help extrude the band to wrap around the arms of the slingshot I brought the new slingshot model back into unity and made sure everything looked okay then I wanted to add the animation of the slingshot pulling back I used blender shape keys and created the default shape key before modifying the mesh one gotcha here is you need to apply all the modifiers prior to adding shape keys to ensure the correctness of the exported model in edit mode I hid parts of the band that wrap around the arms then I use the proportional edit to select some of the middle vertices of the band and pulled them back this created the stretch band look now in object mode I could see the shape key animate from the default key to the pulled sling I exported the fbx with the new animation and imported it into Unity chat gbt taught me how to get animations working with an animation controller Chad gbt also gave me the code to update the current animation frame based on the pull distance of the touch and drag after all that work I was pretty happy with how the slingshot ended up turning out step 4 physics simulations the great thing about using a game engine like Unity is that physics are built in I simply had to add rigid body components and box colliders to all the game objects in the levels then the objects obey the laws of physics so when the Angry Bird strikes the blocks they will fall over based on the impact Force when a block gets hit we want it to break into pieces and for there to be a cloud of dust I grabbed some particle effects from the unity particle pack then quickly had a wood breaking particle system in a dust cloud that I could use I created a glass particle texture and we just as easily had a particle system working for the glass blocks as well I finished up by adding a trail for the birds launch using unity's Trail renderer and a texture with a few feathers on it looks pretty good step 5 scoring and level progression when the bird collides with a block or a pig we want to show a pop-up with the scoring value I decided that destroying a pig scores 5000 points a wood block gives 500 and 100 for a glass block you need to destroy all the pigs in the level to progress to the next level you only get three birds per level Chad gbt provided a score manager script that would encapsulate the scoring logic in unity I built a score display that will show the star count the level name and the score after the level has completed the score display uses the UI canvas in unity with text mesh Pro I added a restart button to redo the level in a next button to proceed in I created the level selection screen that we'll use once we select the play surface on app launch once scoring and level progression was done we had a pretty functional game but something was missing things were just a little too quiet step 6 audio I found some sound clips for the slingshot pull the bird launch and collisions chat gbt created an audio manager script that would manage playing all the sounds I added the audio manager game object reference to the slingshot pull controller the block controller and the pig controller so they could trigger The Sounds at the right moment with the sounds working I was pretty happy with my Chad GPT powered Angry Birds game this was another successful project pair programming with the AI step 7 let's play but first as promised I wanted to get my iOS build working so I switched Platforms in unity I activated the AR kit plugin in XR plugin management and requested the air kit permissions I hit build in unity and it generated an xcode project once I opened the generated xcode project I just had to enable developer mode on my iPad Pro before I could build and deploy I also needed to sign in with an Apple ID to get automatic app signing to get a working build build successful wow thanks to chat gbt and unity I was able to build my first IOS app super quick to celebrate I figured we might as well play my chat gbt Angry Birds game over at the Apple Store I really hope to make a part 2 of this video one day when I get my hands on the Vision Pro headset so that we can use hand tracking to pull the slingshot let me know in the comments if you'd like to see that [Music] thank you foreign [Music] thanks for watching don't forget to gaze and pinch that like button and hit that subscribe button for the YouTube algorithm peace
Info
Channel: why not code?
Views: 865
Rating: undefined out of 5
Keywords: games made here, candlesan, game development, Chat GPT, ChatGPT, GPT4, BadGameDev, Game Dev, Making a Game, Unity, How to Make a Game, ai, artificial intelligence, ai programming, chatgpt flappy bird, chatgpt game, chatgpt coding, flappy bird, Can AI code Flappy Bird?, ai coding, Can AI code Minecraft?, using chatgpt to make a game, virtual reality, meta quest, vr development, angry birds, angry birds ar, augmented reality, apple vision pro, visionos, arkit, arcore
Id: jKbTPdiOXxc
Channel Id: undefined
Length: 10min 3sec (603 seconds)
Published: Wed Jun 21 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.