Home Gallery Resources The Team Rules chat Login Register
  Show Posts
Pages:  1 2 3 [4] 5
46  Super Smash Bros. Brawl Hacking / Programming / Re: [AI coding]AIScriptpad2.0 Support Thread on: September 13, 2013, 10:50:27 AM
To implement that feature, we need to do following things:
Copy recovery routine(ID:2010 and 2040) from Fighter.pac
Edit up b section

Basically, when you perform some attack, the system automatically quits current script and arbitrarily goes to other scripts. Thanks to your post, I noticed that Pikachu could use up b properly though it needs another input after up b. It is worth looking into and after I find something, I will tell you how to make Mario use up b properly.
47  Super Smash Bros. Brawl Hacking / Programming / Re: [AI coding]AIScriptpad2.0 Support Thread on: September 13, 2013, 08:17:59 AM
If you could tell me more specifically I would be willing to help you:)
48  Super Smash Bros. Brawl Hacking / Programming / Re: [AI coding]AIScriptpad2.0 Support Thread on: September 12, 2013, 06:46:01 PM
@Tailsmiles249
I'm very surprised to see a person who uses AIS except for KingClubber.
I repeatedly stopped and resumed researching AI these 2 years. I hope you like this new version.

@SonicBrawler
As Eternal Yoshi says, it isn't controlled by AI files. Surprisingly, the developer of this game intentionally made CPUs target human players.
49  Super Smash Bros. Brawl Hacking / Programming / Re: [AI coding]AIScriptpad2.0 Support Thread on: September 12, 2013, 01:08:18 PM
Oh thanks.
This summer I made a lot of discoveries and this version includes them.
So making good AI became easier.

I think people cannot see how this program works, so I'll make an example soon.
50  Super Smash Bros. Brawl Hacking / Programming / Re: [AI coding]AIScriptpad2.0 Support Thread on: September 12, 2013, 12:30:27 PM
We couldn't set targets of CPU from AI scripts. It is decided by the game.

With this program, we could make characters recover well, use weapons, play more aggressive .  I should have made an example first.
51  Super Smash Bros. Brawl Hacking / Programming / Re: [AI coding]AIScriptpad2.0 Support Thread on: September 12, 2013, 12:05:12 PM
Thank you:D
In fact, I made version 1 two years ago.
It didn't gain so much popularity and people forgot its existence. No one seems to be interested in this version too. lol

Do you have any questions? Questions not related to coding are OK.
52  Super Smash Bros. Brawl Hacking / Programming / [AI coding]AIScriptpad2.0 Support Thread on: September 11, 2013, 08:43:46 AM
    Hello, I'm Bero, author of AIScriptpad.
    Have you ever been interested in AI coding? AIScriptpad is a program for making AI. I developed version 1 two years ago. And this time, AIScriptpad evolved drastically including new coding language, which was developed only for AI. The syntax of this language is so simple that you can learn it within 2 days. Graphical tutorial is included in the program, but I write them down here. In the program this tutorial is a lot easier to read.



Introduction
    AIScriptpad is a program for making artificial intelligence(AI) in Super Smash Brothers Brawl.
    AI should essentially play an important role in SSBB. Though this game was made to play with friends, many people spend time playing with CPU. So CPU's quality directly affects the game's quality. It goes without saying that the original AI is optimized for original game and AI doesn't work fine on modded characters. Using this program, you can fix things like your character cannot recover, use weapons, etc. Some may try to make ultimate AI which does techniques perfectly. Let's make smart AI with this.

Creating project
    What you do first is to make a "project". Project manages resources which are needed to make AI. You can create a project from Menu->File->New->Project. When you click it, a window called ProjectManager will appear. In this window, you fill these informations:Project name, Pac file to develop, Working folder in which scripts and built node will be saved. Pac file can be "FitCharMotionEtc" or "common3". The former holds AI scripts of one character in binary format and the latter holds shared AI scripts. You can mark "Use absolute" checkbox. When you create working folder in other drive, mark this checkbox. After you filled these informations, press "Create project".

