Editing ActorSerializeParameter and AI
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 3: | Line 3: | ||
<code>ActorSerializeParameter</code> is a property on each object in an <code>ActorGeneratorList</code>. It contains much of the "per-instance" characteristics of the enemy it is generating, and contains parameter such as AI, object life and audio. | <code>ActorSerializeParameter</code> is a property on each object in an <code>ActorGeneratorList</code>. It contains much of the "per-instance" characteristics of the enemy it is generating, and contains parameter such as AI, object life and audio. | ||
− | Each | + | Each membor of <code>ActorSerializeParameter</code> is an object containing <code>Static</code> and <code>Dynamic</code> properties, both of which are varying-width arrays of 8bit integers that represent other data types. |
<source lang="JSON"> | <source lang="JSON"> | ||
Line 11: | Line 11: | ||
"AI": { | "AI": { | ||
"Static": [], | "Static": [], | ||
− | "Dynamic": [] | + | "Dynamic": [] |
− | } | + | } |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
} | } | ||
Line 41: | Line 18: | ||
</source> | </source> | ||
− | For the majority of actors in the game, most of the fields within <code>ActorSerializeParameter</code> are the same for each type of enemy | + | For the majority of actors in the game, most of the fields within <code>ActorSerializeParameter</code> are the same for each type of enemy. A data scrape of each unique value that each type of enemy can have can be found [https://github.com/Chagrilled/P4-DandoriDesktop/blob/master/src/api/entityData.json/ here] (note, does not include night enemies). This can be used for sourcing the non-changing values, or for various examples of each byte array for every creature and object. (Generating code is [https://github.com/Chagrilled/P4-DandoriDesktop/blob/master/scrape.js/ here]). |
== AI == | == AI == | ||
− | AI is the interesting and important parameter. It controls per-instance parameters for actors such as drops, territory, and configuration for gimmicks. I currently believe that AI is mapped on top of an entity's own blueprint configuration from its <code>Placeables/</code> file, with AI able to send overrides to parts of it, | + | AI is the interesting and important parameter. It controls per-instance parameters for actors such as drops, territory, and configuration for gimmicks. I currently believe that AI is mapped on top of an entity's own blueprint configuration from its <code>Placeables/</code> file, with AI able to send overrides to parts of it. |
+ | |||
+ | Thus far, 3 types of teki AI have been partly charted, mostly pertaining to the inventory system. | ||
=== Concepts === | === Concepts === | ||
Line 51: | Line 30: | ||
Before trying to break down a byte array, it helps to understand a few concepts of the data types used: | Before trying to break down a byte array, it helps to understand a few concepts of the data types used: | ||
− | * Each integer in the array is a single 8-bit | + | * Each integer in the array is a single 8-bit value, so can only go up to 255. |
− | * The arrays are not fixed to 32-bit boundaries. A | + | * The arrays are not fixed to 32-bit boundaries. A 1byte float can be adjacent to a 16bit integer. |
− | + | * Floats are little-endian, and 1 byte long. For example the value <code>100</code> will be a byte of <code>0, 0, 200, 66</code>. | |
− | * Floats are little-endian, and | + | * Integers can also be encoded across 16-bits (two integers of this array). For example, the value <code>271</code> would be <code>15,1</code> - 15 + (256 * 1). They are also sometimes just 1-byte long with the value at index 0. |
− | * Integers can also be encoded across | + | * Strings are encoded by 1 byte dictating the length of the string (null terminator included) followed by the string's characters in ASCII codes, ending with <code>0</code>. For example the string of <code>None</code> will be encoded as <code>5, 0, 0, 0, 78, 111, 110, 101, 0</code>, with 5 being the length of the string (4 chars + <code>0</code>). |
− | * Strings are encoded by | + | * When arrays/objects are used (for fields like <code>DropConditions</code> or <code>bSetTerritory</code>, there is often a 1 byte boolean that dictates if the rest of the object is present, or the number of items in the array. For example, with territory, if <code>bSetTerritory</code> is <code>false</code>, the byte will look like <code>0, 0, 0, 0, ... </code> followed by whatever else comes after. However if it is true (<code>1, 0, 0, 0</code>), 5 floats (X, Y, Z, HalfHeight and Radius) will follow, making the array vary in length. |
− | * When arrays/objects are used (for fields like <code>DropConditions</code> or <code>bSetTerritory</code>, there is often a | ||
[[Dandori Desktop]] provides tools for byte conversions that can aid in finding values. | [[Dandori Desktop]] provides tools for byte conversions that can aid in finding values. | ||
Line 63: | Line 41: | ||
== Charts == | == Charts == | ||
− | Attempts have been made to chart the bytes of various AI parameters to uncover patterns and the locations of values in order to manipulate them. | + | Attempts have been made to chart the bytes of various AI parameters to uncover patterns and the locations of values in order to manipulate them. The current diagrams mostly illustrate the inventory system. |
− | There are many bytes AFTER the end of the inventory which ends in | + | There are many bytes AFTER the end of the inventory which ends in a byte of <255, 255, 255, 255</code> (<code>-1</code>), but I have no idea what they do. I believe they're probably the overrides for <code>TekiAIParameter</code> and each enemy's custom AI arguments. |
=== Creature AI === | === Creature AI === | ||
− | Details the drop system for a regular enemy (and eggs). The inventory system | + | Details the drop system for a regular enemy (and eggs). The inventory system used here is the same as in GroupDropManager's, so it helps to understand creatures first. |
[[File:P4-creature-ai-inventory-bytes.png|500px|thumb|center|]] | [[File:P4-creature-ai-inventory-bytes.png|500px|thumb|center|]] | ||
Line 80: | Line 58: | ||
[[File:P4-gdm-ai.png |500px|thumb|center|]] | [[File:P4-gdm-ai.png |500px|thumb|center|]] | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== Researching === | === Researching === | ||
Line 130: | Line 63: | ||
The best way of breaking down the AI parameter (I have found) is to combine the blueprint JSONs from the <code>Sublevels/</code> folder, with the <code>ActorPlacementInfo</code> file of the same type. The Sublevels files contain the gen_variables that seem to be encoded into the byte arrays of ActorSerializeParameter. | The best way of breaking down the AI parameter (I have found) is to combine the blueprint JSONs from the <code>Sublevels/</code> folder, with the <code>ActorPlacementInfo</code> file of the same type. The Sublevels files contain the gen_variables that seem to be encoded into the byte arrays of ActorSerializeParameter. | ||
− | AI parameters can be found by searching for <code>{entity}AI_GEN_VARIABLE</code>, for example <code>ElecMushiAI_GEN_VARIABLE</code> for Anode Beetles. Most of the contents of that object's <code>Properties</code> will be encoded in that actor's <code>ActorSerializeParameter.AI.Static</code> in the <code>ActorPlacementInfo</code> file, so you can compare things like the drop numbers, asset path and other such floats for occurrences of those values in the AI array. Strings are often the easiest to find/locate with due to their easy to spot nature (look for the big sequence of non-0 numbers and decode it to see if it matches what you need). | + | AI parameters can be found by searching for <code>{entity}AI_GEN_VARIABLE</code>, for example <code>ElecMushiAI_GEN_VARIABLE</code> for Anode Beetles. Most of the contents of that object's <code>Properties</code> will be encoded in that actor's <code>ActorSerializeParameter.AI.Static</code> in the <code>ActorPlacementInfo</code> file, so you can compare things like the drop numbers, asset path and other such floats for occurrences of those values in the AI array. Strings are often the easiest to find/locate with due to their easy to spot nature (look for the big sequence of non-0 numbers and decode it to see if it matches what you need). |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Category:Pikmin 4]] | [[Category:Pikmin 4]] | ||
[[Category:Parameters]] | [[Category:Parameters]] |