Transcript for:
Parkour AI Development Overview

so I just received a threatening comment on my latest video as cool as it is the title is misleading because it's not really artificial intelligence command blocks don't have that capability I really enjoyed the video regardless but blah blah blah blah I'm not trying to be mean to this one guy in specific because I bet they're a really cool person and all so I'm being mean to everyone every single person who said my printer isn't an AI even though human replication counts as an AI you act like I just threw that term in the title for no reason even though kind of did fine fine I get what you mean you want an actual created intelligence inside of Minecraft that could learn adapt and rewrite its own code to simulate human capabilities but command blocks don't have that [Music] capability get the out of the room and play Minecraft all right so in case it wasn't obvious AI have to serve a purpose so I built this beautiful ugly little Dojo here because I wish to build a parkour Master AI I want to create an AI that if it were to start over here at a set spawning location you could build any parkour course around it and it would somehow learn by itself and find its way through it to get to the end while still simulating normal player moving kind of like I am now to get all the way to an end location that is placed where you want the track to end but we are not going to be needing that anytime soon I don't know if you realize this but this task is going to be utterly insane pain probably a good place to start is add a start button to start the stupid process from there we can now summon an armor sand for its body so when the button is pressed we now have the AI this is the sucker that's going to be getting thrown around till it learns how to not just sit there like an idiot and somehow solve its way through any cords that's put into oh and for those in the audience with uh working eyeballs don't judge the gorgeous cute little head I put on the armor stand it's for Aesthetics you know the way I plan on getting it to move is by doing commands like uh this one here which set some motion value so whatever you want so you're able to throw around mobs and acds which is pretty funny but if we are able to harness that strength we could get it to move like a person would so if I as a player could jump this amount this scoreboard I made on the right counts the peak height of that jump I just did now I just got to do that command on the armor stand and find out which motion value gets the closest to that number that is definitely not it how about this nope that was a small jump come on this has to be close oh oh shoot did I I just got a spot on that was perfect so now we could put that as the height here and try and make it move forward now so if I at max strength could jump around four blocks if I screw around a bit maybe I could eventually find a value similar to the that was terrible Jesus what if I do exactly one uh that really just made the jump okay is that really the perfect number oh yeah it is I can't re tribl jumps either but although these numbers will be very useful later on they currently only work for one type of jump let me explain now before I begin I would like like to apologize in advance for all the terminal brain rot that may result from all the AIDS I'm about to discuss you see this motion command I was using earlier only works as a 3D Vector so the only possible way to make it move is by using XYZ chords we already found out that the Y is 0.42 so we could just kind of don't care about that for now but for the x and z if we wanted to maintain a realistic jump distance we can create an imaginary circle around the Armand showing its furless jump limit now the only jump that we could do right now is this jump that goes from here to here that's only one degree there's still 359 other degrees we need to get to so the equation that we've actually set ourselves up for is to use the unit circle the unit circle states that where it's at right now is zero coast and-1 c now although that may seem like complete squat honka Danka this number is actually very useful that means if we want to get here on the unit circle we would have to put exactly zero for this value and one for this value which is actually what we did already to get there okay but let's reset a little bit this method then becomes a bit a because let's say you want to jump to here at 73° well that means for that direction I would have to put 0.292 for cosine and 0.956 for sign which means I need to find all those silly little synos numbers for every single degree hey uh back to Nal point of view again hi um I actually don't want it to only be able to go in those directions I needed to begin creating offspring of itself capable of going in each of those directions and then learning which position is best uhhuh we're already getting to AI time so over here I'm going to build a big fat little command block tower Yep this is a good height build it all the way up yes this is a very small Tower indeed each command block inside this Tower is going to be in charge of summoning one unique armor stand one for all 306° so that's why there's so many command blocks here and what we can do inside of them is make it so they spawn in with a tag representing what angle they'll be going in and also I can make them spawn with the motion already attached this is the one that makes that jump over there so when I power it it makes that jump over there wait what why why did it go over excuse excuse me I swear I'm tripping how the hell did that not work huh wait it actually does huh this is when I learned for some reason summoning motion is different than modification motion meaning this beautiful one radius digit from earlier goes out the dang window because apparently the summoning motion equivalent to one modification motion is 0.65 so ignoring that annoying setback I created a little python code that turns all 360° into 360 s cosine Fork Clift I don't even know what integ that have a radius of 65 now so I can then spend the next 3 hours of my life going through and individually putting each one into its own unique command block I'm not going to lie when I say this process was ranked a big F 11 out of 10 on the what the hell am I doing with my life scale oh my God that was terrible but hey unless I drastically screwed something up if I place some Redstone here this should be beautiful oh my God oh my God look at this garbage I made a perfect damn Circle filled with old men armor stands right here I like to see Mr Cat do that all this works perfectly look all the armor stands are actually able to make the jumps they're supposed to make and somehow my PC isn't on literal fire but now you see there's like a 360 sacks of old men just laying around here this isn't good you see because we need to find out which one of these actually landed the best at its best placement first we should probably get rid of all these ARB handsand that didn't even make the jump so if I fill this entire underneath layer with diamond blocks and just make a command block that kills all the ones that have Diamond negtive -2 blocks underneath it so it gets rid of those useless suckers and we still get to keep this cool floor design now we need to evaluate all these bozos that actually succeeded in their life by making a single jump so we can find out which pattern to remember and for this I'm going to be using something called uh reinforce learning and if you're like me I bet you've never heard that term before uh a few moments ago so what I'm looking for is to reward all the armor Sands closest to the center of the block because that means it'll probably be the best armor sand for the next jump after it now typically finding out which Arman is uh closest to the center is uh an easy task but we're working with godamn command blocks so so uh first we're going to have to do math inside of Minecraft what what the hell math in Minecraft M yes so what numbers we have first is a scoreboard tracking the x and z positions for all the armor Sands and what we can do is scale that to 1,000 so we get them nice precise digits now we need to make another two scoreboards to track x and z but these ones won't be scaled cuz now if we multiply these next ones by 100 we can now subtract them from the original x and z to only get those smaller digits I know I'm yapping a lot here but listen up because right here on a block is exactly 0.5 of a block we want to find out which one is a closest to it so we can now take the new modified x and z and subtract 500 from all of them uh-oh we now have negative integers now that is garbage so to get rid of all those negative bastards we can now multiply negative 1 to all the negative 1 to reverse the negative negative negative negative why am I saying negative so much and there we go now we can then add those two bad boy scoreboard together and now very simply do another operation that kills everyone that does not have the lowest score leaving only the one closest to the center baby now I could give that sucker a tag so I can identify it moving forward I give it the tag name Fred because uh I thought Fred was a wonderful name for the AI so now by connecting all that garbage matth to the 360° summoning Tower we now have a function for reproduction and selection which is what I call it but it's actually called a fitness function in technical words making me able to do this as set Redstone boom it can now run a little jump and I could reset it Jesus this is so scuffed and it could continue making jumps what I'm doing here is essentially running an incredibly scuffed version of the AI so far if you would even call it that because not only is it not making these jumps really on its own it's also not One Singular armor stand that would be going from start to finish because currently it's still pissing out 360 baby Freds every single time it wants to move so let's begin working on a self-building brain that creates its own memory I don't know was it Einstein that said Mass has energy some eal mc² type stuff I don't know because how I'm going to get the AI to remember stuff is by using physical space within Minecraft to periodically neatly tell the AI what to do in order to learn and not be terrible and if if I do this we now have an armor stand that will monitor which jump we're on because each one of these boxes here is in charge of remembering one jump and if each box is a jump then the time armoring can just keep going that way for eternity measuring infinite jumps and now because each offspring is given that directional tag from earlier we got to get it to look for who has the Fred tag and one those directional tags and that's going to be a little bit of work so I began building another chain command block tower but this one is going to be in charge of testing which survive and I know the videoos in that time lapse right now but if I just pause that real quick you can see I'm actually doing absolutely nothing right now inside the command block besides changing this stinky little if statement to match each degree and I basically just continue doing this for all 360° all right we now have another command block tower how did this happen I'm not fully sure but the reason all these command blocks are empty and only has half the code they're supposed to have is because I want the second half to be in charge of putting the instructions into the time boxes over there instructions where are we going to get instruction from currently nowhere because I haven't done that yet leave me alone let me go into another time lapse and I did just that I recoded the python script to give me the cosine and S of the unit circle again but with the radius of 1 instead of 0.65 because yep I'm building another Tower but this one's fancy though because each one of these command blocks are in charge of when it's powered to individually modify the motion of the armor stand instead of spawning in new ones just like what we originally did when starting off this video and now that that's done I can begin going back to this other incomplete Tower I built and begin putting in the Clone coordinates for each of the command blocks that makes up this other Tower so whenever a Fred armor sand survives its respective degree command block clones over this Tower over to the memory block that's currently studying I also set it up so after every generation it detects if there's a block negative 0.1 y underneath the thread armor stand so it NOS to begin setting the next jump and it moves the time arm sand upwards I also did a bunch of other coding stuff but do you really want to hear me talk about that no probably not I just got done setting up all that Shenanigans I want to die and now I built four moronic buttons that allow me to control what's going on so let me display each one of them and let's see if you could spot the very very nonobvious issue with what we have so far starting off we have the train button begins training and going around to learn what the hell the course is about with only very subtle amounts of lag to go along with it and as you can see as it's moving it's pooping out a memory function after every jump it makes so now if I click the stop training button and if I flick this lever it begins individually going through and activating its own memory chronologically now here if you look very carefully at the armor Sands movement you may see the issue I'm talking about oh ohoh do you see it yes good job it currently decides to just settle with the jump it just made and keeps going back and forth instead of continuing progress that's terrible this sucks it's stuck in an endless loop of forgetfulness ah all right I did something and it better work it's going it's going and it has cured its own diena let's go now it's finally wow it's really going on its own I you know this is actually kind of sick you see basically how I got over this issue is everywhere it moves it's placing an invisible armor standand before it jumps elsewhere so when it's doing its selective breeding process it eliminates any of the ones that are at or around the remembered spot so it never bothers repeating that step in movement thus allowing it to do the course but that's only for this course you see if it was a different course and it had a simple jump like this it would not be able to make the jump it would fail because it would just keep jumping over and never actually being able to make the jump because it's currently only able to make jumps equivalent to that of a max player Sprint jump and that's pretty trash so we got to allow it to make other kind of jumps it's 3:00 a.m. why am I still working on this okay okay so what we can do after performing the regular max strength jump is if none of them survived we can do it again but after three Redstone tick it's going to set all the generation's Motions to zero so it stops their movement midair and hopefully they land on the next jump and if none of them survive then it's going to do the same thing again but with two repeater takes before resetting the movement to zero and then one repeater take before setting them all to zero and then hopefully they land on a block and if not then I touche I don't know that should be working now I had to recode so much of this garbage so it better work ah ah yep it's resetting itself till it finds out not to go there oh good job old man Fred you're also making sure to poop out which strength of the jumps make the jumps work look look good job good job Fred all right the training has gone on for long enough a oh my fr are back a now how good is that we're playing what it's remembered oh it's going it hasn't missed any jumps yet it's almost at the end wait it's it wait it's just standing there oh my God it's because even though it can stand there it doesn't recognize that there's a stupid block underne oh my oh all right so I set up a new Jump detection thingy and that is if the motion of Fred is completely zero for all three vectors here meaning it is completely still that should be enough to make it go to the next jump all right it has memory let's see if it can play it now oh my God what the hell is that that is not what I wanted to do all right all right I found out why that did not work and it's not even on me it's on Minecraft look see for some reason Minecraft sets a motion MBT to zero during the second half of the jump even though it's still moving in the air which means it starts to new Jump while it's in the air so uh thank you Minecraft y'all I screwed around a bit and I found a better detection system but to explain it I'm going to have to go into replay mod real quick so basically if the negativ 0.1 block detection decides to suck and not actually activate the new Jump it Powers up these backup command blocks which checks with the armor sand at these eight points where it could possibly be staining because under each of these points there's another three points to check if the block is a stainable block firstly this bottom one looks for an actual block and these top ones then look for air so it can detect if anyone of Fred's toenails are touching on top of a block that it is a possible stand will jump then it activates all these command blocks which continue pushing the time armor sand forward to read all the new memory storage is and now the memory replay is working beautifully but there is a small issue I want to address and that is currently if you're training and once it reaches the end of the course it begins having a complete aneurysm because it doesn't know what's left to do in its life so uh let me just do a mhm now it knows to shut up once it reaches the red wool because that's what I'll use to tell Fred that it reach the end of the course all right I have a stupid idea what if we expand the memory because currently you can see that there's no limit to it but we all know that's only as far as your car to render so what have to make it remember more or we just clone it that way uhhuh mhm I haven't uploaded in over 2 months all right let's give a look Jesus Christ that is a lot of memory oh my God all right turns out this new memory could hold 48 jumps of memory that that should be good enough Jesus my PC is having a stroke oh I think my Game just crashed and how it works is at the end of every row I put a little diamond block here because typically after every movement it just goes forward by one but if it senses a diamond block is under it then it resets it all the way back to the next row all right if I screwed something up then that's going to be the end of this world I built this giant parkour course cuz I think it would be kind of cool to see how the AI goes about deciphering how to navigate it so I hit train and gave it some time and it was able to power its way through this entire course quite satisfying watching it go around it's like watching my half-minded split brain child try and go through a jungle gem there's something really cool about this little area here because being here you know it's where the ai's mind is all right so epic cool we now have a parkour AI that can do parkour wow sick I believe I could add one more feature that will make Fred even more powerful and that is the ability to forget because you see let's say this parkour we built here has a split jump to the left and let's say Fred decided to go this cool quirky new way but it just ends up being a dead end and there's nothing there well what the hell do we do besides allowing the AI to go back and back and back and jumps till it realizes is that there's a different pathway could have gone and I think that this is possible by creating a new scoreboard called Alzheimer's and what we could do is halfway between this process here and so allow it to set all players Alzheimer's values based on how many of those invisible armor sand thingies that we created earlier are out there which tells us which jump we're on and we can do this by saying for each one out there we just add one to the scoreboard so now we can just do an operation that sets the individual Alzheimer's value score for the memory Armand that just got spawned to be equivalent to the current Alzheimer score the players on so it knows what order it's been placed in so that now we can begin going back in time let's say if the max jump strength doesn't land after two Loops then we could assure that it's a dead end and to place a redstone block over there which will power a function which subtracts which jumper on by one then completely wipes its own memory for the spots on it right now then sends the armor sand back by one divider and then reclone over the reproduction function and it keeps the memory armor standand ahead of it so it knows not to just go right back to the dead spot it was just at and I think the Alzheimer's function is done all right I swear to God this Alzheimer's function better work it spins in into entire extra day just putting logic into this stupid thing all right Fred's going now I hope it goes this way so I can test it oh yeah all right it's stuck now so it should be completely screwed come on realize it come on I want to see if this works oh yes it went back a single jump and and another jump uh-huh look how it just erases the moves from its replay memory sick and it has now reached a proper end that is insane that is so cool but I'm going to be honest I'm extremely cooked but because I got the whole forget and never remember system to work I want to screw around and have a little fun with the AI a little construction later all right so I just made this beautiful scuff two floor maze don't mind that the bottom floor is exactly like the top floor I just cloned the bottom one above because I couldn't be bothered making another floor so how it works is it goes through here it comes out of here and up this little staircase in the back then it comes up to the second floor keeps doing random maze stuff and then it should reach the end and just to make it even more stupid I'm actually going to leave this version of Minecraft so I could swap over to the new snapshot hopefully not break the world when I join all right there the reason I'm doing this is because in the newest snapshot there's a new SL tick command and if I do this instead it's a 10,000 we're currently going 500 times faster than the normal Minecraft running speed and now you may be able to see what I'm trying to do here which means my boy Fred over here should be able to solve this maze 500 times the speed of a normal player this is so stupid the odds that this crashes the world is huge so let's give it a shot oh oh my God it's going so fast jeez I don't know if I would call this 500 times normal speed but wow it's so fast why is this world somehow far less laggy with the newest snapshot than with OptiFine I wonder what the command block output is saying right now oh Oh my Jesus Christ it's going so fast every single command that's being entered is inside the chat right now this is so gooded oh it's reached a dead end and now it's got to come out no I got I got to turn off the stupid command block output thingy you know Fred I'm not saying that you're a testament for how good my AI is but get out of the damn corner it's making it way around trying to learn every spawn in the Maze so I'll give it that at least come on you're almost to the staircase come on oh my why wait why is it like going over there more I guess I just liked it over here more there is so many memory armor TS around this entire floor oh boy come on Fred you're at the staircase yes keep going keep going don't you dare stop now please what no it's on top the first floor wall oh my God all right we're back where we were I fixed the maze keep going there we go and now it's going to begin learning this entire top floor yep just go and get stuck in another Hall oh my God Fred why bro why are you doing back down there you know what I'll give it a moment look it'll go back up on its own come on see there we go it's smart I told you now just keep going forward and why are you back down there again oh it went back up okay that's good yes you're so close to the end just keep no why are you going that way the end is right there what are you doing over here and Fred you just fell down again okay come on quit your nonsense okay finally it went back up up again you're right there just go to the end it's right there yeah yes yes I made it I made it why is it still producing Offspring no stop yes oh my God it actually oh my God I'm so surprised that that actually worked and look at all the memory it is captured to complete this maze this is actually insane you know what I wonder if I'm the first person to have ever built an AI within a video game using the video game I'm not doing the research if there is someone else but that's pretty interesting what's also pretty cool is I came up with all this and how it would work during a single walk going to school walking that day was kind of worth it but whatever if you want to play this map I posted the World download link in the announcements Channel and my Discord links in description and if you enjoyed this video I would greatly appreciate it if you were to subscribe please pry please pee