Unbeatable AI Ruins My Game
➤ Thanks to GameMaker for sponsoring the video - Download GameMaker for free and start today: opr.as/GM-Jonas2
➤ Download the BROINK project files from Git: github.com/LooveToLoose/BROINK
I made a competitive PvP game. Then I realized I don't have any friends (who can beat me) so I made an unbeatable AI to play against. Let's just say I learned some new lessons here. Be careful what you wish for, it might ruin your game. Lol.
Besides that, this billiard like game turned out surprisingly classy and fun, so I decided to publish it as public domain (or CreativeCommons0 to be more precise), so you can do with my game files whatever you want. I'm curious to see what you come up with (see link above).
I hope you enjoy the video!! Thanks for watching! :)
#gamedev #indiedev
Пікірлер: 310
➤ Download GameMaker for free and start today (sponsored): opr.as/GM-Jonas2 ➤ Download the BROINK project files from Git: github.com/LooveToLoose/BROINK Enjoy! :)
@xspvv
Жыл бұрын
hi
@thvist
Жыл бұрын
You're pretty inspiring man!
@nolram
Жыл бұрын
Could you provide a binary build too ? Since one may want to play it without owning GameMaker :)
@JonasTyroller
Жыл бұрын
@@nolram Just uploaded a windows build to itch a few minutes ago. :)
@nolram
Жыл бұрын
@@JonasTyroller Thanks !
one hard thing to consider about ai enemies is that to keep them fun you often need to factor in human reaction times and make the ai have a 250ms input delay to counteract that. but also make it think 250ms ahead *pulls hair out
@JonasTyroller
Жыл бұрын
Lol. That is a very interesting point. You're right.
@alansmithee419
Жыл бұрын
I'm not sure reaction times are going to be really important in a game like this. Yes, humans have a ~200ms reaction time to single sudden events, but when a system is smoothly evolving (ball rolling on a hill), humans can potentially react to things before they happen simply because we can predict how the system will evolve in future (this is how you can catch a ball for example). So while this is definitely relevant to this game, I don't think the AI gets a huge advantage by being able to react nearly instantly.
@HiddenExp
Жыл бұрын
@@alansmithee419 Good point too
@vinsplayer2634
Жыл бұрын
@@alansmithee419 No, the comment considered that, which is why it suggested making it more like a human; Add a reaction time, make it think that much ahead.
@alansmithee419
Жыл бұрын
@@vinsplayer2634 That's not what a reaction time is. Also, the AI can already do that. This is the point of giving it ball position and velocity information - so that it can act based on how it thinks the game might develop in future. It will think further and further ahead the more complex the AI is made (within limits of course). What they were saying is that the AI should have a 250ms input delay, the idea being that the AI should not be able to react to what is happening now because a human couldn't. What you are describing is having it respond *now* to what the *future state* of the game will be. This is like... the exact opposite of what they said. And as I explained above, it can already do that.
You should re-train the neural network, but start it fighting against the 'unbeatable ai'.
I think it would have be fun to include a match of the final ai playing against itself
@JonasTyroller
Жыл бұрын
Ohhhhhhh. Missed opportunity for sure.
@revimfadli4666
Жыл бұрын
@@JonasTyroller hey it's extra content for another vid ;)
@lietajucemaciatko383
Жыл бұрын
no, they would be mirroring each others movements
@NinjarioPicmin
Жыл бұрын
@@lietajucemaciatko383 yeah sure, but you could still try things like offset them by a fraction of a pixel and such things or even start them in wildly different positions just to see how their strategies work against each other
@Arcann_bhp
11 ай бұрын
they would just mirror each other since the code is the same, worst case they just gonna point at each other.
It's actually really wholesome for you to get sponsored by Gamemaker!
@JonasTyroller
Жыл бұрын
Agreed, so far they've been lovely corporation partners. Vewi gut. :)
Is it just me or is the Jonas crazy factor through the roof in this video... LOVE IT XD
@JonasTyroller
Жыл бұрын
The crazy piles up when making more serious videos I feel. :D
@Floky
Жыл бұрын
@@JonasTyroller You know, a year ago, after you've inspired me, I started my game dev and KZread journey... And I have to say, slowly game dev and KZread are driving me crazy too... So thanks for pulling me into your insanity I guess 😂😂
@Floky
Жыл бұрын
@@crazyreaper2673 Thanks!!
@thehansboi
Жыл бұрын
Yea the crazy factor here was hilarious
@bananagod3929
Жыл бұрын
@@Floky didn’t know you were here
I think the first AI approach would have worked just fine, the problem was that the game was designed so that not loosing was the only goal of the ai, and it technically didn't lose by not playing. This is a very classic senario when you work with 'real' AIs. You you might consider some form of reward/punishment system that is tied into acceleration. :)
@JonasTyroller
Жыл бұрын
I measured the fitness by how long they survived against all of the previous AIs. If they managed to beat the previous AIs I measured their fitness by how quickly they managed to do so. I think the neural networks I used were a little too small to learn more complex behaviors. Also there seems to be a really unfortunate local maximum cause it's a pretty good strategy to just aim for the center, so the AIs kept falling into that, unable to evolve back out of it again.
@ozzi9816
Жыл бұрын
@@TheRealLimerockbaby AI coder’s first alignment problem
I seriously love how you can keep making such high quality entertaining content while slowly descending into madness lmao. Huge fan of your work
@JonasTyroller
Жыл бұрын
Thanks... I guess.. :D
I think one part of why the trained AI failed is because it trained against itself right. Because each level of bot only needed to become a little better than the previous bot, the growth stopped going so fast at some point. maybe the bots "learned by heart" a strategy that was flawed and then only improved on that because all the previous bots use it. like the bot can beat its enemy only if its a worse version of itself, which also uses the flawed method. What if you put an AI to train against your hardcoded AI, that you know is better than you?
@glerg6051
Жыл бұрын
This exactly!
@revimfadli4666
9 ай бұрын
So the training algorithm could be improved, such as using evolution strategies rather than genetic algorithm
I’m convinced that Jonas records and keeps a bunch of stock footage of him doing random silly things so that he can use it in videos when appropriate
Would be interesting to see how the AI would do with some noise on it's output or if it had human limits on the input
@JonasTyroller
Жыл бұрын
The unbeatable one? Yeah, something like that would probably be more fun to play against, agreed. For the version of the game I finished, I made some "nerfed" versions of the AI as well, but I went about it a bit differently, simply messing up some of its values or disabling some of its features.
I guess the neural network brain didn't work because it had no idea what the hell was going on! Besides self position, it should get the enemy's position as well as "distance to circle" so that it would learn how effectively it just pushed the enemy to its death. Also, "elapsed time" is another input that will help it learn about the shrinking circle much faster. Poor thing was playing with its eyes closed!
@revimfadli4666
Жыл бұрын
Yeah, it's a 1v1 game after all, enemy data should be trivial
I didn't knew you could actually train AI in GameMaker. Congrats on being sponsored by them! :D
Ohhhh yes! The jonas-style devlogs are returning! So glad
I'm thinking of how to make the opening more interesting. Which should give you a fighting chance against the unbeatable AI. Instead of the straight vertical line, there could be - slanted, wavy, pointy criss cross, outside borders are solid with no center line, etc. also, the arena could be of different shapes as well. One last - how about a one time use power up? Like an instantaneous boost. But of course, use it wrong and you lose, still.
15:01 that's frickung genius! GameMaker really chose the best man to sponsor
@JonasTyroller
Жыл бұрын
Will make an itch build for the people who just want to play, though. I'm not a monster. :D
Jonas, I finished playing your game Will You Snail around December last year, and I just want to say that I love that game so much. I love the ending, secrets soundtrack, and so much more! - You’re game is a work of art. I even bought the soundtrack! Just wanted to say thanks for everything Jonas & keep up the good work with your video & games!
Love your videos. Always excited to sit down and watch your production-level content. Keep it up, you're a bigger insperation than you know.
I absolutely love your channel. Such fun energy, useful insight and advice, great editing, and awesome shoutouts to others
Best sponsor integration of any video on KZread, and always will be. You just plugged your sponsor _and_ made people excited to download their engine. Wow. Best sponsorship decision YoYo Games ever made.
Sehr cooles Video. Wie immer sehr lustig. Ich habe mich die ganze Zeit gewundert warum die AI so schlecht performt und dann hast du erwähnt, dass du nur 20 neuronen genutzt hast 😬. Nein aber ernsthaft, nicht böse gemeint, aber für ein Spiel dieser Art solltest du deutlich mehr Neuronen Nutzen. Mit modernen Methoden braucht man auch nicht mehr so sehr vor overfitting auf der Hut sein, zumindest wenn man beim Training auf viel Varianz achtet. Für Spiele solcher Art eignet sich aber Reinforcement Learning meist tatsächlich am besten.
@JonasTyroller
Жыл бұрын
Danke für die Tipps. Ich glaub für mehr Neuronen war mein algorithmus dann doch nicht effizient genug. Ich hab da noch einiges zu lernen. Haha. :D
@49wares
Жыл бұрын
@@JonasTyroller Aber es ist cool, dass du so viel mit AI arbeitest. Ich habe schon viel in diesem Bereich gemacht, aber ich habe noch nie AI für ein Spiel verwendet. Es ist immer spannend und unterhaltsam zu sehen, wie du das machst 😃👍.
This is such a good game😮. Make another 2-3 vids on polishing this game and release it! This is a really amazing game i am so surprised. I really wish for this to be polished to be made into a full standalone game
@JonasTyroller
Жыл бұрын
I mean it's pretty much done. Will upload a quick build to itch right now. If people want more, the source files for the project are available. :)
@sohamdas1250
Жыл бұрын
@@JonasTyroller Waiting impatiently for that. If you want to try make it multiplayer if you hate yourself.
I have been waiting for your videos! finally here:)
Awesome to see you made the game public domain, I wonder if people'll make gamemodes where there's items like bumpers you can place down, or a parry that if timed well, knocks the other back. Or a good old reverse controls. Clearly this game needs a 100 player battle royale too
@JonasTyroller
Жыл бұрын
Omg. 100 player battle royale is actually a gigabrain idea.
@vojnov9885
Жыл бұрын
OMG a 100 or even maybe 20 would be incredible. Isn't there anything like that already? Would imagine so.
Pretty good way to do a sponsor lol, you make a fun game, open source it but only of that engine of course
Jonas: *makes game public domain* Viewers: ooh free game idea!
I've had this idea for a while but you've beat me to it, I will try to use the game files and try my best to recreate it in unity. Thanks a lot for sharing them.
Glad you got sponsored. Hope to see more content and games!!!
6:22 he’s evolving, just backwards.
@JonasTyroller
Жыл бұрын
Exactly. Rip.
That reminds me of a quote I've heard, not sure where it was: "The goal isn't too create an AI that plays as well as possible, but to create something that's interesting for a human to poke at."
Jonas is your typical weird neighbor kid... and I love it!
Love the Intro 😂 props to your video making skills btw.!
Help plz! How can do parallax my dots background in Filter/Effect Layer ?
The hit new game “Will You Ball?”
I love this video. It's just a breath of fresh air to see an old AI method being used again. Also the game looks and sounds so nice I wanna play it
Good game, you made beyblade! but in the spirit of user friendliness the black can be a bit hard to see on the dark green
Great video :) Only thing i missed: Final hand coded AI vs itself.
Please do a showcase of other people's take on this game! Adding fixed obstacles or bumpers to this game would be cool. Like competitive pinball.
Hmm it seems like your AI is basically a live-TAS. Thing is that it does things with unrealistic inputs, ergo it doesn't have the same capability set a human has since it can completely change the input direction every single frame. It would be interesting to see if it was modified so that it can only do so as fast as a human realistically could in real time.
@JonasTyroller
Жыл бұрын
And giving human reaction times was another thing I saw suggested in the comments. Sure that would make it fairer. While making a video about an unbeatable AI that would have been counterproductive, but I'd definitely be curious to see that as well.
@YaenGamedev
Жыл бұрын
@@JonasTyroller Well, I could at least imagine a person with a near instant reaction time but it's hard to imagine someone breaking the laws of physics to the point where their fingers can snap back and forth instantly on a controller.
I don't think the ai ruined it, i think you add a timer and now it is a survival game 👍
What's kinda missing in the video is a basic outline of the strategies you implemented for the final ai.
Random potential ideas: A dash mechanic randomly spawning powerups a gun cheering into your mic to power up your ball mines make the map a bowl (gravity towards the center) multiple maps jumping burst meter hitstun slime! control point/zone capture the flag mode soccer a giant unstoppable angry moon that is going to crash into your home and obliterate everything hats!
After your last video... I needed something like that! :) Thank you! You made a very good job with this sponsorship and actually, I'm pretty happy that your neural network created a worse AI than what you were able to code yourself haha! :Đ
@JonasTyroller
Жыл бұрын
Team human!! Haha! Yeah, making super human AI is not that easy (yet). Lol. Happy you enjoyed the video. :D
Very helpful perspectives. Thank youuuuuu!
How big is the neural net you're using?
@JonasTyroller
Жыл бұрын
I think the biggest one I tried had 20 Neurons, 10 Inputs, 2 Outputs. I'm somewhat limited by simulation speed. I think I can simulate about 10-25 broink matches per second, which is decent, but I'm not sure it's fast enough to evolve a bigger network. Perhaps I'll try reinforcement learning next time.
Best part of Hardcoded AI is that, they can be made impossible to win, except for some specific game mechanics like chess and GO.
this felt like the amoungus potion video but with AI
Great attempt and video. I've dabbled in GameMaker AI and my approach was to establish different 'moods' for the bots; i.e. aggressive, passive and mix of the two. I then set randomised alarms to alternate between the different moods. I had 5 bots V 1 human. It made for some decent results. ...needs work though 😀
Wow, I did this exact thing in GMS1.4 back in 2020! I planned to make it a boss rush where each opponent has different weights/abilities/etc so that they're forced to occasionally deviate from the unbeatable state machine
inputs I see relevant - position & current velocity for both balls - match time (or how long until the gate opens) - table size outputs - applied force vector which leaves me curious how big the neural network was - how many layers and neurons? might also be worth pitting it against the hand coded, non-trivial AI, so that it has to work against something at least somewhat more capable then "standing still" and "move directly at" for base AIs and only things that could defeat those. or even adding something like "move to the middle and circle around it" as an AI... as you said, you may have hit a local minima as there wasn't enough variety in the strategies it had to defeat.
wouldn't it work to have the nueral network play against the final hardcoded ai in its training?
This is a certified Jonas moment
Really cool game! I assume the sounds are allowed to be used in other engines?
Jonas voices are something else.
Man, this video takes me back to when I was a kid also and also using Game Maker. Back then it was a Game maker 6.1. Used to make some little games etc., mostly using just the blocks and occasional pre-made script for specific purpose. I also tried making some small games with students at the middle school I work at. Wow that must have been maybe 10 years ago already.
:0 This game is the exact game I made on scratch ages ago! I even made an AI for it and everything!
video production is brilliant really enjoyable.
The game itself reminds me of bumper balls from Mario party. That was my favorite minigame out of the bunch. It's like your game, except with 4 players, characters standing on balls bumping into each other. 4 playes introduces a lot of chaos that makes it much more fun, like you can get speed off of one person bumping you to launch into another player to knock them off. It often ended with 2 players going until time ends (it used a timer instead of shrinking the arena -- shrinking is better, because it always determines a winner). The unbeatable AI ruining a game reminds my of the seventh guest. It was a game where you explore a mansion and complete a bunch of puzzles. Except one was a game you played against the computer. It was turn based, I forget the rules exactly, you eventually filled the board, could flip each others pieces, and whoever had the most at the end wins. I spend hours trying to beat it, felt like I massively improved my strategy, but never stood a chance. Every time I thought I had a sure winning strategy, the computer ALWAYS countered perfectly, and I'm not sure if it was even possible.
Crazy idea: make a hard coded op AI And then train AI against it 😂❤
Interesting video Jonas. I think the problem may be rather than making the AI sort of smart and defensive you could have the AI move in a random direction with stipulations such as it will move randomly but if you are in a radius near by the percentage increases that it will move towards you and then back to random. The same method could be used when the AI fails and goes off the edge by it's self and that happens a lot more at first but the more you play the less often that happens while still a very slow increase of it's agression towards you and have it know it's during the edge at times so it can start to evade more often and progressively. At some point adding obstacles that do funny or interesting things to avoid or just barriers might be a good change so you won't require the temporary barrier. And theoretically if the AI moves faster than you but hits you with a bit less force due to you having a lower mass than it then it's easier to trick at first.
Fantastic! Game maker having machine learning is wild to me because last time I used it was probably 2013. 😂
Sorry a part of me ruined your game Jonas
can you make a build for it?
"I'm evolving in the wrong direction" xD
this gets me thinking, if you put an ALMOST unbeatable AI as a final boss in a souls-lite with only one weakness that's an oversight in it's hitboxes, meaning you need to just survive until you can get to the weak spot, and the hard mode randomizes the weak spot each time you attack.
@JonasTyroller
Жыл бұрын
Oh jeez. Sounds like a nightmare... so would be perfect for a souls game. :D
@stickguy9109
Жыл бұрын
I would love that. I feel like the more challenge there is the more appealing it is for us souls enjoyers
Dammnnnn the ai was really just bullying you at the 😂😂
Nice editing bro
@JonasTyroller
Жыл бұрын
Fully edited by TheShelfman. He did an excellent job indeed.
Squid lives throughout the games
What if you removed fitness for every second the trained ai takes to win? Maybe that'll make it not wait in the center
I really want to see another video on the king builds a kingdom game... plz :)
i think i saw a mouth harp in sfx making, tbh, that's sick
One of those ML models that learns to mimic an expert (aka you) might work to make a standard to evolve against, or even to directly play against
ideas to make AI better: -train separate populations of the AI, like how different types of life come from being separated/isolated, then occasionally make them fight against each other -more nodes. more layers. more everything -more inputs. Even if they are redundant, they may help the AI in unexpected ways. -short-term memory. If an AI can remember what it's doing, it can possibly create more advanced strategies.
this is a great example of why not to just rely on a 'magical AI black box' and how actual algorithms, where you know what they'll do, and can easily tweak them are often better, and more reliable
Mario Party bumper balls
5 vs 4 was a battle for the ages 8:46
please release as a playable version on itch or something 🙏
@JonasTyroller
Жыл бұрын
Good idea. Will do.
@joestephens
Жыл бұрын
@@JonasTyroller thanks. it looks so fun.
I would buy this on steam if it would have online multiplayer
wait i remember that game, it was called sumo balls and was up to 3 players and 3 AI
Hi Jonas! Can i ask what microphone were you using to capture the sound effects?
I think reinforcement learning would be the best way to do it meaning the AI has to train based off of limits that you set it, but that would require a stupid load of matrix multiplication, and if you manage to do that in GameMaker, hats off to you. Personally though I would've just tried to write some compute shader in unity to handle the matrix multiplication. There's the unity mlagents package as well, which can do the reinforcement learning, but that's probably too large of a project to be feasible.
This criteria fits a game jam that took place around when you made this video, was it for that?
I have a multiplayer idea for will you snAIl: one controlls the snail and the other player controlls squid the snake has to dodge spikes that the opponent. the opponent trys to prevemt that the player goes to the goal!
Was I the only one who imediatly thought of bumper balls from mario party
How to play this? Where is the playable version?
reminds me of the game "spellsworn" (which is based on the wc3 map "warlock")
Distracting squid to kill her
The last time Jonas tried to make a hit game with an ai it did not go well.
The game reminds me of one of my favorite mini-games in the first Mario Party. There it was a lot of fun also because there were 4 players, making it hard to track everything
@jptannus
Жыл бұрын
This one: kzread.info/dash/bejne/ap-tt8itg9O7oso.html
higher-end chess bots be like:
I wish this was a real multiplayer game to play
Hey Jonas, have you heard of this game called Pizza Tower? It's fast, frantic, absolutely insane and I think you'd love it
would love to see this game made with an AI that learns from your play type and evolves to match the opposite play type for example: if your aggressive, it will play defensively and lure you to your own fall if your defensive and attempt to lure the AI to the edge, it will start to play aggressively The tricky part is. that when you first play the AI it should be very bad, and only get better over time. so if you change your strategy, you can beat it for another 2 - 3 games, this way the AI would encourage you to find new strategies and play types, since its NOT unbeatable
I like how you trained the balls to become a team. You may want to reward the AI with more points when it wins faster, also you AI found a spot where it no longer needed to grow according to the rules you gave it. You may want to try mutations in some generations.
Congratulations! You just made Bumper balls from Mario Party with a Master AI level!
@JonasTyroller
Жыл бұрын
I knew I couldn't be the first one to come up with this. It's kind of a low hanging fruit! :D :D
@AntoineMB2
Жыл бұрын
@@JonasTyroller that's not a bad thing, bumper ball is one of the best Mario Party game so of course the idea was gonna come back sometime! ^^
This is literally a Mario party NDS minigame
Am I crazy or did the final AI just ignore the lose condition? You knocked it out twice and then it hovered outside of the circle at the end...
Damn, I would love to play it but don't wanna build it myself. Could you release a version that I could just download and play?
@JonasTyroller
Жыл бұрын
Yes, yes. Seen this question a few times in the comments. Will make a build and upload it to itch. :)
codebullet called, he wants his brand back
@JonasTyroller
Жыл бұрын
Then perhaps I should challenge him to an epic AI coding battle.
I beat the AI twice, however it is very difficult. if you try and lure it by going to a corner it will stay in the centre. if you try going to the centre it will slowly push you away until you fall. The trick is to go to the centre while the border is active, so it charges up to attack you, then dodging the initial attack. Afterwards, while its moving towards the border, it is still not possible to knock him off, so you need to attack a bit more and hopes that instead of attacking back, he tries to dodge your attacks. If he does try to dodge it then you need to hit him despite him trying to dodge, finally knocking him off. It is quite hard.
@s5079282
8 ай бұрын
I can now beat it 100% of the time using this method. Bounce into the border, but before hitting the border nudge the up or down arrow key depending on if the ai is moving towards you in an up or down direction (nudge arrow key to oppose its direction), then release the up or down arrow key slightly after hitting the border and keep holding onto the left arrow key (assuming you are the ball on the right). Wait a little bit till you reach near the border, then release the left arrow key and start going fully aggressive at the AI. It's tricky to actually punt it off the border, but you have the momentum at that point so it's a matter of converting your momentum into a win with practise.