Building pac file
    After you wrote scripts, you can compile into pac. Click Tool->Full rebuild and the pac file will appear in WorkingFolder/Build. You will be already able to use this pac in the game. There are other options. "Rebuild AIMain" will rebuild only AIMain scripts. The same thing can be said about "Rebuild AIPD", "Rebuild ATKD". "Full rebuild all projects" will compile all the projects in your "solution",which will be mentioned in the next page. "Build and distribute" will build pac file and copies to the place in which original pac file was stored.

Creating solution
    When you make some projects, you may want to access them and switch them at once. Solution makes it possible. Solution is a unit which manages many projects. You can regard it as a shortcut for each projects. To create solution, click File->New->Solution. After you click, a window titled "SolutionWizard" will appear. You decide the name of the solution, a place where the solution file will go, and optionally you can select projects that already exist. You can mark "Use absolute path". Then click "Create solution" and the solution will be created. You can add projects after making a solution by clicking "Add projects".

Miscellaneous features
    Find/Replace offers a function by which you can search particular texts and replace them. You can also use this function by using "ctrl+F","ctrl+H".
    In "Property", you can change some settings of the program ,project and solution. By checking"Emit command lists",the program emits raw command calls after you build a project. These command calls will be shown in LogWindow.  You can associate file formats used by AIScriptpad to AIScriptpad by selecting one of them in "Associate".
    In "Reference", you can see the usage of commands, functions, requirements, events, modules and subactions. The information are gathered from header file which defines them.
    In "Help" you can see this help or this program's description.

AIMain introduction
    AIMain is a main file which describes most of CPU's behavior. In this file you make decision and decide stick input direction and buttons to be pressed.
    You use "commands" to request the system to do some work. There are many commands but the number of really useful commands is small. Let's see from very easy example.

Stick input
    First example is "AbsStick". This command controls CPU's stick input. "AbsStick 1" moves the character to right. "AbsStick -1" moves left. The digit means how you input stick horizontally. So "AbsStick 0.5" inputs stick right with 50% power. You can specify vertical input strength. "AbsStick 0 1" inputs stick up and "AbsStick 0 -1" inputs stick down.
    There is another similar command, "Stick". The difference is that Stick takes the character's facing direction into account. Let's see an example. "Stick 1" inputs stick to the direction of the character's front. "Stick -1" inputs stick to the back. Vertical input is the same as that of AbsStick. You may wonder why we didn't name "AbsStick" as "Stick" and "Stick" as something because AbsStick seems to be standard stick input method. It's because Stick was found first and AbsStick next. At first they couldn't see difference between them and named Stick and "TargetStick".

Buttons
    After you learned stick inputs you may well wonder how to input buttons.
    To input buttons you can simply write "Button A". This inputs A button. You can specify multiple buttons writing like "Button A | R".

Input examples
    At this point, we could already write the CPU's behavior.
    A combination of "Button R" and "AbsStick 1" will have the CPU roll right. "AbsStick 0 -1","Button A" will produce DTilt. "AbsStick 0.5" will make CPU walk right and "Stick -1" will cause constant dashdance.

Variables
    To make better decision, some calculation is necessary. For example, if you would like to know if the opponent is in front of the character, you have to take the character's facing direction and the opponent's position(left or right) into consideration. You use "variables" to do this. Variables are something like boxes which contain values. There are 24 variables that can be used. To use variables, you can simply write "var0=1". This code assigns 1 to var0. "var0=var1" will copy the value of var1 to var0. You can do some calculations and assign the result using this syntax:"var0=var1+var2".
    You can get information of the environment using "Functions". Functions can be used like variables and normal values. For example, "XCoord" is a function which returns the character's x coordinate. You can use this by "var0=XCoord". Of course you can do calculations "var0=XCoord-10".
    Following code is a more advanced example. "var0=OPos*Direction" OPos is a function which returns 1 if the opponent is right and -1 if is left. Direction is a function which returns 1 if the character is facing right and -1 if facing left. So if the result of this code is positive, the opponent is in front of the character. Otherwise the opponent is in back of the character.

