• 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
KingClubber KingClubber Yeah I'm mostly just trying to see if I could make a good Sheik, and decided to try this just for fun to see if it worked (If I was making a 100% serious AI then you're right, terrible idea). I was even more surprised to find out that the current P:M sheik AI actually has the potential to transform into Zelda, its in one of her AIPD slots and called at a super low frequency. It actually happened when I was running some preliminary matches, and really freaked me out.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
She did it a lot more frequently than you think, I added a script to prevent it from happening at all.
Ahh, see I accidentally deleted that one, so it stopped inhibiting the transformation. That would explain it.
 

ECHOnce

Smash Lord
Joined
Feb 22, 2014
Messages
1,191
Location
Bellevue, WA
I'd be super down for Sheilda AI, but reality kinda sucks. The only safe time for an AI to transform would probably be between stocks, since transform doesn't have set frame data, and is dependent on how quickly the Wii can load up Sheik/Zelda's files (which is why transforms are almost instant in netplay..darned computer processing power ;___; ). I've transformed from above stage level and had to wait until I was well off-screen below, although that was surely an outliar. Maybe timing on a few tourney Wiis and guestimating an average time could help? I can do so at my next monthly lol
 
Last edited:

KingClubber

Smash Ace
Joined
Nov 15, 2010
Messages
969
Location
In a dark underground base in the middle of L.A
Finished a proof of concept for chain throws, i'll try to post a video of it tomorrow.

But my bases of it were really simple.

Sonic vs Fox (Sonic's uthrow chain grab on fox. No Di!)
Created a Custom Routine 3060 to be grab
Grab Triggers Routine 1120
Routine Uthrows causing Fox to enter stun.
Custom Routine 3060 checks for Opponent in Stun
Custom Routine seeks Ground Combo Routine.
Ground Combo Routine attempts regrab
Rinse and Repeat "Grab Trigger"

It regrabs Fox 3 times with no DI
But after reaching above 20% damage it fails.
 
Last edited:

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
KingClubber KingClubber that's awesome! The timing might change after a certain number of times (compared to Marth where you pretty much always grab on Frame 1 or so. Is it failing because it misses the grab or because it doesn't try to grab?
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
KingClubber KingClubber It sounds like that's probably specific to Sonic's chain grab, since its one where the timing has to be altered depending on the opponent's damage. Maybe if we changed the grab routine or added a different routine specifically for chaingrabs in which the timing will vary based on the damage of the opponent.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
AWESOME!!!

The fact that you made sonic walk forward in between is really encouraging too. I feel like that allows for almost all chaingrabs in the game to work, realistically. I'll try to hash out my own version of the code, I have an idea and I want to see if it'll work. By adding a random check (if Rnd < 0.95) I can make it so that chaingrabs could occasionally stop early (maybe only at certain levels), preventing the player from constantly reading the way to DI.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Update on Sheik:

She's insanely glitchy while recovering (Doesn't recover half the time for some reason, still looking for solution, possibly going to paste old recovery code back in) but actually plays pretty solid in terms of a neutral. For all of her close range attacks (so basically tilts and Dsmash) if she's well within grab range that gets called instead. This results in a somewhat realistic sheik, who grabs a lot and basically just gets reads off grabs, and pretty much exclusively uses needles, tilts, Dsmash, and grab, while following up in the air after combos. Sheik things.

The current issues other than recovering is she grabs when the opponents have missed techs, when she should be punishing. My plan for this is adding a check for the opponent's subaction in the grab routine, and if they're on the ground or doing a rolling tech she'll jab reset them or read them, depending on the situation. Super tech reader sheik!!! The only other issue is I wrote the dash attack code rather poorly, so sometimes she'll do random pivot jabs. This is mostly fixed though.

Once I fix those, will probably try to add in a dashdance routine and make needles better.

