Jump to content

OBD:Data types: Difference between revisions

general rewrite, adding in the knowledge I've gained so far; removed list of types that link to other types as it seems useless
m (link fix)
(general rewrite, adding in the knowledge I've gained so far; removed list of types that link to other types as it seems useless)
Line 1: Line 1:
{{finish}}
{{OBD Home}}
{{OBD Home}}
{{finish}}
Following are the formats used for the various data fields in Oni's [[OBD:File types|resource types]].
Following are the formats used for the various data fields in Oni's [[OBD:File types|data types]].
{{TOClimit}}
{{TOClimit}}
==General notes==
==Resource links==
===Struct defs===
Links between resources are very common in the data and take four forms.
Place here suggestions for data type IDs (for new-gen struct defs).
===Appearance===
[[OUP]] could/should have special GUI settings for some of the types:
*Links to other resources (in the long term, also links by label and non-file ID)
*Vectors, AABBs, planes, transformation matrices, quaternions.
*Bitsets: checkboxes with labels specified in the struct def
:Same for longs with high bits/bytes and more generally, IDs.
Ideally, the labels for recurring bitsets and ID fields should be hardcoded, but it's OK to have them in struct defs ATM.
:Sorta "subtypes" for short, long, etc, depending on what function the field corresponds to (a ''lot'' of subtypes)...
::No hurry for that...


===Links by index number===
Probably the most common form of inter-resource linking is to store the index number of the connected resource in a 32-bit int. "Index number" is defined as the position of the resource in the [[dat#Instance descriptors|instance descriptor table]]. These index numbers were left-shifted by 8 bits in memory in order to leave room for a bit that could be set at runtime indicating the resource had been loaded. Even though this bit had no relevance when the data was stored on disk, the ints were written to disk as-is. See [[dat#Data block|here]] for elaboration, or see {{SectionLink|OBD:ONCC|Body settings}} for several examples.


----
===Links by name===
Many fields store the name of the connected resource as a string which is then looked up at runtime when needed or upon level-load. Search [[OBD:ONCC]] for the word "reference" to find several examples.


==Resource links==
===Level ID===
A few special mentions about the x2 thing and the IDs for _Tools files.
===Resource ID===
Those should certainly be typed: a different ID for every resource type.
===Abnormal resource ID===
Most of them are "optional" links to a given resource type.
====[[TXMP]]====
Optional link to [[TXAN]].
====[[Mtrl]], [[Impt]], and [[ONCV]]====
Those are just optional links to parents in the Mtrl/Impt/ONCV hierarchy.
:Children link to parent, parent doesn't link to anything.
====[[M3GM]]====
Last link in file (after [[TXMP]]). Never used in Oni? "Parent M3GM"? Another TXMP?
====[[IGPG]]====
Link before IGSA links. Never used in Oni?
====[[PSpL]] and [[WMCL]]====
Always links to [[PSpc]] in Oni.
====[[PSpc]]====
Always link to [[TXMP]] in Oni.
====TMRA====
Defunct resource type. Who cares?
===Abnormally normal resource ID===
TRAM links in [[FILM]] and [[TRAM]] are ''not'' optional. Neither is the envmap [[TXMP]] link in TXMP.
===Raw/separate file links===
I would type those too: a different ID for every raw/separate file resource type.
:Note that the size of the raw/separate data is not always provided.
===Links by label===
Those are special string subtypes. I wouldn't specify them right now.
:(but you can try and draw a list of what links-by-label there are)
===Links by ID===
===Links by ID===
:(not to be confused with links by ID to instance file resources)
Not to be confused with links by index number (even though we sometimes call that the instance ID). Various systems have their own set of ID numbers: vocalizations, melee profiles, combat behavior profiles, etc. These are not generally links to level file resources but rather lookups to hardcoded tables.
E.g., vocalization IDs, melee profile IDs, combat behavior IDs, etc.
:In most cases, they are not links to level file resources, but lookups to hardcoded tables (which are also part of OBD, sort of...)


===Raw/separate file offsets===
These are 32-bit ints telling the engine how far to index into the raw or separate file to find some data which is part of an instance. As long as the file never exceeds 4 GB then there can't be any issues with using a 32-bit offset. Note the [[Raw#File storage|differences in raw/separate utilization]] between engine versions.


----
==Strings==
Strings are generally stored in fixed-size buffers. The sizes of these buffers are listed below. The strings used for dialogue subtitles and for messages are not fixed-size; they are stored in a contiguous chunk in the raw file, with the offsets for each string found in an array in [[SUBT]]. Each string's length is not known in advance, but only by reading it as a C string and encountering the null terminator at the end.


==Strings==
checked past BINA...
===16 chars===
===16 chars===
*[[PAR3]] ([[BINA]] raw/separate file part)
*[[ONCC]]
*[[ONCP]]
*[[ONCP]]
*[[ONIA]]
*[[ONIA]]
*[[PAR3]] ([[BINA]] raw/separate file part)
*[[TRAM]]
*[[TRAM]]
*[[TRAM]] (particle part)
*[[TRAM]] (particle part)
===32 chars===
===32 chars===
*[[AGDB]] raw/separate file parts
*[[AGDB]] raw/separate file parts
Line 91: Line 55:
*[[TRIG]]
*[[TRIG]]
*[[TURR]]
*[[TURR]]
===48 chars===
===48 chars===
*[[FURN]] ([[BINA]] raw/sep part)
*[[FURN]] ([[BINA]] raw/sep part)
Line 96: Line 61:
*[[ENVP]]
*[[ENVP]]
*[[ONGS]]?
*[[ONGS]]?
===63 chars===
===63 chars===
*[[CONS]] ([[BINA]] raw/sep part)
*[[CONS]] ([[BINA]] raw/sep part)
Line 102: Line 68:
*[[TRIG]] ([[BINA]] raw/sep part)
*[[TRIG]] ([[BINA]] raw/sep part)
*[[TURR]] ([[BINA]] raw/sep part)
*[[TURR]] ([[BINA]] raw/sep part)
===64 chars===
===64 chars===
*[[AITR]]
*[[AITR]]
Line 120: Line 87:
*[[TURR]]
*[[TURR]]
*[[WMM_]]
*[[WMM_]]
===68 chars===
===68 chars===
*[[DOOR]] ([[BINA]] raw/sep part)
*[[DOOR]] ([[BINA]] raw/sep part)
===128 chars===
===128 chars===
*[[FLAG]] ([[BINA]] raw/sep part)
*[[FLAG]] ([[BINA]] raw/sep part)
Line 130: Line 99:
*[[TStr]]
*[[TStr]]
*[[TXMP]]
*[[TXMP]]
===132 chars===
===132 chars===
*[[ONIE]] ([[BINA]] raw/sep part)
*[[ONIE]] ([[BINA]] raw/sep part)
===160 chars===
===160 chars===
*[[CRSA]]
*[[CRSA]]
===256 chars===
===256 chars===
*[[WMDD]]
*[[WMDD]]
===364 chars===
===364 chars===
*[[IGSt]]
*[[IGSt]]


==Floating-point numbers==
===Float===
Floats are stored in the standard 4-byte IEEE format, so reading them directly into the memory of a float_t works. These are used for many amounts where floating-point precision is needed, such as percentages, distances and angles.


----
==Floats==
===Float===
4-byte IEEE float
:(amount, distance, angle, ...)
===Vector===
===Vector===
3 floats define a vector in 3D space
Simply a struct of 3 floats stored contiguously. Vectors are used for 3D coordinates of polygons and normals, as well as for scaling.
:(position, normal, scaling, ...)
 
===AABB===
===AABB===
;Axis-aligned bounding box
;Axis-aligned bounding box
Line 163: Line 134:
4 floats define an oriented plane in 3D
4 floats define an oriented plane in 3D
:(see [[PLEA]] for algorithm)
:(see [[PLEA]] for algorithm)
===Quaternion===
===Quaternion===
4 floats define a [[wikipedia:Quaternion|quaternion]]
4 floats define a [[wikipedia:Quaternion|quaternion]]
Line 189: Line 161:
*[[TURR]]
*[[TURR]]


==Integers==
These are also stored in the standard IEEE format. Most integers in the game data are read as unsigned, but one known exception is the quantized Euler angles in [[TRAM]].


----
==Integers==
Mostly non-negative indices, so possibly unsigned.
:One known exception: the quantized Euler angles in TRAM
===char===
===char===
:ever used?
Are single-byte ints ever used?
 
===short===
===short===
:everywhere...
16-bit ints are used throughout the game data to save space when 32-bit capacity is not needed.
 
===short with high bit===
===short with high bit===
used as a simple flag? (in a few places... not sure... ^^ ) (OFGA)
Used as a simple flag? (in a few places... not sure... ^^ ) (OFGA)
 
===int===
Used throughout the game data wherever values were expected to at least potentially exceed 16-bit limits.
 
===long===
===long===
:everywhere...
64-bit ints are found in many places where extra-large numbers were anticipated, such as [[dat#Header|the checksum field]] in the .dat's header.
 
===long with high bit===
===long with high bit===
The lower bits are used for an ID, the high bit is a flag
The lower bits are used for an ID, the high bit is a flag.
:used in
:Used in:
*[[ABNA]]
*[[ABNA]]
*[[AGQC]]
*[[AGQC]]
Line 213: Line 190:
*[[QTNA]]
*[[QTNA]]
*...
*...
===long with high byte===
===long with high byte===
The lower bytes are used for an ID, the high byte is a group ID
The lower bytes are used for an ID, the high byte is a group ID.
:(used for [[MELE]] moves)
:Used for [[MELE]] moves
===quantized float===
 
e.g., quantized Euler angles in [[TRAM_]]
===Quantized float===
Used for quantized Euler angles in [[TRAM]].
 
===other stuff===
===other stuff===
lots of funny stuff in [[PAR3]], maybe...
Lots of funny stuff in [[PAR3]], maybe...
:funny stuff in [[OTLF]], too...
:Funny stuff in [[OTLF]], too...


==Bitsets==
The most common size of a bitset, aka flagset, is 32 bits.


----
==Bitsets==
===1 byte===
===1 byte===
===2 bytes===
===2 bytes===
===4 bytes===
===4 bytes===
===8 bytes===
===8 bytes===
8-byte bitset (keypress events) only in [[FILM]], AFAIK
Used for [[dat#Instance descriptors|the instance descriptor flags]] in the .dat and for keypress events in [[FILM]]. Used for storing flags for AI behaviors in [[ONCC]].


 
==Misc.==
----
==Misc==
===32-bit color===
===32-bit color===
stored as BB GG RR AA (byte swapped)
stored as BB GG RR AA (byte swapped)
:used in
:Used in:
*[[AGQG]]
*[[AGQG]]
*[[IGSt]]?
*[[IGSt]]?
Line 242: Line 220:
*[[ONWC]]
*[[ONWC]]
*[[WMDD]]
*[[WMDD]]
===4-character codes===
===4-character codes===
In various BINA raw/sep parts
4CCs for short, also known as tags to many game modders, are used to announce [[dat#Header|the packing version]] of .dat files, to label template descriptors in the same, and in various BINA raw/sep parts.
===[[OBD:AKVA/0x24]]===
 
Pathfinding grids
===Pathfinding grids===
See [[OBD:AKVA/0x24]].


{{OBD}}
{{OBD}}