OBD:Instance file format: Difference between revisions

moved engine version section to new page Engine terminology
(added section to directly address the different engine versions, though I feel like this might be best on another page; improved wording of blank space/garbage data section)
(moved engine version section to new page Engine terminology)
 
Line 2: Line 2:
{{OBD Home}}
{{OBD Home}}
{{Hatnote|".dat" redirects here; for other files ending in ".dat", see [[Oni (folder)]].<br>
{{Hatnote|".dat" redirects here; for other files ending in ".dat", see [[Oni (folder)]].<br>
:You should read the [[Game data terminology]] page before this one.<br>
:You should read [[Engine terminology]] and [[Game data terminology]] before this page.<br>
:The [[Raw|Raw and separate file formats]] page should be read after this one.}}
:[[OBD:Raw and separate file formats]] should be read after this page.}}
Files in GameDataFolder/ named "level[0-19]_Final.dat", together with ".raw" and sometimes ".sep" counterparts, contain the game data for Oni. These are called "instance files" internally, but a more common-sense name for them is level data files. The format described below was also used for the tool files which supplied the GUI for the in-game editor, however the retail Oni game application refuses to load tool files; for the story behind the tool files, see [[level0_Tools]].
Files in GameDataFolder/ named "level[0-19]_Final.dat", together with ".raw" and sometimes ".sep" counterparts, contain the game data for Oni. These are called "instance files" internally, but a more common-sense name for them is level data files. The format described below was also used for the tool files which supplied the GUI for the in-game editor, however the retail Oni game application refuses to load tool files; for the story behind the tool files, see [[level0_Tools]].


The level 0 files do not contain resources for a specific level but rather resources (instances) shared across all levels. Level 0 is loaded when the game starts and is never unloaded. All other level files, 1-19, are only loaded when their corresponding level starts and then unloaded when it ends. Oni can only hold two level files in memory concurrently, thus resources have to be duplicated on disk whenever a character class, sound effect, etc. occurs in more than one level. For instance, although there are only 2,380 unique sounds in the game, there are 7,386 sounds stored across all level data files.
The level 0 files do not contain resources for a specific level but rather resources (instances) shared across all levels. Level 0 is loaded when the game starts and is never unloaded. All other level files, 1-19, are only loaded when their corresponding level starts and then unloaded when it ends. Oni can only hold two level files in memory concurrently, thus resources have to be duplicated on disk whenever a character class, sound effect, etc. occurs in more than one level. For instance, although there are only 2,380 unique sounds in the game, there are 7,386 sounds stored across all level data files.
{{TOClimit}}
{{TOClimit}}
==Engine versions==
There are three versions of Oni's engine found in released versions of the game. They are very similar but contain small differences which we sometimes need to note on this page and on the individual [[OBD:File types|OBD file type pages]]:
*Windows retail: This version of the engine can be identified as '''v1.0''' from [[Oni (folder)/readme.txt|its read-me]] but is often referred to as the "Windows" or "PC" engine. This version of the engine was used for all localized Windows releases translated into non-English languages as well.
*Mac retail/demo, Windows demo: This version can be identified as '''v1.1''' from [[Oni (folder)/Oni ReadMe|the Mac read-me]], and underwent another month of development after v1.0. It was also used for the Windows demo, but is sometimes referred to as the "Mac" engine. <!--[[OniX]] is built on this version of the engine.--> Its most obvious difference is the addition of .sep files to the GameDataFolder, but some templates were changed as well.
*PlayStation 2: This version also uses .sep files but makes additional changes to templates. It went through another 1-2 months of development after the Mac version and could possibly be thought of as v1.2, but is probably best understood as a fork of the v1.1 engine made for PS2 compatibility.
==Blank space and garbage==
==Blank space and garbage==
The structure of the level data files files reflects the way in which Bungie West chose to store levels in memory. So when we read the data in the files with a hex editor we can see eccentricities such as blank space coming from unused fields and byte-alignment padding, and garbage data such as now-meaningless pointer values and random RAM contents from uninitialized memory. There are also [[OBD:Raw and separate file formats#Gaps|gaps in the .raw/.sep files]], mostly representing orphaned obsolete resources, which add up to about 25 MB for the whole game.
The structure of the level data files files reflects the way in which Bungie West chose to store levels in memory. So when we read the data in the files with a hex editor we can see eccentricities such as blank space coming from unused fields and byte-alignment padding, and garbage data such as now-meaningless pointer values and random RAM contents from uninitialized memory. There are also [[OBD:Raw and separate file formats#Gaps|gaps in the .raw/.sep files]], mostly representing orphaned obsolete resources, which add up to about 25 MB for the whole game.