• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

FifthCPU's Custom AI Discussion/Workshop

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Current Download Link for released bots: [Link and files have been removed to avoid potential legal troubles. I will not being releasing any further bots, I am done with modding, and my downloads have been removed from the internet. Please, do not ask me about them. In addition, I would like to clarify that I have never been a part of the PMDT.

EDIT: I know I'm an insanely small-scale modder who worked in a unique pseudocode written by other modders and my stuff has never and will never be used in a competitive setting, but I need the piece of mind. At my request, all links to files I have worked on have been removed from all sites.]
 
Last edited:

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
I've had it explained to me that the difference between CPU levels is just the frequency at which routines are called.

But your Level 7 Random DI seems to imply that you can create differences between levels?

Theoretically, does this mean that one day in the future you could have a different bot for levels 1-9 (or even secret 0-9) where each bot does more than just call routines at different frequencies?
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Theoretically, yes. I'm still experimenting with it, since Level Values are incorrectly defined and I have to guess and check, but I could make different routines for different levels. The annoying thing is that means the file size and amount of code both get pretty big. On the other hand, it could make for much more differentiated levels (and a secret zero maybe?)
 

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
That's very cool. Too bad about the file size though.

Could you make a "dummy" AI? Like basically transfer the "Stand" setting from Training Room onto a Level 1, so it would stand around and only recover?

Also, do you know why sometimes the AI in "Stand" will recover, get back on stage, then double jump, before going back to "Stand", or is this unrelated.

I think it would be cool to have "tiers" of CPU. Levels 1-3 are basic CPU script not really tailored to the character, Levels 4-6 are more advanced script, and 7-9 are like what the current Fox/Falco CPUs are, and your JigglyBot and 20SSBot, where they use all their advanced tech. And then across each tier of CPU the level would dictate the routine frequency.

I guess you could also incorporate 3 DI schemes in there as well. 1, 4, and 7 all have no DI, 2, 5, and 8 all have Random DI, and 3, 6, and 9 all have your combo+survival DI.

Could you theoretically just write the Level 9 bots, then swap out the DI routines for 7-8, then take some of the recovery/combo/neutral routines out for level 6, swap the DI for 4-5, etc?

This seems like a literal ton of work and a hell of a lot of megabytes.

I seem very pestering about all your work but it's because it's so incredibly interesting.

What kind of coding background did you have prior to working on the AI?
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Funnily enough, the way I start an AI (as taught to me) is to revert it to just standing around, then add in routines one by one. So its completely possible to have a CPU that just stands around and recovers if knocked away (and for some reason will occasionally punish, because ASM code I guess). I still don't know what causes that or what causes the weird hop in training mode.

The tiers of CPU would be cool actually, and I think it wouldn't be terribly hard, just a little confusing to keep straight, as long as I can figure out which level value corresponds to which value in the code, which is a work in progress. Luckily, DI takes up a very small amount of the total file size (as in like a couple kilobytes) so I usually don't have to worry too much about the size limit. My code can be practically unreadable sometimes anyway, so I'm not terribly worried about legibility. I'll just comment it a lot.

DI schemes is something I'm really getting into, since its really important for CPUs and I've figured out how to actually code effective DI. The one issue is KBSpeed, which I REALLY want to use, is unlabled in units, so its basically impossible to tell whether it does anything. I've been trying to work around that one with detection in relation to blast zone location instead. I also started using a ton of KBAngle in order to make it correct a little bit.

I had no coding background besides some PSA and a teeny-tiny bit of Java. I have taken logic classes, which for AI is really all that matters since the pseudo-code is so intuitive. Logic/patterns/flowcharts have always come super easily to me, so learning the code was a breeze. I've always been super interested in AI, so naturally I got into it the best I could. My philosophy is basically to put myself in the shoes of the player and ask myself what all my options would be in the given situation, then throw them all in the relevant situational code of the CPU and see how it handles them. Once I've done that, I start correcting them to make it better and as humanlike as I can.

Oof, long post. I should probably be quiet.
 
Last edited:

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
That's pretty cool! Are there any resources out there that you would recommend? Seeing all your AI stuff is making me think about AI more and you saying that you have relatively little coding background makes me think that I might not have as hard a time with it as I previously thought.

Have you figured out Teching yet? I know you said a few weeks ago that it was super weird code-wise.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Teching is still.... urgh. I'm trying, but its probably about as good as it'll get right now. On the plus side: The randomly DIing CPUs seem to tech more randomly(ish), so I guess that's progress.

The program I use is called AIScriptpad 2.0. It makes the AI code decipherable (more so, at any rate). I taught myself mostly, and KingClubber helped me to understand some of it, especially the more technical syntax. At any rate, our coding styles are markedly different because of that, and our strengths are in different areas.

These two pages will be the most useful:
http://smashboards.com/threads/ai-handbook-2-0x-readable-syntax-stable.300461/
http://forums.kc-mm.com/index.php?topic=62818.0

In order to make it work with P:M, you have to add 4010 and 4020 into the routines.h text document (They're the routines for ground and aerial combos respectively). If an AI has custom code, it'll have a lot of routines in the 6040-6070 range, otherwise its someone like ZSS or Squirtle who are 80% obsolete Brawl code.

Just a warning: Modifying things here and there isn't hard, but coding a bot basically from scratch (SquirtleBot, for example) is hugely time-consuming, and very difficult to make work.
 
Last edited:

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
That's awesome!

I have a bunch of free time tomorrow so I might take a look and try not to get overwhelmed.

The first two bots I would want to create are Mewtwo and Squirtle lol, you definitely chose great characters. If I gave it a go I'd probably go for DK. Coding in some of his bread and butter combos would be fun, especially with his 50-50 cargo throw mixups.
 

drogoth232

Smash Lord
Joined
Nov 28, 2011
Messages
1,072
I know a good amount of both PSA and Java along with a tiny amount of Python and C. I might take a look at AI scripts for fun later on and post in this thread a bit more. This is all assuming I don't decide to finish up other stuff that I've put off for months.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
I generally go for bots I think will be interesting because they have a bunch of unique tech (Mewtwo, Squirtle, etc) and so I don't get bored. DK would be cool, but I'm still trying to figure out chain grabbing and grab followups since they're definitely not intended to be in the code so you have to use workarounds or jank to make them happen.
 

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
The computer can check the opponent's character can't it? So you could tell DK to either Cargo Fthrow/Bthrow mixup for mids and floaties, and Cargo Uthrow heavies.

And you can check relative position too right? So then you can write an if statement that returns different actions depending on DI.

I think writing a DK bot that could chain grab each character with near perfection would be a lot of fun.

Except ICs. Could you insert an overall command like "if opponent character is X, never grab and run these routines instead"?
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
This is true, I actually write routines for throws based on characters (for example, Squirtle will Uthrow Fox and Falco at low percents, and above 120% will Dthrow characters in order to fish for KOs. Otherwise, I let the game decide using its weird default code).

The issue is that grabbing is weird. Once you land a grab, the routine for grabbing (1120) shuts down all the other processes and begins running. That means you have to do all the coding for chain throws and throw followups inside the grab routine, you can't just set up a string of inputs like normally. But that means a rewrite of at least a portion of the grab routine where it checks if they're no longer throwing the character then calls some sort of other routine to follow up. Oh, and you have to rewrite the hitstun check because otherwise they'll just go straight into trying to combo.

TL;DR: Chain Throws and preprogrammed followups are really annoying.
 

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
Sounds like fun actually haha.

The more I think about it the more AI is literally just a bunch of if statements.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Sounds like fun actually haha.

The more I think about it the more AI is literally just a bunch of if statements.
Shhhhhhh don't let them know :)

AI is definitely a lot of if statements (Ok, like 70%). The hard part is making them all play nice and work in tandem, especially since there's no manual or anything. It took me days to figure out the reason chain throwing didn't work is because 1120 is a routine which'll boot the others out. There are still functions which are undefined, and still things that are inexplicable. Why does squirtle water gun to start every match? I don't know, I took out all the Button B presses and weird calls in the code and he still does it. Why do coordinates seem to have very flexible positive negative signs? I don't know.

There are literal hundreds of ifs and elses, but when I make a bot I end up knowing it like the back of my hand. I know each option it can use for each situation, and what each statement does. I've gotten to the point where I can beat bots largely because I understand the AI structure well enough that I can predict their movement. And that's the real challenge: I try to write bots with such a wealth of options that they can trick me and beat my neutral, that have so many ifs and thens that even I can't handle it. When I do that, its a job well-done.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
I DESPERATELY want to program an Icies AI, but I have to perfect chain throws first, and without access to footstools I can't add some of the more interesting setups for grabs.
 

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
Wait is there no Taunt input button?

Will the Icies AI not be difficult AF to program though, since there are two bodies? Or will you just do everything with relation to Popo?
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
See, I don't actually know what Icies will do, that's why I'm hesitant to mess with them until I finish Squirtle. They even have their own variable in the code, simply described as "Ice climbers related." I'm 80% sure it should just affect Popo and not Nana's AI, but I can't be sure.

And no, there's only inputs for R, A, Control Stick, and B. Everything in the AI is made up of combinations of those. (EDIT: Imagine how hard it was for me to program a DACUS using those. Oof.) Which is unfortunate, since there's nothing I'd like more than to have an AI that can disrespect people really hard, like put on shades or smash taunt or something. Its like my biggest wish to be able to somehow access them.
 
Last edited:

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
20SSBot Beta version is out! Credit to KingClubber for his implementation of the DI Call that allows for consistent and throw DI!
 

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
Game froze when Level 9 Squirtle died off the top on his third stock vs Level 9 Fox on FD. Will see if it happens again/with another character/stage.

Worked fine against Roy on Smashville.

Then froze 9-Squirt v 9-Fox on FD, same costumes as first game, image attached.

Game 4 I played against it as Marth, crashed, image attached. I had just respawned after it beautifully edge guarded me.

Also here it says random DI is level 7 but the reddit post says level 8.
 

Attachments

Last edited:

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Game froze when Level 9 Squirtle died off the top on his third stock vs Level 9 Fox on FD. Will see if it happens again/with another character/stage.

Worked fine against Roy on Smashville.

Then froze 9-Squirt v 9-Fox on FD, same costumes as first game, image attached.

Game 4 I played against it as Marth, crashed, image attached. I had just respawned after it beautifully edge guarded me.

Also here it says random DI is level 7 but the reddit post says level 8.

That's highly distressing... I've just been using dolphin so I didn't know that would happen, I assumed any errors were just dolphin being evil (it does that). I've tried updating it to remove some obsolete routine calls and things, but that didn't help. I'll keep trying to fix it as quick as possible.
 

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
Dumb double post.

Also are you open to adding more things to the Squirtle like different recoveries and stuff?

Also sometimes its ledgedash SDs, dunno if that's on purpose or not.
 
Last edited:

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
SecondNova SecondNova Yes, they are 3.6 full, minus Mario, who is... well, I don't even know.

nimigoha nimigoha I may have just fixed the crashes. I'm unsure why the ledgedash SDs, it should be frame perfect. I guess it adds a little realism though (I'll keep telling myself that). I'm trying to fix the recovery to be less suck, but recoveries are the most insanely complex part of the code, and fixing or changing them is a long, very slow process. Its like it was written by a completely different person, and does insane things like takes one variable and sets it to something else every few lines in the code. I want to work on it though, since that's one of my biggest issues with it.
 

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
That sounds sweet! Mainly being able to sweetspot the ledge if the opponent is far away.

Seeing it invincible ledge stall with Side B would be pretty awesome too.

But from the full game with it I've seen so far it looks so much better!

I think the DI codes you wrote will be very useful.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
That sounds sweet! Mainly being able to sweetspot the ledge if the opponent is far away.

Seeing it invincible ledge stall with Side B would be pretty awesome too.

But from the full game with it I've seen so far it looks so much better!

I think the DI codes you wrote will be very useful.
Thanks! Is the Side-B ledgestall still a thing in 3.6? I didn't put it in because I thought they removed side-B cancelling after 3.5.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Yeah, and I haven't gotten any other reports so it might've fixed it, but I don't know for sure because I haven't had testing time. I added back in a bunch of things I thought were noncrucial but apparently might be important, and found this weird "Call 1080" that I don't remember commenting out but apparently did. This at least should make it more stable, if not fix it.
 

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
Okay, the mediafire links still say updated around mid-day but I'll give it a whirl and let you know.
 

KingClubber

Smash Ace
Joined
Nov 15, 2010
Messages
969
Location
In a dark underground base in the middle of L.A
Could you make a "dummy" AI? Like basically transfer the "Stand" setting from Training Room onto a Level 1, so it would stand around and only recover?

I think it would be cool to have "tiers" of CPU. Levels 1-3 are basic CPU script not really tailored to the character, Levels 4-6 are more advanced script, and 7-9 are like what the current Fox/Falco CPUs are, and your JigglyBot and 20SSBot, where they use all their advanced tech. And then across each tier of CPU the level would dictate the routine frequency.
Who are you, and what are you doing in my head?

Also, do you know why sometimes the AI in "Stand" will recover, get back on stage, then double jump, before going back to "Stand", or is this unrelated.
Issue with a code that forces ai to do actions after grabbing the ledge, nothing can be currently done about it.

The issue is that grabbing is weird. Once you land a grab, the routine for grabbing (1120) shuts down all the other processes and begins running. That means you have to do all the coding for chain throws and throw followups inside the grab routine, you can't just set up a string of inputs like normally. But that means a rewrite of at least a portion of the grab routine where it checks if they're no longer throwing the character then calls some sort of other routine to follow up. Oh, and you have to rewrite the hitstun check because otherwise they'll just go straight into trying to combo.
No you would run it through the combo routine, once the opponent enter's stun since your using Bero's Combo routine method it would seek what to do there. You would need to check for previous actions/character/DI/and damage values to get it working correctly.
 
Last edited:

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
No you would run it through the combo routine, once the opponent enter's stun since your using Bero's Combo routine method it would seek what to do there. You would need to check for previous actions/character/DI/and damage values to get it working correctly.
Really? Because the way I'm doing hitstun checks (Taken out of the AIPD, check placed in each routine with "if OFrame****stun > 0) it seems like chain throwing could be done in 1120. I'd revise it so it links to another label after throwing instead of finishing the routine, and take out the hitstun check from 1120. That was my plan, at least.

Thinking about it though, the previous action check you said definitely seems like the way to go. It seems easier at least, and a little less messy than adding to the already-crazy 1120.
 

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
Could you program an AI that just attacks the ledge?

Like a Marth that will just Dtilt to tipper your recovery 3 times per second?

Would make ledge tech practice really easy.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Could you program an AI that just attacks the ledge?

Like a Marth that will just Dtilt to tipper your recovery 3 times per second?

Would make ledge tech practice really easy.
I mean, I'm pretty sure. It would be making an AI with no routines except to move until it got a certain distance from the edge, stop once it got there and begin a repeating routine of Dtilting. Would also require an AIPD modification to stop it from doing edgegaurding, but that's not too hard. Alternatively, one could just modify (I forget the routine number) that handles opponents on the ledge and just tell it to Dtilt repeatedly. I altered that routine once in order to make CPUs that would Dtilt/Dsmash people who were edgehogging for greater than 40 frames.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
That's easy, it's everything else thats difficult.

Cpu's do not like leaving the ledge, and being off stage is like poison to them.

You have to force them off the stage to do anything considered unsafe
Too true. Getting CPUs to go offstage is incredibly frustrating. They prioritize recovery so highly (ironically, while being very bad at it) enough that they aren't very receptive to offstage edgeguards. Even P:M's jigglypuff, who I noticed is more willing to do so than most CPUs, will do it maybe one out of every ten times.
 

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
Roy did an invincible Bair on me as I was recovering with Squirtle yesterday. I was very shocked.
 

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
Fifth said he's getting a bit bogged by schoolwork so I'm just trying not to haggle him, patiently waiting for his next project/update.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
KingClubber KingClubber nimigoha nimigoha Yeah, my schoolwork is crushing me at the moment, so working on AI hasn't really been possible recently. I did start making on a Shielda CPU and fixing Squirtle's issues, that's where things stand at the moment. Shielda is interesting since I'm using it to learn more about LevelValue and fixing Sheik's crappy Brawl-style AI and make it follow up throws.

It also led me to figure out that since AI is stored in the "Etc" part of the FitMotionEtc.pac, using a transform actually causes the game to swap Zelda/Sheik's AI, which is awesome since I'm making Sheik's good and Zelda's is already pretty awesome. I think its got some interesting applications.
 
Top Bottom