Update on squirtle bot: Finally figured out what caused the crashes!!! For anyone who was wondering, I missed an "endif" statement somewhere, which either A) Causes the program used to mod AI to temporarily corrupt itself B) Makes it unplayable or C) Causes random crashes, like the ones in this case.
 
Last edited:

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Also, may have just fixed meteor cancelling in CPUs! I was having it constantly reset execution to frame 5 of the routine, unless knocked back within a range of 245-315 degrees. At this point it would count frames normally until frame 16, after which it would attempt the cancel. The problem was, I forgot to add 5 for the reset (should read FrameGE 21, not FrameGE 16), so it was constantly trying to meteor cancel frame 11 of the meteor smash, and both failing and preventing any cancelling until the end of hitstun.

Does none of this make sense to you? Don't worry, it probably shouldn't! If this fix works, I'll post a video soon.
 

KingClubber

Smash Ace
Joined
Nov 15, 2010
Messages
969
Location
In a dark underground base in the middle of L.A
Funny i was working on tech chasing sheik as well guess i can give the file to you

I'll upload the file and a video of it tomorrow

Its not prefect & it the only thing she will try to do.

Only works on Fox as far as I know & only to 50% damage.

I'll explain more when its up
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Funny i was working on tech chasing sheik as well guess i can give the file to you

I'll upload the file and a video of it tomorrow

Its not prefect & it the only thing she will try to do.

Only works on Fox as far as I know & only to 50% damage.

I'll explain more when its up
In all honesty, your sheik is probably better. I haven't really programmed in tech chasing yet, it just does so naturally a tiny bit, and mine is still bugged to hell and back for some reason that I can't figure out. Its like some routines are completely nonfunctional or something.
 

KingClubber

Smash Ace
Joined
Nov 15, 2010
Messages
969
Location
In a dark underground base in the middle of L.A
Tech Chasing AI is a bit more chaotic, and it require several AI Routines to put together as well.

Routines I used:
4030 Custom Routine for 20 or less Distance Units
4040 Custom Routine for 40 or less Distance Units
1120 Grab Routine
8000 A Custom Combo Routine

In All Honesty ...the jab reset was the hardest part to code because i kept confusing myself trying to use Routine 2070 a routine that triggers when the AI is lying down. Forgetting that it was meant to the AI that was being coded not for the opponent being jab-reset'd.

This doesn't work perfectly and it needs more work done on it, its missing a lot of triggers and is basically happening automatically.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
I could try fusing it with my Sheik (which has a neutral game but not much else) so we could see how well it works in actual match situations. I'd have to rewrite a chunk of 4010 (and maybe 4020), but it could be pretty effective.
 

KingClubber

Smash Ace
Joined
Nov 15, 2010
Messages
969
Location
In a dark underground base in the middle of L.A
I doubt it would work

You would need to understand how to make each of the triggers work together

Like i said, mines is mostly forced so it won't work well with other routines until its fixed, the tech chasing part is fine but not the jab-reset.

For the tech chasing its simple
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
True, I don't know to assign a trigger to a routine (ex: 1120 grab trigger). I did take a look at the file, and the code makes sense to me.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
No you do the opposite.

You create a trigger inside a routine to link to another routine.

Example

Code:
If InAir
    Call Routine 20XX
