• 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!

AI: (Get Well Soon Bero!)

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
Note
AIMain's last 3 entries are always type9,type4,type4.
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
Note:
Here's an interesting discovery. Mario has floating point 9999 and this belongs to type1 entry. What is it?
I think this is used for flood charge. Also, I found same variable in Lucario's AIMain. This must be used for neutral B.
 

leafbarrett

Smash Lord
Joined
Jun 8, 2009
Messages
1,388
Location
USA
Note:
Here's an interesting discovery. Mario has floating point 9999 and this belongs to type1 entry. What is it?
I think this is used for flood charge. Also, I found same variable in Lucario's AIMain. This must be used for neutral B.
YES! Finally, something that might explain why those characters still try to charge those moves even if they're changed.
 

grim mouser

Smash Journeyman
Joined
Jan 15, 2009
Messages
464
Location
Michigan
This is very cool. Is it plausible to program the AI to use, say, wavedashing effectively by editing AIMan and AIPD?
 

JediKnightTemplar

Smash Lord
Joined
Dec 15, 2009
Messages
1,092
Location
Midland, Michigan
This is very cool. Is it plausible to program the AI to use, say, wavedashing effectively by editing AIMan and AIPD?
It's possible, it's also possible for Meta Knight to realize how broken he is and begin chaingrabbing people. I personally don't know how this would be done (I'm sure those who have analyzed this in more detail might) but this is a possibility.
 

Dantarion

Smash Champion
Joined
May 21, 2007
Messages
2,492
Location
Santa Barbara, CA
Meh, I wouldn't say that until we figure out the parameters and such.

Right now we have almost NO clue wtf half the info is, so making our own AI is kinda hard for now.
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
I've searched AI meanings using USB Gecko.

AIMain(CE) commands
00: return
01 :set variable (arg1:ID arg2:value)
04 :goto?
06 :If (arg1: comparison method)
07 :If(NOT) (arg1: comparison method)
08 :else
09 :endif
0A :Add value (arg1:ID arg2:value)
0B :Subtract value (arg1:ID arg2:value)
0C :Multiple value (arg1:ID arg2:value)
0D :Divide value (arg1:ID arg2:value)
16 :Additional Requirement(OR) (arg1: comparison method)
17 :Additional Requirement(NOT,OR) (arg1: comparison method)
18 :Additional Requirement(AND) (arg1: comparison method)
19 :Additional Requirement(NOT,AND) (arg1: comparison method)
1B :Call another AI? (arg1:ID of another AI)
1C :Set goto? (arg1:ID?)

Comparison methods sometimes have arguments.
Comparison methods
1007 arg1>arg2
1008 arg1<arg2
1009 arg1>=arg2
100A arg1<=arg2
100C Get a value which was used to jump there and compare with the argument

Formats of values
~1000: variables set by command 01
1000~1FFF: variables in the game(e.g. distance between each character)
2000~: user value

There are many unknown things... It's still hard to make custom AI.
 

Dantarion

Smash Champion
Joined
May 21, 2007
Messages
2,492
Location
Santa Barbara, CA
Bero, a lot of your info is WRONG.

Here is my current list of command meanings.
Code:
    evtnames[0x00] = "Return"
    evtnames[0x01] = "Set Var"
    
    evtnames[0x04] = "REST?"
    
    evtnames[0x06] = "If"
    evtnames[0x07] = "If NOT"
    evtnames[0x08] = "Else"
    evtnames[0x09] = "End If"
    evtnames[0x0A] = "SMASHSTICK"
    evtnames[0x0B] = "PRESS"
    evtnames[0x0C] = "Multiply"
    evtnames[0x0D] = "Divide"
    evtnames[0x0E] = "HOLDSTICK"
    evtnames[0x16] = "|| Req"
    evtnames[0x17] = "|| !Req"
    evtnames[0x18] = "&& Req"
    evtnames[0x19] = "&& Req"
    
    evtnames[0x1B] = "Call AI"
    evtnames[0x1C] = "Set Goto?"
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
I don't think "a lot of" my info is wrong.
Excuse for my mistake:
Command 0x1C pushes address of command 0x03 to r29,and 04 pushes r29 to r30,which is used to parse AI.
So I thought 0x04 is goto.

