AI Learns to play Geometry Dash || Part 1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everybody although you probably already know geometry dash is a very popular mobile game where you control a square that moves forward by jumping and i kind of suck at it so i want to make an ai to play geometry dash for me but there's one big problem unless i could actually come up with some ridiculous method to take a screenshot of every frame and then dissect information from it there isn't really an easy way to use the original game so instead i'm going to recreate geometry dash from the ground up and i'm probably gonna regret this to begin like many of my projects i created an array to store some tiles and filled it with some noise to test some basic rendering and it works now for this project i need to implement a camera system and luckily i have a lot of experience with implementing cameras having made many different platformers including kirby maker which i will show you guys one of these days anyways implementing a 2d camera is actually a lot more simple than you might imagine i simply created a vector to describe the location of the camera and then when something is being rendered like a tile the camera's position is subtracted from the position of the object and with this in a little camera controller i made we now have a working camera system now currently all of the tiles in the array are being rendered at once but this is quite inefficient especially when the array gets bigger so it's time to add camera clipping the idea is that starting from the center of the screen tiles are rendered on all sides a certain distance called a clipping range this is set on both the x and the y axis and any tiles outside of this range are simply not rendered this can vastly reduce the number of tiles being rendered and even in a simple game like this improve the performance drastically right here the clipping range is quite low to show the effect in action as soon as it's turned up it looks seamless with some of the basics out of the way it is now time to start making this actually look like geometry dash and to start i decided on adding a background now i had a lot of problems finding assets for this game so all i could find was this very noisy image of the background so i spent some time redrawing it [Music] now rendering the background in the game is quite simple the background slowly pans based on the location of the camera and multiple backgrounds are rendered at each other's edges to create a transition once enough are rendered it is perfectly seamless and i even decided to spice it up with a little bit of color too next i decided to add a floor and i repeated the touch-up process with the floor texture as well the floor gets rendered in almost the exact same way as the background except that it's y position also moves with the camera just like any other tile would and just these two things alone make it look so much better next thing on the agenda was to add some physics but in order to do so i needed some basic collision first so i quickly wrote up a simple floor collision and applied it to the ground and it worked perfectly first try confident in my new collision code i decided to add back some tiles randomly on the floor to see if the collision would work on them and of course there was issues all it came down to was me forgetting to adjust the position of the left side of the collision but with it now properly adjusted the collision is now working flawlessly geometry dash is really perfect because there's really only two kinds of collision needed to make the game functional you need some kind of floor collision and then another kind of collision used for hitting anything else but the top of a solid tile we will add the other collision type later but for now i want to make our tiles a little bit more interesting so let's add some textures i created a texture atlas to store some tiles and then i manually recreated a bunch of different tiles from the game to render them a section of the texture atlas is used every time a tile is rendered based on an id that each tile has and with that we have textured tiles after putting a spike in the array i noticed something about it as i moved around it looked very rough around the edges as the camera panned i then realized that when rendering the tile it was possible for a tile to be in between two different pixels at the same time since the position was stored as a float or a decimal to fix this i simply rounded down all of the positions being rendered and it seemed to fix the problem i then turned my attention back to the physics to adjust the jumping to match the original as closely as i possibly could that meant making sure that i could jump a little over three tiles wide and no more than two tiles high it took a long time of trial and error but i finally got it to a point i was happy with going along with the trend of textures i decided to then make a cube texture atlas and rendered a part of the texture to the square just like with the tiles and now it is really starting to look like geometry dash i want to make a level but i need some way to edit the array so i coded a very simple tile editor that also allows me to fly around like before i could scroll through different tiles and place them down and what is nice is when the program closes it gets saved to a custom save file which is just a giant column of tile numbers since i want to be able to change the map size on the fly to make it bigger as i make levels i set out to make the array resizable and there was a lot of issues you see i sort of have been telling a lie about the grid this whole time it isn't actually 2d it's actually a 1d array that is accessible as a 2d array so in order to resize it the memory of the original must be copied into another array and then transferred back to the new array after it is reallocated and that can cause some issues especially when you use the wrong size variable with the array copying code finally updated i now have a way to make a proper level so let's start by making the first level of geometry dash stereo madness [Music] [Music] with the level done i decided to do a quick run through just to make sure it was even possible to complete to begin with [Music] and somehow despite my total bs physics i came up with the level seems to be a hundred percent possible to complete now i'm pretty sure that this level is as accurate as i could make it without all the fancy tiles and yes i did decide to drop the flying sections because i do not want to spend the rest of my life making this mobile game but i still cannot actually die yet so i quickly implemented the other collision to handle actually hitting the tiles and applied it to the spikes and even the solid tiles too but since the floor collision gets called first on the solid tiles only the sides of the solid tile will kill the player but it works and that's all that matters although the three block jumps are quite brutal but adjusting the physics more would just f everything up so it's as good as it can get now i wanted to focus on making some more details so i added some particles but i forgot that one unit is one tile big and not one pixel big so i made a confetti cannon by accident sadly i turned down the velocity to a much more modest amount one strange detail from geometry dash that i wanted to add was how the tiles entered the sides of the screen so i experimented with them being separated at the edges and it has a really cool effect but i wasn't completely satisfied so i tried another effect where it stretched the tiles out instead and it looked kind of weird so i settled on a compromise the left side would have the separated tiles and the right side would have the stretched out tiles and just for the fun of it i turned up the effect really high to see what would happen and it's quite trippy looking after this i made many more little changes and the result is pretty awesome for being a half-assed clone of geometry dash sorry i didn't write the ai in this video but in part 2 i will be but we do now have an awesome clone to use and it will give me quite a lot of power with designing the ai so now i'll leave you with some footage of the final result enjoy and thank you guys for watching and for your awesome support roll the film [Music] oh come on [Music] you
Info
Channel: CodeNoodles
Views: 192,065
Rating: undefined out of 5
Keywords: ai, geometry dash, programming, artificial intelligence, machine learning, educational, coding, computer science, ai learns to play
Id: 6cksxUwmrTw
Channel Id: undefined
Length: 9min 52sec (592 seconds)
Published: Fri Sep 02 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.