1 free read left. Create a free account for unlimited reading + AI research.
Create free accountdo you love making competitive games but you don't have any friends to play with then we have just the thing for you make an absolutely unbeatable AI that will crush all of your hopes and dreams so you never want to play your game again this was supposed to be a simple video about teaching an AI to outplay me in my own game but what came out of it was honestly unexpected shocking and a little bit disturbing this video is proudly sponsored by game maker program I've been using pretty much since I was a child it's the perfect engine for making 2D games for example my indie game will you snail was made entirely in game maker but it's also really great at fast prototyping which is exactly why I'm using it for this project right now you can just try out game ideas really quickly it's super fun it's a great addition to any game developers toolbox actually so even if you know other engines it's just a good engine to know it brings benefits yeah I keep returning to it over and over and it only keeps getting better as well so there's a link to it in the description check it out game maker thank you very much for making this video possible and let me
actually show you what you can do with gamemaker alright so here's the game plan make a competitive multiplayer game Teach an AI how to play it because I don't have any friends and last but not least profit or you know have a fun game with an AI to play against but as we all know this is not how it turned out or it did but I wish it didn't I usually have a very goal-oriented approach to design so I love to start by defining some design goals for this game I wanted it to be competitive I wanted it to be easy to learn but difficult to master I wanted it to be relatively simple so an AI can actually you know learn it but it also should have a lot of expression for skills over there should be a lot of possibilities for different strategies and stuff like that so we can actually see some interesting Behavior emerge from the AI yeah those were the goals and I kind of came up with something instantaneously my my Giga brain just I don't know what happened but you know when you see a
list of goals in front of you sometimes sometimes it just clicks like that I came up with this I totally fell in love with this sometimes you just have these ideas where you know dang it that's a hit game and this was definitely one of those situations every player controls a ball and the goal is to push each other out of the circle and that's it and I know you might be like bro that's way too simple no look closely that's exactly the beauty of it you know they they behave like perfect billiard balls you can transfer momentum you can Dodge out of the way there are so many different strategies it tickles all of my little design goals in a very good way it's very easy to learn it's very easy to understand in other words it's a huge game I made a hit game amazing I figured out the early game was still a bit lacking because the best strategy was clearly to just keep bumping into each other like this so I added a barrier in the middle of the field that disappears after two seconds and I think this allows for a lot more varied
opening strategies now I'm in love okay so let's make our baby a little pretty because I don't want to look at this for the rest of the video you're ugly ugly ugly ugly I quickly made some art in Photoshop taking some inspiration from you know actual billiard with a green playing field and the billiard balls so kind of classy but also modern was what I was going for and after all of that AI talk in the last video I also felt like making all of the sound effects from scratch so I grabbed some objects that I had lying around in my house and quickly recorded um foreign [Music] effects implemented into the game and I must say overall I'm very happy it's pretty it's clean it's simple and it sounds great
and you know from a gameplay perspective I made this in game maker in like one day game maker very fast very very fast oh my God my little baby is so pretty so pretty little tip if you love your game do not do not make an unbeatable AI for it why oh you'll see why so now we have a fun game but nobody to play against which is um not great but we can fix that by making a AI AI yeah yeah yeah my plan was to use neural Evolution or simply explain you could look at it like a randomized math function that takes certain numbers from the game as an input for example the player position or the player's speed and uses that to calculate in our case the movement of the ball as this is a randomized math function at the beginning it produces complete crap and our AI just rolls off the field in various directions so how to fix that we use the power of evolution inspired by
how Evolution actually works in nature we make small changes to our math function and every time the change results in the AI playing better than before we keep it otherwise it dies it dies a horrible death so basically the best math function survive and the other ones die I actually tried this method on a different game before you can find that video on this channel here as well and it didn't really work out but I've learned some new stuff since then so I want to give it a go again you know the definition of insanity is to try the same thing over and over and expect a different result so let's see if we'll get a different result this time [Music] [Music]
wow this Master Level code here should in theory train a couple of generations and then all after each generation tell me how strong they are and for some reason the numbers don't get higher they get lower why is that why does the AI apparently get worse and then uh it goes down no I'm evolving in the wrong direction [Music] so basically just watch numbers go up so that's right that right here is the fitness come on go up you pesky little number and then all of these bars here all of the fitness values from all of the individual AI so we have 100 AIS and the ones with the best fitness survive and these die here generation you can handle it I I can hear you you're sweating I know very
good very good I wanted to leave it and go to bed [Music] so if you think [Applause] [Music] new day you hope you've been busy [Music] nice cool so on screen here we have two of my homemade hard-coded AI number two is the one that just always aims directly at you number one is an AI that just doesn't move at all these two are hard hard-coded no training involved obviously we know how this is gonna go right palm the one that aims at the other one is just straight up gonna win easy peasy and then we can also see the mirror match which in this case is not very exciting wow white wins but here's where it gets interesting because here we have the first trained AI number three is one
that has basically evolved through Evolution and let's see if it can beat our basic aiming AI easy peasy easy clap and the mirror match probably easy clap as well right oh bam hell yeah so here's where it gets interesting remember every new version of the AI managed to beat all of the previous versions so number four can beat number three number two and number one that's basically the entire idea of my training method is I only save versions that can beat all of the previous versions so number four is one that can read all of the previous versions let's see how it does against the previous version easy clap okay let's see how good they get number eight yes yes let's see our strongest Contender give
it up for number 20. I like that these matches are getting longer seriously that is the anti-climactic ending you're gonna give us [Music] who you won that's not gonna work against me though I crash these AIS okay but for that I actually need to do some more coding so I can play against them myself okay now it's me versus the AI okay so the first one is fairly so easy because it doesn't do anything although that's one of the hard-coded ones the second one um is also hard coded that's the one just that just aims at me and I destroyed three the first AI train one but I think it's gonna be pretty easy yeah get out of here
well let's see for how long we can do this 18. oh man okay actually all of these are still pretty lame not gonna lie ah 19 you're a big disappointment I think 20 is gonna be a bigger disappointment as well isn't it clearly something's not quite working correctly even after improving the AI and giving it more time to train the results were iffy at best so all in all a big disappointment I think my main mistake was that I heavily underestimated the complexity of my game on the one hand that's great news because it means my game might have more depth than I expected on the other hand that means I think my neural network is just not gonna be able to handle it at the very least not using my current method okay so I thought if you can't train an AI then let's code one the traditional way yeah I was disappointed as well but turns out the biggest
surprise was actually still ahead of me alright so I set up a little framework where we can write our own hard-coded Ai and first of all I'm gonna show you how the simple follow AI works like very very simple we'll just take the X position of the other player and subtract the own X position and it will do the same for y okay it seems to be working as we can see the AI is following me around and aiming directly at me which is obviously that alone it's not very intelligent yet but I'll just see coding a video game either traditional way you know just hard coding in all of the rules actually as one very big Advantage it requires you to understand your own game really well so it is basically a process of trial and error you try out a couple of different things you try out different algorithms and then over time you iteratively figure out what it takes to be good at your game and then you tell the AI to do exactly that so it really
forces you to think about your game from A New Perspective so there it was the final show match did I finally create other these sparring partner who could take me off horribly to my excellent Mastery of the game we shall see indeed best of seven against the AI let's start okay that was a really that that one it doesn't count that was a really shameful loss Frick I still think I gotta try the exploit where I lured really far to the edge and then maybe maybe I can yeah yeah yeah yeah yeah yeah I almost got it there it was not that was not bad pre-qai two points for the a I'm
yeah yes oh no it's not a yes it's a no clearly is in the aggressive mode which means I pretty much lost yeah here it is I'm telling you this game was really fun before I made this AI now it's not fun anymore how can that be I really loved this game before I left this game so much before I made this Ai and now it's so frustrating oh yeah oh yeah all of those by the way they they do not count here Here Comes Match Point yeah I only needs one more point to win I have yet to score a single point [Music] oh my God I think I had a window there and I missed it no the I wrote us like 200 lines of code so in High inside it kind of makes sense that I couldn't
teach this to a neural network with like 20 neurons this is definitely a topic I'm interested in so I think I'll just have to try a different method next time there's a machine learning game maker extension I'm kind of having an eye on we'll see where my curiosity takes me I guess and oh my God what is that I actually finished the game you can either play locally against friends or you can also play against AI including my unbeatable AI in fact there are seven different AIS you can play against they get progressively higher and harder Jonas finished a game how is this possible the AI is pretty much unbeatable now so I got what I asked for on the one hand I really regret making it because now I can see the flaws of my game so clearly there's not enough comeback potential it all comes down to the first seconds of the game if both sides play well and also it's just not fun to play against this AI anymore it just feels unfair on the other hand knowing the flaws of the game will of course help us to address those flaws in the future for example from here we could add a block mechanic to the game or we could add some objects at the sides that you can bounce off of why do I say we well I have a little bit of a
surprise for you I decided to publish the entirety of this project as public domain so that means all of the sound effects all of the art I made all of the code I wrote is now yours you can do with it whatever you want literally whatever you want you can make spin-off games you can sell the game whatever it's yours it's yours the only catch is that it's only available as a game maker project so if you want to have it download Game Maker give it a go now thank you very much to gamemaker for sponsoring this video I really appreciate it like the only reason why I can publish the game files is because game maker paid me already so I don't care about the rest thank you very much game maker and I hope you enjoyed the video highly recommend you check out game maker and check out my game Brewing in-game maker if you want to do with whatever you want I'm curious to see it see you next one bye
This analysis examines the development of a competitive, physics-based billiard-style game and the subsequent challenges of integrating artificial intelligence to serve as a sparring partner. The project, developed in GameMaker, centers on a simple mechanic where players attempt to push opponents out of a circular arena. The primary design goal was to create a game that is easy to learn but difficult to master, utilizing momentum and strategic positioning to allow for skill expression.
The development process involved two distinct approaches to AI implementation. Initially, the project utilized neural evolution, a method where a randomized math function is iteratively refined based on performance. This approach proved largely unsuccessful, as the AI failed to demonstrate meaningful improvement, likely due to the game’s underlying complexity exceeding the capacity of the simple neural network employed. Consequently, the developer shifted to a traditional, hard-coded approach. By manually programming the AI’s decision-making logic, the developer was forced to deeply analyze the game’s mechanics, eventually resulting in a highly competent opponent capable of defeating the creator.
The final outcome highlights a significant paradox in game design: the creation of an unbeatable AI effectively ruined the game’s enjoyment for the developer. The AI exposed critical design flaws, specifically a lack of comeback potential and an over-reliance on the opening seconds of a match, which rendered the experience feel unfair rather than challenging. Ultimately, the project serves as a case study in how AI can act as a diagnostic tool for identifying balance issues. The developer has released the project files into the public domain, encouraging further iteration and experimentation by the community to address these identified limitations.
Comments