Also,I'm sure that 0x19 is "&& !Req". The same routine is used to parse 0x07,0x17,0x19.
And 0xA,B,C,D in my info was certainly mistake.
0xC :AddVal
0xD :SubVal
0xE :MulVal
0xF :DivVal


EDIT
How did you understand 0xA and 0xB? Genius.
 

Dantarion

Smash Champion
Joined
May 21, 2007
Messages
2,492
Location
Santa Barbara, CA
Youre right, its not a lot! However, finding the button presses and the stick inputs helped a LOT at messing around with the AI

What I am doing is modifying them ingame.
The spotdodge function is the one that I have been modding to test my ideas.
http://dantarion.pastebin.com/k41DXCbe

Ill test your theories about 0xC-0xF tonight
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
I'm making scripting system(python) like Taboo.
I think it's my limit of understanding PPC assembler,so I'll do some examination by making some scripts.

By the way,do you have some idea about 10XX variable? I think having knowledge about them will be very useful to understand whole AI system.
 

Dantarion

Smash Champion
Joined
May 21, 2007
Messages
2,492
Location
Santa Barbara, CA
I found the ASM routines for the 0x10XX routines. Theres a seperate bit of ASM routines for the If commands 1st param, and a set for when 0x10XX are used as values.

The If ASM routines change r28 to 0 or 1

The 0x10XX VALUE routines return a float..i think f1 gets the valure


BTW, look at this...
I think we are thinking the same thing
http://dantarion.pastebin.com/GCiQN9SY
Code:
AIEventNames = {}
AIEventNames[0x00] = "Return"
AIEventNames[0x01] = "Set Var"

AIEventNames[0x03] = "Loop Start?"
AIEventNames[0x04] = "Restart Loop?"
AIEventNames[0x05] = "Exit Loop?"
AIEventNames[0x06] = "if"
AIEventNames[0x07] = "if!"
AIEventNames[0x08] = "Else"
AIEventNames[0x09] = "End If"
AIEventNames[0x0A] = "Stick"
AIEventNames[0x0B] = "Button"
AIEventNames[0x0C] = "Add"
AIEventNames[0x0D] = "Sub"
AIEventNames[0x0E] = "Mul"
AIEventNames[0x0F] = "Div"
AIEventNames[0x16] = "|| Req"
AIEventNames[0x17] = "|| !Req"
AIEventNames[0x18] = "&& Req"
AIEventNames[0x19] = "&& !Req"

AIEventNames[0x1B] = "Call AI"
AIEventNames[0x1C] = "Set Goto?"
Revised the list...
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
Dantarion,please let me make AI scripting system !
I think I'm one of the most interested in custom AI.
 

Dantarion

Smash Champion
Joined
May 21, 2007
Messages
2,492
Location
Santa Barbara, CA
Nice!

My code I wrote to rebuild the files in python works 100% as well. However, I have found something out.
CE files don't contain all of the AI.

The "Get on the Same Platform" and "Roll if your shield is about to break" and other functions are NOT in the CE file.

Even if you make an AI routine that just returns, the CPU will still do those actions without consulting the CE file.
As a result, we need to figure out AIPD purpose, and the other 2 common ai files.

ai_common Misc Data 0
Code:
No Header, Just entries...
Each Entry is...0x20 in size?
4 float, 1 in, 1 always 0, 2 float?
ai_common Misc Data 1
Code:
WTF?
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
Did you edit not only ai_common but also ai_char?

By the way,let's call second MiscData "AIMain" instead of "CE" because CE means "condition evaluation". That entry contains more contents as you know.
 

Dantarion

