AI Learns to Play SUIKA GAME

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
okay s game let's get it okay for people that don't know s game is a game that's like with like fruit and and you drop the I don't know it's like basically Kawaii 2048 so here's the plan we need to remake s game because like you can only get it on switch I mean there's this version but like we're not we're not using this version and then once we have a game we'll do some AI wizard to make it play it really well all right game time baby so swier game is basically just like a container and then we got some fruit and that's kind of it okay all right swiy game speedrun [Music] go [Music] and time that's sweer game baby okay there is like a couple more things to add but honestly not that much like we're pretty close we are actually going to have to do some coding here unfortunately okay now we can spawn the look in and we're making progress yeah I know we haven't really done anything yet and uh we literally started this like 10 seconds ago but it's time to make it pretty I'm talking art design art design with codeb art design is probably one of the hardest parts of making a game but luckily I'm not a game developer I'm a YouTuber so instead I'm going to do the very scientific process of watching clips on YouTube and taking screenshots of the fruit oh yeah and I also stole the background up because what what what do you want me to do draw it myself okay so that was easy now we got all the fruit we need to line up the hit boxes for each of them luckily all of these are just circles so it's not exactly a herculian task okay and now we need to write some basic logic when two of the same fruit combined they form into a new fruit so two cherries make a strawberry two strawberries make a grape yeah so and so on until you get all the way to the prestigious watermelon which is like the end goal of this game basically and we should have cherry combining working if two coll you're joking okay [ __ ] this game if two Collide you should get a strawberry yay there we go okay oh [ __ ] me oh no okay there we go I don't know what was going wrong but I just [ __ ] with some values and voila I'm sure it won't be an issue later dude can you not please I'm a good programmer I swear God I hate that guy so we got cherries that combine into strawberries now we just need to set up all the other fruit combinations and we're Gucci all right let's run it oh God no no we are not Gucci that frame rate is terrible I think it is trying to spawn an infinite amount of fruit which is not ideal oh oh I can't stop the program from running oh and I also can't close Unity anymore that's fun that's a fun little feature using a cool 98% of ram that's okay you can have it I wasn't using that oh and it crashed okay well problem solved itself okay let's just hope that we saved recently and nope that's a completely empty scene I have never [Music] saved okay I think we're back where we were and I have saved I saved like eight times so let's run it back oh okay well that makes things easier oh now there's four okay okay it should work now don't explode don't explode don't explode don't explode don't explode oh yeah look fuing C we did it s game [Music] baby so in this game you basically keep going until you lose like there's no end goal you just keep going until you lose and the game ends when the fruit the cloud boy is holding collides with the fruit in the container which I've already implemented and really wasn't a problem no no no no no no that's too many anyway if you amp up the bouncy amount of the this death condition actually makes the game very interesting I call my invention sweer game but bouncy since you die when something collides with the fruit you're holding the fruit bouncing back up at you turns this in sort of like an action game we got to dodge the fruit and the only way to settle them down is to combine fruits which resets their velocity to zero it's actually very fun I actually quite enjoy it anyway what were we doing oh yes uh s game AI thingy video code bullet okay okay I'm ready I'm back all right so even though I just like copied the art I still managed to [ __ ] it up like some of the colors are just a little dull so I wanted to make it more pretty so yeah I did that and here's sort of like a little side by side we got the new fruit which looks like a little more pretty a little more colorful I don't know if you can really tell the oh [ __ ] off are you I just wanted to show off the [ __ ] colors was that too much to ask don't you [ __ ] start Henry you've lost I'm taking these you've lost drumstick privileges okay now that we've got pretty colors and stuff pretty much all that's left is to add the scoring system which once again I did this through the very scientific process of watching streamers and then doing some quick math basically you just get points by combining fruit of course that's literally all you do in this [ __ ] game the bigger the fruit the more points you get and with that I pretty much got this bad boy done ah except yeah well except for that I've um oh I've never seen this before fatal error okay that's a bit much I think you're being a little dramatic look at that score though w a cool 41,000 easy game okay so let's actually have a look at what's going on when everything explodes I've been procrastinating this problem for way too long looks like the big boom thing happens when a fruit collides with two of the same fruit at the exact same time instead of only combining with one of them it tries to combine with both creating two copies of the next fruit tier here's a more controlled version of what happens what we get is two cherries turning into two strawberries which instantly combines into a single grape all in one frame this isn't quite enough to cause the explosion though for that to happen we need the other fruit to sort of give it a little push so in this case it's really this right here that causes everything to go nuclear we've got three cherries which turns into two strawberries which instantly combines with the other strawberry to become three grapes the three grapes continue combining with themselves until they've reached apples in which case these guys joined the party and now [ __ ] has properly hit the fan in a major way reaching a cool score of wow okay it's a it's 2.5 million not too shabby if I don't say so myself apparently reaching 3,000 is impressive so 2.5 million Child's Play anyway explaining that wasn't really that important I just thought it was cool and you know what it's a [ __ ] sweer game video clearly your time isn't super valuable anyway okay nice one that was good Henry I like that one okay basically all we have to do is stop three cherries from becoming two strawberries and we'll stop the apocalypse which is honestly only like one line of code and look at this it works magic and with that we've successfully cloned twer game which is actually super easy like only took me like 2 days which is a little life hack if you don't want to pay for a new game just [ __ ] make it yourself instead of paying the it's $2.99 okay that's extremely reasonable okay maybe just buy it yourself okay now that the game is done it's time to a we so the AI we're going to be using is called the genetic algorithm basically we're going to simulate Evolution to make a smart boy we just test the guy out and then if he's doing good we say he can live if he's not doing well then we we don't let him live it's kind of like squid game really no not at all but the problem is this is running really slowly so instead of just running one body at a time we instead are going to run a couple [Music] more I'd love doing that this is actually hell for my computer this is the frame rate it's actually running at but because I'm nice I'll speed it up for you just because I'm nice not because you would click up the video and [ __ ] my watch time this is a selfless act okay let's run that [ __ ] so initially we only start with the first 10 moves and then once we sort of nailed those first 10 moves then we can move on to the next 10 and then so on so on WE increase the maximum number of moves every five generations which is just I don't know an arbitrary number that I chose it doesn't really mean anything just sort of felt right which is true for a lot of machine learning like it's a very Vibe based art you just do what kind of feels right and then if it doesn't work you change it slightly but yeah it's pretty hard to see what's actually going on here because everything's like two pixels wide so let's fast forward a [Music] bit okay when I at 100 total moves when I ran them with just completely random moves they'd last like 100 to 150 moves but the smart of the AI the longer it should last in theory we got a best score of 787 I don't know if that's anything yeah my B goal for this video is to get a score of at least 3,000 I think that'll be that good that's like the gold standard for what people are like aiming for like it's a big deal if you get 3,000 it would be SI if we got a better score but yeah I'd be happy with 3,000 so we're at like 700 which is not that so we still got a long way to go but that's the best score I can get with the current number of moves they're not dying at this point so we should be able to get a much higher score all right another fast forward [Music] go so we're now at 150 moves and we do have some players dying which is fine that's how the AI works you got to get them to fail in order for them to learn how to succeed that sort of stuff it's like children you got to kill a couple to make an omelet or whatever it is but if you look closely some of them have honey melons and some of them have two honey je melons which is very close to the actually I'm just noticing that's not two honey melons that's just two games with h melons next to each other it's really hard to see what's I'm trying my best okay anyway fast forward let's go and finally after 96 Generations we got it where it's like pretty much not improving anymore we got a best score of over 2,000 which is pretty good uh not really honestly this is kind of [ __ ] no one has a watermelon no one's looking confident in any way but I do have a plan okay that didn't really work it was all right but it could definitely be improved the main problem with this is I just used the score as the fitness function okay let me explain so we got to have a way to calculate which boys did good and which boys didn't do good so we know which ones we have to kill off at the moment we are just using the score so a player gets a better score it's doing better which kind of works but the problem is the position of the fruit is really important in these game these two have the same score but one is in a way better position it's this one it's this one here basically the strategy is you want your biggest fruit in the bottom corner so it's not blocking any of the other fruit and you also want something that I call a fruit chain you want your biggest fruit to be touching your next biggest fruit which then touches your next biggest fruit to form a little chain thing all the way down so you can have cool [ __ ] like this oh no the pineapple still supposed to touch let me me just grab this so you can do cool stuff like this yeah we did it so I just CED a little thing to calculate how long the fruit chain is and scale the score according to that the scale score also increases if the biggest fruit is in the corner um and yeah that's it I've run that [ __ ] for like 8 hours oh honestly his [ __ ] takes so [ __ ] long this has been such a process but here it is I present to you s game SW game whatever it is go [Music] [Music] n [Music] let's go we did it it was actually good oh my God I was so surprised I really did expect a score of like three ,000 um but we got final score of 4,200 something that's pretty good that's crazy we got double watermelons baby there are some things I could add to make it even better I think I need a higher penalty for death because uh at the end it kind of just killed itself it had all this space here where it could have like racked up an even better score I also think I need a higher reward for it staying in the corner cuz it kind of just didn't do that it just kind of [ __ ] off and left um yeah cool we did it let's go thanks once again to brilliant.org for sponsoring this video brilliant is your place for all things math sence and computer science which if you're watching this channel is probably something you're interested in I've talked a lot about how brilliant can teach you how to do all things Ai and all that magic AI algorithm stuff but it also has really useful courses to help you out with game development they have a great course on vectors which is basically how all video games are doing everything all the time if it's a 2d game a 3D game a puzzle game or an Acy shooter thing it's going to be using vectors basically you're going to need to know how to use vectors and Brilliant Vector course is a great place to learn about it and because it's a brilliant.org course this bad boy has got interactivity for days they get you to move around this cute little spaceship guy look at him it's a cute little boy to help explain all things vectors and this is just one course of hundreds of interactive courses which will make you an absolute weapon at Game Dev and computer science in general so if you want to support your boy and level up yeah because the video GES up yeah okay I'm so clever probably because I've done so many courses on brilliant anyway go to brilliant. Cod bullet to try everything brilliant has to offer for free for 30 days and if you sign up for a premium subscription this bad boy will get the first 200 people 20% off you're welcome okay yeah that's it thanks again brilliant thank you for watching um yeah it was just like a little sing game video I thought it was cool it was fun uh it took way longer to do the AI than I thought I had like a lot of problems with unity's physics being a bit but I got it done um yeah okay I'll I'll see you the next one bye
Info
Channel: Code Bullet
Views: 3,424,946
Rating: undefined out of 5
Keywords: artificial, intelligence, coding, processing, java, machine, learning, genetic, algorithm, evolution, computer, science, programming, comedy, educational, suika game, suika, 2048, cute, gaming
Id: QbwgQSwMSGM
Channel Id: undefined
Length: 13min 46sec (826 seconds)
Published: Fri Dec 01 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.