endif
There are automatic trigger routines such a 1120 which controls what a cpu does while holding an opponent after a grab.
Kk, gotcha, I think there was a miscommunication. My bad.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Hmmmm. Question: Is there any way to store some sort of internal constant or variable between routines? I'm pretty sure the answer's no (I've never found any), but if not then there's some potentially very cool things I can think of with Snake and Kirby that I could do.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
There isn't, not without ASM code at least

Trying to think of something else to work on, but nothing comes to mind that isn't character specific.

Any Ideas?
Hmmmmmm. I've been avoiding general stuff (except working on my custom DI code). Here's some random ideas I just thought up (although most are pretty bad):


It seems like one of the biggest issues with bots is their iffy recovery, so we could tackle that.
Ledgehogging/stealing?
There's also figuring out taunts, but that would require a lot of ASM searching probably.
We could work on improving the combo routine or making it different for each character instead of all just copies of Mario's.
We could work on edge guarding, since that's pretty bad, but the routine for that is absolutely ridiculous.
We could write a code so that CPUs punish shield-breaks and sleep effectively.
Improving the AI of Alloys more, although I don't know if their AI is accessible.

Nothing else that's not character specific comes to mind really. I've just been botting characters and trying to give them decent neutral games and improve them, but I'd totally be interested in working on something more general.
 

hemisphere

Smash Cadet
Joined
Dec 29, 2010
Messages
31
This probably has nothing to do with AI, but I was wondering if you are able to make CPU's steal stocks in Teams? Or if there is a way you can trigger this by your own input on your controller?
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
KingClubber KingClubber : I feel like wavelanding might be possible, I actually think I know how to do it. I can set up my routine and see how well it works, and I feel decently confident in it.

H hemisphere : I actually can't say for sure. I don't know whether CPUs input things after they've lost all theirs stocks. Even if they do, I'm not sure how to detect whether they have any stocks left.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
That is all Character Specific, I said NOT Character Specific.

Stuff Like coding Tech Chasing, DI, Jab Reset, Rolling & Dodging Lag punishing, Plat-dashing, Wavelanding.
Sorry, my bad. Got caught up making the list. I just wrote a universal wavelanding code into my sheik in literally 3 minutes, and HOLY COW IT WORKS!!!! Seriously, its a tiny bit goofy atm, but IT WORKS!!! I'll post a video later, this is super exciting.

EDIT: Perfected it more, and WOW. I wrote this code off the top of my head, but it works like a charm. I set it up as routine CAttack and put in the "InAir" section of the AIPD as well as the if !(SamePlane) True section, and it works beautifully. I've got a CPU wavelanding to attack me all over the place.
 
Last edited:

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
Sorry, my bad. Got caught up making the list. I just wrote a universal wavelanding code into my sheik in literally 3 minutes, and HOLY COW IT WORKS!!!! Seriously, its a tiny bit goofy atm, but IT WORKS!!! I'll post a video later, this is super exciting.

EDIT: Perfected it more, and WOW. I wrote this code off the top of my head, but it works like a charm. I set it up as routine CAttack and put in the "InAir" section of the AIPD as well as the if !(SamePlane) True section, and it works beautifully. I've got a CPU wavelanding to attack me all over the place.
Video soon!

Guys this work is looking awesome. Fifth you must be juggling like 10 different projects at the same time. Squirtle, Mewtwo, Sheik, DI, Meteors, Wavelanding... Absolutely sick, just make sure you don't let school creep up on you!
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Video soon!

Guys this work is looking awesome. Fifth you must be juggling like 10 different projects at the same time. Squirtle, Mewtwo, Sheik, DI, Meteors, Wavelanding... Absolutely sick, just make sure you don't let school creep up on you!
Yup, school (and social life!) are way more important, and school is definitely beginning to take up much more of my time. TBH, I've ceased work on Squirtle and Mewtwo for a while, and Wavelanding was literally me going "Would it work if I did this thing? Eh who cares I'll just type it in and see" and then being stunned when it actually worked.
 

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
That's cool. I told myself I'd look into basic AI but then got slammed with work and just don't have the time.

So you guys are our only hope!
 

KingClubber

Smash Ace
Joined
Nov 15, 2010
Messages
969
Location
In a dark underground base in the middle of L.A
EDIT: Perfected it more, and WOW. I wrote this code off the top of my head, but it works like a charm. I set it up as routine CAttack and put in the "InAir" section of the AIPD as well as the if !(SamePlane) True section, and it works beautifully. I've got a CPU wavelanding to attack me all over the place.
Good Idea, and share the work man.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Good Idea, and share the work man.
Thank you! I'll post the code and a video within the next few days, I have exams this week so my life is suddenly much crazier than usual. I also want to tweak it first because it actually led me to discover something about CPU landing detection (really complicated, will explain more later) which has the potential to clear up some issues in these types of codes.

EDIT: Also will be porting to at least one other character to make sure its really universal
 
Last edited:

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Mini-update Thingy: Exams=My life is hell, so the code will be posted in a few days, definitely within a week. I don't really have time to get a video at the moment, and I've reworked the code a lot. Instead of the original 20 lines, its something like 54 now, and is working much more smoothly.

The big issue is that even though it works great with anyone, I've plugged it into Luigi and Ganon's AI to test how it'll play with an already modified and a less-modified CPU, the routine is called very rarely. I've placed it in the InAir and if !(SamePlane) True sections, but its still almost never called, except when the character has just hopped while far away from the character, turning it into a subpar wavedash. Any thoughts?

TL;DR: Code working great, but not being called very often :(
 

nimigoha

Smash Ace
Joined
Jan 31, 2014
Messages
877
Please berate me if I'm being naive, but can't you alter call probabilities?

Or have you upped it and it's still not getting called often?
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Please berate me if I'm being naive, but can't you alter call probabilities?

Or have you upped it and it's still not getting called often?
No, good question! You can kinda-sorta-not-really alter call probabilities. You can totally edit them, but we don't really know how they work :(. Changing a probability is complete guesswork, and I already have it at the highest call frequency.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
WAVELANDING CPUS! ITS A THING NOW! Please ignore the weird neutral of the bot in the video, its pretty trash.

So here's the code involved. I've been working on getting the values right, and these are halfway decent. It causes self-destructs, but only very rarely.

CODE REMOVED BECAUSE PARANOIA

The main issue is that it's called extremely rarely. Like, the only reason sheik does it so often is because there are no other options in the AIPD sections where I placed the routine. I plugged it into Luigi and Ganon and they barely ever used it. We need to find a better way to call it!!! The other issue is it often gets called when the CPU is simply doing a normal shorthop or fullhop, leading to these really poor wavedashes. On the one hand, it keeps the CPUs grounded more often, on the other, we don't want it messing with their neutral games.
 
Last edited:

KingClubber

Smash Ace
Joined
Nov 15, 2010
Messages
969
Location
In a dark underground base in the middle of L.A
Pretty much figured out how you did it just by watching the video, wish you would have just explained from the beginning cause i would have told you that doing it that way was iffy... also....

if FrameGE 0 && !(FrameGE 1) if YDistFloor >= 8 Button R AbsStick var3 (-0.7) elif YDistFloor >= 6 Button R AbsStick var3 (-0.6) elif YDistFloor >= 5 Button R AbsStick var3 (-0.5) elif YDistFloor >= 3.5 Button R AbsStick var3 (-0.4) elif YDistFloor >= 1.5 Button R AbsStick var3 (-0.3) else Button R AbsStick var3 (-0.2) endif endif if FrameGE 7 Finish endif Return
Try not to do this, i'm not saying it won't work or that its sloppy. It just looks ugly, and lazy.
 

FifthCPU

Smash Apprentice
Joined
Jan 20, 2015
Messages
143
Pretty much figured out how you did it just by watching the video, wish you would have just explained from the beginning cause i would have told you that doing it that way was iffy... also....



Try not to do this, i'm not saying it won't work or that its sloppy. It just looks ugly, and lazy.
How should I do it instead? I was considering finding the ledge coordinate and drawing a vector to that. But I was just doing what I thought of off the top of my head, and I couldn't think of an easier/better way to adjust for different waveland heights. Again, this code was thought up in only a few minutes.

Also, I was thinking: Couldn't a lot of the issues I mentioned be solved if I added a requirement to the beginning of the code checking for a YSpeed < 0? It would cut out some potential wavelands, but it would prevent the CPU from doing any wavelands directly after a shorthop, thus making them only called in viable situations.
 
Last edited:
Top Bottom