Smash Champion
Joined
May 21, 2007
Messages
2,492
Location
Santa Barbara, CA
Very Nice!

I am going to start making a chart for the behaviors of all of the AI.

Heres the basics of what I know.

#1. If the AI is not inside the bounding box of the platform you are on/over, the first thing it does is try to get inside that box. The AI routine for that is either hardcoded, or doesn't seem to be in CE/AIMain.

#2. One AI routine in AIMain actually = multiple routines.
For example 0070 is a routine that makes the character roll. However, when it is called ingame, it is called as 0071 or 0072. The routine uses a if to check to see what it has been called as, and then either rolls forward or rolls backwards based on the result. I lost my notes I had earlier, but here is a preview of what the routines REALLY do

002X - Walking Routines
004X - Dashing Routines
005X - Onstage Jumping Routines
007X - Rolling Routines
2040 - Up+B Recovery
603X - Ground Attack Routines
604X - Aerial Attack Routines

I am going to work on figuring out the rest of the commands. Keep up the work Bero!
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
I was thinking the same thing about #2. Command "CallAI" has variables such as 51,6031.
Looking inside of them, there are if blocks whose first arguments are 100C,and second are 002X,004X,etc.
So I think requirement "100C" is judging whether second argument is used for AI jumping.

EDIT
Sorry,I noticed that you wrote the same thing...
 

Dantarion

Smash Champion
Joined
May 21, 2007
Messages
2,492
Location
Santa Barbara, CA
Awesome!

BTW, have you figured out how the AI decides what states to go into? I can see that certain ones always link into certain other ones explicitly, but some of the AI just uses Return, and the next AI state seems to be be pretty random after that
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
I don't know it but, as I said before, I think 03,04,1C(05 also uses the same routine) are key. 1C searches position of 03 and count, then stores address into r26. 04 copies r26 to r30,which is used as current position pointer in parser routine.
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
Dantarion, I need your idea. I'd like to indent if block, but "unexpected indentation" error comes. No good ideas occur to me... The other things have been done.
 

Dantarion

Smash Champion
Joined
May 21, 2007
Messages
2,492
Location
Santa Barbara, CA
youre using iron python for the scripts?

I kinda decided against that, simply because the python syntax interferes with the actual code.
I would just try writing a parser by hand.

The way I am doing it is this.

Parser scans script, discaring whitespace, tabs, and newlines
Parser hits string, reads string until it hits either "(" or whitespace.

If the string is a command, you read into a string until you hit "," or ")" and add it on as a param.

For params, if you hit a float, and its not already in the global block for that routine, add it. If it is, just lookup which float it is and add 0x20XX to the params.

for if/else/endif, if you find a } and the next command is NOT else, then it is a endif, if you do, then its just an else.

Take a look at my dumps, they are almost parsable, and actually match C syntax right now, other than the if statements
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
Hmm... So, you made a script language yourself?
OK. I'll try it.
 

Dantarion

Smash Champion
Joined
May 21, 2007
Messages
2,492
Location
Santa Barbara, CA
I made my output script output the text in a way that almost matches C syntax. Now I am building a scanner that takes the output and turns it back into Brawls format.

I am not meaning to duplicate the amount of work, I have wanted to make a code parser for a while to see how hard it is, and because I am planning a game that may end up using a homegrown scripting system.
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
I decided to adopt "Python imitation". The difference between it to real python is whether indentation can be used or not. In fact, I made a preprocessor which removes all spaces...
Anyway, I finished making the editor.
 

Bero

Smash Journeyman
Joined
Jan 10, 2010
Messages
409
Location
Japan
I'd like to test it more, so I will be able to release by the end of this week.
Do you think we should have a new collaboration thread? I think it will be necessary when everyone starts experiment with the editor. But I also think it's good that we don't release anything until we make entirely new AI as a surprise like phoenix mario:)(that way, I'm not sure whether I can release by my end of life...)
 
Top Bottom