If sentences
    If you couldn't switch the behavior of the character depending on situations, the character would do the same thing constantly. Of course you can switch moves of CPU. "if" sentences enable it. To use if sentences, write "if var0 > 0". This code means if var0 is positive, the system will execute following codes. if sentences must be closed by "endif". After writing some lines after if sentence, write "endif" to close if block. You may want to do something if the requirement is false. In such situation, write "if !(var0>0)". If var0 is lower or equal to 0, following codes are executed.
    You may want to do something when the requirement is met and also when the requirement is not met. In such case, write "else".
if ...
    ...
else
    ...
endif
is a standard syntax of if block.
    When you want to evaluate additional requirement, you can write "elif". With elif, you can evaluate requirements if previous requirements are all false. Example:
if ...
    ...
elif ...
    ...
endif
    Please note that you cannot write "if" right after an "else" because the count of "endif" becomes wrong. Use "elif" instead.
    There are many cases that you want to evaluate multiple requirements at one time. In such cases, write "&&" "||". "&&" means "and" requirement and "||" means "or" requirement. Let's see an example. "if var0 > 0 && var0 < 10" means "if var0 is in between 0 and 10, execute following codes". "if var0 < 0 || var0 > 10" means "if var0 is negative or greater than 10, execute following codes". Finally, I show you a big example.
if XCoord > 10
    AbsStick 1
elif XCoord > 0
    Button X
else
    Stick 1
endif
    With this code, the character goes right if the X coordinate is larger than 10. Otherwise, if X coordinate is positive, presses x button. Otherwise, the character goes front.

Labels and seek
    We have looked important parts of AIMain and we have learned 70% of it. The las 30% is control flow syntax. The match lasts more than 1 frame of course. To deal with situations more than 1 frame, it is necessary to write loop. To write loop, you use these commands:"label","Return". It's a little difficult to explain in words, let me explain using an example.
label
...(Do something. Call this part A)
Return
    This code executes A and when the execution reaches "Return", the system stops execution for 1 frame. After 1 frame passed, the system resumes from the position of "label" and executes A, reaches "Return",... When you want to finish loop, there are two options. One is that you stop the execution of the routine. You can simply do this by writing "Finish". This is the example:
label
...
if var0 > 0
    Finish
endif
Return
    The other is to go other label block. You can do this by a command "Seek". By simply writing "Seek", the system searches next "label" in the code. And if it could find one, the system remember the position of it. The execution from next frame will resume from the point. This is the example:
label
...
if var0 > 0
    Seek
endif
Return

label
...
    Seek can have an argument, which refers to names of labels.
label
...
if var0 > 0
    Seek _foo
else
    Seek
endif
Return

label
...
Return

label _foo
...
Return
    In first loop,if var0 is positive, goes to _foo after 1 frame. if var0 is 0 or negative, goes to next label.

Jump and Goto
    We go on seeing execution flow. You may want to jump to next label immediately. In such case, write "Jump". With this command, the system immediately goes to a label which was saught before.
    There is a useful command named "Goto". This command resembles to Seek, but you can immediately jump to a label and you can go back to previous position. This is the example:
...
Goto _subroutine
...(A)

label _subroutine
...
Return    //go back to (A)

Routines
    AIMain codes are separated into "routines", which have their own roles. For example, routine 6031 deals with ground jab, and routine 70 deals with roll. You can call routines from AIMain script. "Call 0x6031" will call routine 6031. I have already named some routines and you can use the names as an argument. So this is valid command call:"Call Jab123". (Jab123 is the name of routine 6031). Don't forget prefix "0x" when you use raw routine names, otherwise AIScriptpad recognizes the value as normal value like "var0=1".
    Sometimes you may want to add routines. To add routines, you can do it by simply adding scripts into "Scripts" folder in the project directory.

Coding idioms
   We have aquired basic knowledge of AIMain. Now I'll explain coding idioms that are often used in binary and actual coding.
    To know whether the opponent is in front or not, write this:
var0=OPos*Direction
if var0 > 0
    //code when the opponent is in front of the character
else
   //code when the opponent is in behind of the character
endif
    When coding, we often want to wait for the character to finish current action. In such case, write this:
