Persona 3 AICALC info dump by Phoenix and whoever shows up to this thread
Posted: Tue Dec 07, 2021 11:32 pm
Howdy! I'm Phoenix, creator of the New Moon mod for Persona 3, and the intention of this thread is to get my knowledge of this game archived on the internet. Additionally, any insightful information contributed by other forum users/ modders may be present, so if you're from five years from the future and you want to understand how this game works for your own mods or for a neat speedrunning exploit:
THIS IS FOR YOU
But enough about me, let's dig in.
A readable version of the AI can be found in this commit of New Moon (before I began modding it): https://github.com/Phoenix-neat/NewMoon ... 16fa90b5f0
Persona 3 FES (FES) will be addressed the most here, as it is the one I have the most experience with, along with the occasional mention of Persona 3 Portable (P3P). The original version (P3) will be rarely, if ever, touched on as there is no reason to mod a significantly rarer version of FES with zero advantages over such.
AICALC contains the AI for both party members and bosses. These files can be accessed by locating "FLW0" in a hex editor, selecting that and the eight bytes behind it (the FES version starts with 00 00 00 00 D9 58 01 00 46 4C 57 30) and continuing the selection down to either the bottom for the second (and last) FLW0, or to the top of the second one for the first. The party AI is first and the boss AI comes after.
The party AI ranges from (DC80h) to (2:3950h), with the boss AI from (2:3960h) to (7:FFC0h) in unmodified FES.
Additionally, FES has separate AI files for The Answer and The Journey, with The Answer's variant being called "AICALC_F". The thing is, these files are completely identical, containing all bosses in both The Journey AND The Answer IN BOTH. This information is important as it can be used to either
a) easily put bosses that are exclusive to one version into the other
b) reduce file size by allowing one to delete bosses that aren't in that version while keeping them intact in the other
The file size for either file is, for whatever ungodly reason, capped by the game at around 512kb, but this is incredibly inconsistent. For instance, I've had occasions where certain file sizes would be acceptable in The Journey, but not The Answer. When in doubt, keep it below 512kb, or use Tupelov's AI patch to bypass the size limit (more on that later).
Party AI is shared by all party members and split amongst the selectable menus, with an additional menu for Orgia mode. TECHNICALLY each party member has a separate function for each tactic, but the game will just call Yukari's version for each additional party member. The menus are ordered as follows:
AI_PC_00X_00Y
"X" being the party member ID and "Y" being the menu ID.
X has the following values:
Yukari = 2, Aigis = 3, Mitsuru = 4, Junpei = 5, Akihiko = 7, Ken = 8, Shinjiro (Metis in AICALC_F) = 9, Koromaru = A
1 and 6 typically refer to The Protagonist (Makoto) and Fuuka respectively, which is likely why they are skipped.
Y has the following values:
Act Freely = 1, Knock Down = 2, Attack Fallen = 3, Full Assault = 4, Heal and Support = 5, Conserve SP = 6, Assign Target = 7, Same Target = 8, Stand By = 9, Orgia mode = A
For example, AI_PC_005_004 is AI for Junpei Full Assault.
As obvious as this may sound, Orgia mode functions only exists for Aigis and Metis, so there is no empty AI_PC_002_00A function, it doesn't exist. Metis' orgia mode function exists in AICALC for The Journey as well, but it is unused.
Each boss, and certain unique enemies (i.e. golden hands, many enemies in Monad, etc), has their own AI function. Each function is assigned to a boss in AICALC, and it is possible to modify which enemy gets what function. Each enemy gets a function (they can share functions, most enemies have a generic enemy one) that is ordered by what number function it is. I.e., the first function is function 1, the last function is function 240. If you add functions to the game, you can get it to call these functions by the number it is.
A word of advice for freeing up space is to keep unused boss functions, but to remove the data in them. This still reduces the size greatly, but it keeps the functions in order so you don't have to reorder them all again. This will be your worst nightmare. To add more functions, remember the last one in unmodded FES is 240, so your first one will be 241, your second 242, etc. The location of the table segment that controls enemy AI assignment is right before the party AI FLW0. Enemies are ordered by their ID which can be referenced with the Enemy ID table on the wiki.
That's all for now, I'm going to go to bed. In the next edition, we'll discuss more on the file size limitations, some AI quirks, and more.
THIS IS FOR YOU
But enough about me, let's dig in.
A readable version of the AI can be found in this commit of New Moon (before I began modding it): https://github.com/Phoenix-neat/NewMoon ... 16fa90b5f0
Persona 3 FES (FES) will be addressed the most here, as it is the one I have the most experience with, along with the occasional mention of Persona 3 Portable (P3P). The original version (P3) will be rarely, if ever, touched on as there is no reason to mod a significantly rarer version of FES with zero advantages over such.
AICALC contains the AI for both party members and bosses. These files can be accessed by locating "FLW0" in a hex editor, selecting that and the eight bytes behind it (the FES version starts with 00 00 00 00 D9 58 01 00 46 4C 57 30) and continuing the selection down to either the bottom for the second (and last) FLW0, or to the top of the second one for the first. The party AI is first and the boss AI comes after.
The party AI ranges from (DC80h) to (2:3950h), with the boss AI from (2:3960h) to (7:FFC0h) in unmodified FES.
Additionally, FES has separate AI files for The Answer and The Journey, with The Answer's variant being called "AICALC_F". The thing is, these files are completely identical, containing all bosses in both The Journey AND The Answer IN BOTH. This information is important as it can be used to either
a) easily put bosses that are exclusive to one version into the other
b) reduce file size by allowing one to delete bosses that aren't in that version while keeping them intact in the other
The file size for either file is, for whatever ungodly reason, capped by the game at around 512kb, but this is incredibly inconsistent. For instance, I've had occasions where certain file sizes would be acceptable in The Journey, but not The Answer. When in doubt, keep it below 512kb, or use Tupelov's AI patch to bypass the size limit (more on that later).
Party AI is shared by all party members and split amongst the selectable menus, with an additional menu for Orgia mode. TECHNICALLY each party member has a separate function for each tactic, but the game will just call Yukari's version for each additional party member. The menus are ordered as follows:
AI_PC_00X_00Y
"X" being the party member ID and "Y" being the menu ID.
X has the following values:
Yukari = 2, Aigis = 3, Mitsuru = 4, Junpei = 5, Akihiko = 7, Ken = 8, Shinjiro (Metis in AICALC_F) = 9, Koromaru = A
1 and 6 typically refer to The Protagonist (Makoto) and Fuuka respectively, which is likely why they are skipped.
Y has the following values:
Act Freely = 1, Knock Down = 2, Attack Fallen = 3, Full Assault = 4, Heal and Support = 5, Conserve SP = 6, Assign Target = 7, Same Target = 8, Stand By = 9, Orgia mode = A
For example, AI_PC_005_004 is AI for Junpei Full Assault.
As obvious as this may sound, Orgia mode functions only exists for Aigis and Metis, so there is no empty AI_PC_002_00A function, it doesn't exist. Metis' orgia mode function exists in AICALC for The Journey as well, but it is unused.
Each boss, and certain unique enemies (i.e. golden hands, many enemies in Monad, etc), has their own AI function. Each function is assigned to a boss in AICALC, and it is possible to modify which enemy gets what function. Each enemy gets a function (they can share functions, most enemies have a generic enemy one) that is ordered by what number function it is. I.e., the first function is function 1, the last function is function 240. If you add functions to the game, you can get it to call these functions by the number it is.
A word of advice for freeing up space is to keep unused boss functions, but to remove the data in them. This still reduces the size greatly, but it keeps the functions in order so you don't have to reorder them all again. This will be your worst nightmare. To add more functions, remember the last one in unmodded FES is 240, so your first one will be 241, your second 242, etc. The location of the table segment that controls enemy AI assignment is right before the party AI FLW0. Enemies are ordered by their ID which can be referenced with the Enemy ID table on the wiki.
That's all for now, I'm going to go to bed. In the next edition, we'll discuss more on the file size limitations, some AI quirks, and more.