AINB: Difference between revisions

Jump to navigation Jump to search
273 bytes added ,  2 months ago
Rewrite head of article to clarify information.
(update resident update stuff -> active node)
(Rewrite head of article to clarify information.)
Line 1: Line 1:
'''AINB''' ('''AI''' '''N'''ode '''B'''inary) is a file format used for AI and logic in ''Tears of the Kingdom'' as well as other recent Nintendo EPD games. This article is primarily aimed at the version that appears in ''Tears of the Kingdom'' and ''Super Mario Bros. Wonder'' (v0x0407). AINB files can be found in the AI, Logic, and Sequence folders of the romfs as well as within various packs.
'''AINB''' ('''AI''' '''N'''ode '''B'''inary) is a file format implementing behavior trees for game-specific code. At time of writing it has only appeared in titles on the ModuleSystem game engine. This article is primarily aimed at the version that appears in ''Tears of the Kingdom,'' ''Super Mario Bros. Wonder, Mario vs Donkey Kong,'' and ''Nintendo Switch Online: Playtest Program'' (v0x407). An older version appears in ''Nintendo Switch Sports'' and ''Splatoon 3'' (v0x404). ModuleSystem provides 3 built-in file categories that appear in their own dedicated folders in a title's romfs, being "AI" for actor behavior, "Logic" for actor ai group behavior, and "Sequence" for scene behavior, individual games are free to create their own file categories.


=== File Structure ===
=== File Structure ===
AINB is a little endian format similar to most Switch file formats. An AINB file consists of a set of interconnected nodes which act like a syntax tree and control the behavior of actors. These nodes can also be calls to external AINB files (known as modules), allowing AINB files to form entire trees of files. The root file of the tree will have <code>.root.ainb</code> as their extension while each module in the tree will have the extension <code>.module.ainb</code>. There are three primary categories of AINB files in ''TotK'': AI, Logic, and Sequence. For AI and Sequence files, the file's entry point is one or more commands which is linked to one or two child nodes. All nodes are accessed by their index (references to precondition nodes will use their precondition node index which is local to the amount of precondition nodes in the file).
AINB is little endian. An AINB file defines a set of commands to evaluate a tree of built-in or game-specific node classes. The built-in "Element_ModuleCaller" node and supporting structures allow a "root" AINB file to call out to an external "module" AINB file, module's can call further modules, allowing AINB files to form a tree of tree's. An AINB's file extension typically designates whether it is a root <code>.root.ainb</code> or module <code>.module.ainb</code>. For AI and Sequence files, the file's entry point is one or more commands which is linked to one or two child nodes. All nodes are accessed by their index (references to precondition nodes will use their precondition node index which is local to the amount of precondition nodes in the file).


All string offsets in the file are relative to the beginning of the string pool and name hashes are 32-bit murmur3 hashes. There are six possible types for AINB parameters: int (signed 32-bit integer), bool, float (32-bit), vector3f, and pointer. Pointer parameters are pointers to objects.
All string offsets in the file are relative to the beginning of the string pool and name hashes are 32-bit murmur3 hashes. There are six possible data types for AINB parameters: int (signed 32-bit integer), bool, float (32-bit), vector3f, and pointer. Pointer parameters are pointers to objects.


==== Section Order ====
==== Section Order ====
Line 168: Line 168:
|0x04
|0x04
|u32
|u32
|File Category (0 = AI, 1 = Logic, 2 = Sequence) - only ''TotK'' ( for ''Splatoon 3'', 3 = UniqueSequenceSPL)
|File Category (0 = AI, 1 = Logic, 2 = Sequence) (''Splatoon 3'' game specific, 3 = UniqueSequenceSPL)
|-
|-
|0x68
|0x68
46

edits

Navigation menu