if !Dashing && !Idling
    Return
endif
    If you want to fast fall in air, write this code:
if InAir && YSpeed < 0
    AbsStick 0 -1 //this can be substituted with Stick 0 -1
endif
   
Coding miscs
    It is highly recommended to write comments in your source code. It's common that you cannot understand what you wrote yesterday. You can write comment by "//comment".
   
    When the compiler compiles scripts, it expands expressions into raw command calls. For example, it will expand "var0=OXCoord-XCoord" to "SetVar var0 OXCoord" and "Sub var0 XCoord". Sometimes it allocates temporary memory from var23. So usage of high number memories like var23,var22 may sometimes cause some troubles. You should avoid using such memories.
   
    When you compile, you may get some error messages. Sometimes line number in the message may be pointing odd place. In this case, the error is in header file. Check your header file or those in "Include" folder.
   
    When you are coding AI, you may discover new function, requirement, routine usage, etc. In such case you can define your findings in header file. For example, if you find a new function, you can write like this:
func MyFunc : 0x50
    This defines function number 0x50 as MyFunc. You can use this name in AIMain scripts. This is a list of definition syntaxes:
*Command---cmd CmdName : 0x(number) argument1 argument2 ...
*Function---func FuncName : 0x(number)
*Requirement---req RequirementName : 0x(number) argument1 argument2...
*Routine--- act RoutineName : 0x(number)
*AIPD requirement(situation)---event ReqName : 0x(number)
*Subaction---sact SubactionName : 0x(number)
    You can add explanation for each definitions. Write "///" just before these definitions and after ///, write explanation. It will show up in FunctionWindow,which you can open from Reference->Command,etc.

AIPD
    I will explain how to code AIPD.
   AIPD defines largely two things. Attack dice roll definitions and AIMain call definitions. Generally you don't have to edit the former. The latter defines when each AI script is called. The latter has sets of  entries which have following things: AIMain routine name,high frequency value,low frequency value,max level, min level. I explain from head. AIMain routine name is what you use as "Call" argument in AIMain. They are such as RollF, Jab123. How frequent the routine will be called is calculated by following expression: (levelvalue-min)/(max-min)*low+(max-levelvalue)/(max-min)*high. If levelvalue > max, (max-levelvalue)/(max-min) will be 1. If levelvalue < min, (levelvalue-min)/(max-min) will be 1. Levelvalue is a value which changes depending on the CPU level. This is a list of levelvalue.
Level1---0
Level2---15
Level3---21
Level4---31
Level5---42
Level6---48
Level7---60
Level8---75
Level9---100
    Each set has requirement and if the requirement is met, one of the entries in the set will be called after dice roll considering the frequency value. You can specify two requirements but you can omit one of them. This is the example:
fXClose{
    Jab123 100,0,75,21
   FTilt 30,25,100,0
}
    In this example, Jab123 and FTilt will be called when the opponent is in front of the character and they are close together. High value of Jab123 is 100,low is 0,max is 75,min is 21. High value of FTilt is 30,low is 25,max is 100,min is 0. So Jab is likely to be called in this situation.
    To specify multiple requirements to one set, you can do it by writing "&&" and "||". The role of these is the same as that in AIMain so I skip the explanation. You can also negate a requirement using "!". Usage is the same as that in AIMain.
    Sometimes you may want to set a requirement which is applied to multiple sets. In such case, write "if ..." before the head of the sets. This is the example:
if SamePlane

fXClose{
    ...
}

...
endif


ATKD
    ATKD means "Attack definition" and it defines the attacks of the character. There are entries for each subaction and each entry defines following things:
*Start frame
*End frame
*Offensive collision minimum x length
*Offensive collision maximum x length
*Offensive collision minimum y length
*Offensive collision maximum y length
Start frame and end frame are integer values and the rest can be any value. There is also a value called "unk" but it's always 0 so you don't have to be aware of it.

Debugging
    After you build pac file, you have to debug it on Wii. There are two useful codes which help you debug. Dantarion's routine visualizer code visualizes running routine in training mode. To use it, create GCT file with the code and go to training mode, turn on information, and running routine will be displayed in one of the information windows. My force code with button activation will force the system to run specified routine. While you are pressing a button, the system constantly runs the spesified routine.


    Please feel free asking me any questions about AI coding here. Also, when you find some bugs in this program, I'll be grad if you tell me how it occurred.

Screen shots:
Script

Interface

Tutorial window

53  Super Smash Bros. Brawl Hacking / Programming / Re: Brawlbox v0.67 Released - Source Code now on Google Code SVN on: July 08, 2012, 12:20:09 AM
Hi,BJ

I heard you implemented movedef rebuilder. It looks great!
If you make a program language for movedef, you may be greater than Phantom Wings.
54  Super Smash Bros. Brawl Hacking / Programming / Re: Brawlbox v0.66 coming soon. All animation formats & versions viewable & editable on: April 09, 2012, 07:15:38 AM
Hey BJ(or Niko?).
I heard my PAT0 rebuilder was corrupted. I was very sorry about it and made proper rebuilder.
If you haven't fixed the rebuilder,I will give you the source code. Even if the new code still has some bugs, you'll be able to find the point where it occurs because the new one is far plainer than the old one.
55  Super Smash Bros. Brawl Hacking / Programming / Re: Brawlbox v0.65b Beta Released. on: January 28, 2012, 04:01:47 PM
you know...
both Kryal and Bero seemed to return out of nowhere <_<

were you guys stuck in the void or something??

and who's going to be returning next?? :|
Unfortunately, I will have entrance exam next year and I have to study through this year.
If I could successfully enter the university, I may join developing BBox...

BTW BJ, did XYZ bug cause all bugs? I'm sorry for not understanding what you said.
56  Super Smash Bros. Brawl Hacking / Programming / Re: Brawlbox v0.65b Beta Released. on: January 28, 2012, 07:02:51 AM
@BJ
Thanks for reply.
As Xiggah said,0.63d could show the model properly,so I will try to find the bug in your source code comparing to 0.63d source.
57  Super Smash Bros. Brawl Hacking / Programming / Re: Brawlbox v0.65b Beta Released. on: January 27, 2012, 04:21:03 AM
Hey,BJ. I'm Bero,who had programmed BBox before you started to program it.
Though I developed BBox,I didn't touched model things and have a question about them.

Why is it that textures of some models(menu and etc.) aren't shown properly on model previewer?
Because I'd like to make a title scene on my own,I have to use your model importer.
I think I should first export the model,but the previewer shows it like this:
http://img571.imageshack.us/img571/5593/65831308.png
58  Super Smash Bros. Brawl Hacking / Programming / Re: DAE2MDL0 Conv. & Brawlbox v0.64 Modset: Demo released! on: June 28, 2011, 04:44:10 AM
AWESOME!
I'm surprised to hear that you guys finally achieved perfect model importing.
Who did this stuff,BlackJax96 or Tcll?
Anyway, good job!!
59  Super Smash Bros. Brawl Hacking / General Hacking Discussion / Re: Brawlbox Modset 4 is here! Draggable bones, among other things on: November 21, 2010, 03:38:59 PM
@RydiaFromFF2
At last,tutorial for modset! Thank you!

@LordNOaH
Umm... I think it's good to have a thread about modset here,but it's a bit hard for me to look after it...

@ForOhFor Error
That will use large amount of memory. I think it's not hard though.
60  Super Smash Bros. Brawl Hacking / General Hacking Discussion / Re: Brawlbox Modset 4 is here! Draggable bones, among other things on: November 21, 2010, 04:29:20 AM
Drag and Drop Translation = Stage Hacker Preference
Drag and Drop Rotation = Animation Hacker Preference

Stage hackers would prefer drag and drop for translations. That's why it would be suggested. Though not anywhere as annoying as bone rotation for animations, I'm sure it would make stage hackers quite a bit happier.

I'm saying that based on the fact that I hate the draggable bones and interpolation. Makes character animation not worth doing for me. Tongue
Oh,is drag and drop rotation annoying and do you hate it?
I advise you not to use Modset.  Tongue
Pages:  1 2 3 [4] 5