History of Oni modding: Difference between revisions

From OniGalore
Jump to navigation Jump to search
m (let's try this instead)
Line 15: Line 15:
==Binary resources==
==Binary resources==


[[Image:OniTools.jpg|thumb|225px|right|Ian Patterson was probably the most influential early binary hacker, and his trail-blazing program [[OniTools]] for the Mac was quickly ported to Windows.  It had support for "CMPO" delta patches, and the earliest binary mods were probably based on this method.]]
[[Image:OniTools.jpg|thumb|225px|right|Ian Patterson was probably the most influential early binary hacker, and his trail-blazing program [[OniTools]] for the Mac was quickly ported to Windows.  It had support for delta patches, and the earliest binary mods were probably based on this method.]]
Fans with some expertise in parsing files with hex editors found that the binary data (i.e., the files ending in .dat and .raw, not to be confused with "binary" as a term for an application) held four-letter codes, indicating the start of each resource within that file. Within a week of the street date for Oni, the community had its first resource modding tool. While the author did not yet know how all the data worked, his program could at least parse it, and allow the modder to more easily edit each resource without having to think in hexadecimal. It also supported user-friendly replacement of texture maps and allowed in-line viewing of the game's 3D models. There seems to be little evidence that this knowledge was put to use in modding the game resources beyond simple mods such as texture replacements, no doubt due to the lack of a complete understanding of how Oni's 65 resource types were inter-related.
Fans with some expertise in parsing files with hex editors found that the binary data (i.e., the files ending in .dat and .raw, not to be confused with "binary" as a term for an application) held four-letter codes, indicating the start of each resource within that file. Within a week of the street date for Oni, the community had its first resource modding tool, OniTools (pictured, right). While the author did not yet know how all the data worked, his program could at least parse it, and allow the modder to more easily edit each resource without having to count in hexadecimal. It also supported user-friendly replacement of texture maps and allowed in-line viewing of the game's 3D models. There seems to be little evidence that this knowledge was put to use in modding the game resources beyond simple mods such as texture replacements, no doubt due to the lack of a complete understanding of how Oni's 65 resource types were inter-related.


This did not stop one intrepid programmer named Pierre from deciding to write his own game engine from scratch, using data from Oni to test its abilities. Called [[Konoko Payne]], it is a long-term project which currently takes the form of (1) an underlying engine, and (2) a short scenario for it that resembles a sequel to Oni. In order to extract models and animations from Oni and recreate them precisely in his project, Pierre became one of the early pioneers in "reverse engineering" the game's resources, although his acquired knowledge remained private for some time, as his work predated the community's organized public attempts at gathering this information.
This did not stop one intrepid programmer named Pierre from deciding to import data from Oni into the game engine that he was writing from scratch. Called [[Konoko Payne]], it is a long-term project which currently takes the form of (1) an underlying engine, and (2) a short scenario for it that resembles a sequel to Oni. In order to extract models and animations from Oni and recreate them precisely in his project, Pierre became one of the early pioneers in "reverse engineering" the game's resources, although his acquired knowledge remained largely private, as his work predated the community's organized public attempts at gathering this information.


Efforts in "hacking" the binary data began, as far as the modern community is concerned, in the fall of 2004 when [[User_talk:Ssg|Ssg]] started a site on the newly-opened [http://www.oni2.net Oni2.net], a domain run by [[User:Admin|Alloc]] (carrying over and translating information that he had originally placed on another site in his native German). A year later, this pool of knowledge was painstakingly moved by [[User:Geyser|geyser]] and Ssg to its [[OBD|current home]] on the wiki to allow collaboration; at this point, [[User_talk:Neo|Neo]] appeared on the scene, adding his own knowledge that he had been acquiring independently until then, and collaborating on further investigations into the resource formats.  Today at least 90% of the binary resource formats are documented byte for byte thanks to their hard work.
Efforts in "hacking" the binary data began, as far as the modern community is concerned, in the fall of 2004 when [[User_talk:Ssg|Ssg]] started a site on the newly-opened [http://www.oni2.net Oni2.net], a domain run by [[User:Admin|Alloc]] (carrying over and translating information that he had originally placed on another site in his native German). A year later, this pool of knowledge was painstakingly moved by [[User:Geyser|geyser]] and Ssg to its [[OBD|current home]] on the wiki to allow collaboration; at this point, [[User_talk:Neo|Neo]] appeared on the scene, adding his own knowledge that he had been acquiring independently until then, and collaborating on further investigations into the resource formats.  Today at least 90% of the binary resource formats are documented byte for byte thanks to their hard work.
Line 24: Line 24:
Originally, modders had to alter these binary resources manually with hex editors to adapt them to their scripts. [[User:Loser|Loser]] was the first modder to manually edit the game data to go along with his scripting, with a massively reshuffled Warehouse. Loser's Warehouse mod included a global component (modified level0_Final), level-specific binary modifications, and a set of customized scripts that took full advantage of the modified binaries.
Originally, modders had to alter these binary resources manually with hex editors to adapt them to their scripts. [[User:Loser|Loser]] was the first modder to manually edit the game data to go along with his scripting, with a massively reshuffled Warehouse. Loser's Warehouse mod included a global component (modified level0_Final), level-specific binary modifications, and a set of customized scripts that took full advantage of the modified binaries.
[[Image:OUP_txmpreplace.jpg|thumb|225px|right|OniUnPacker by Alloc, premiering in fall of 2005, provided a simple interface for finding the resource you wanted and displaying it, as well as replacing it.]]
[[Image:OUP_txmpreplace.jpg|thumb|225px|right|OniUnPacker by Alloc, premiering in fall of 2005, provided a simple interface for finding the resource you wanted and displaying it, as well as replacing it.]]
Minor binary modding had already occurred before Loser's Warehouse (thus, while compiling the [[OBD]] database, Ssg had released a version of level0_Final in which all of Konoko's combos were unlocked). Still, it was the Warehouse mod which first showed the "full" potential of binary modding. It inspired a short-lived initiative called the [[OBD:BIP|Binary Improvement Project]], aimed at providing upgraded binaries for all levels, not just level0_Final and level1_Final. BIP was hindered by large upload/download sizes as well as by the potential legal issues involved in distributing entire files from the game, and was promptly put on standby.
Minor binary modding had already occurred before Loser's Warehouse (thus, while compiling the [[OBD]] database, Ssg had released a version of level0_Final in which all of Konoko's combos were unlocked). Still, it was the Warehouse mod which first showed the "full" potential of binary modding. It inspired a short-lived initiative called the [[AE:BIP|Binary Improvement Project]], aimed at providing upgraded binaries for all levels, not just level0_Final and level1_Final. BIP was hindered by large upload/download sizes as well as by the potential legal issues involved in distributing entire files from the game, and was promptly put on standby.


An equally short-lived alternative to supplying whole levels was developed in the form of [[OUP|OniUnPacker]]-based patches and was termed [[AE:ONK|Oni ni Kanabô]]. The modder would edit his DAT/RAW files in OUP, and then release a single binary resource patch. This was both bandwidth-efficient and more legal-friendly, but suffered from one major limitation: the indexation of DAT resources and the offsets of RAW data vary a lot across the available versions of Oni. Thus, resources exported with OUP were not truly standalone or portable. Also, OUP still lacked the ability to import new resources alongside existing ones.
An equally short-lived alternative to supplying whole levels was developed in the form of [[OUP|OniUnPacker]]-based patches and was termed [[AE:ONK|Oni ni Kanabô]]. The modder would edit his DAT/RAW files in OUP, and then release a single binary resource patch. This was both bandwidth-efficient and more legal-friendly, but suffered from one major limitation: the indexation of DAT resources and the offsets of RAW data vary a lot across the available versions of Oni. Thus, resources exported with OUP were not truly standalone or portable. Also, OUP still lacked the ability to import new resources alongside existing ones.

Revision as of 20:20, 14 June 2011

This article is a historical perspective on Oni modding; for an introduction to how to actually mod Oni, see here. To download mods, you can start here.

As has been documented on the page about Oni's overall development, time ran out for Bungie West to do everything they wanted with this very ambitious game. Just as some features had to be omitted, the promise of modding support1 also failed to come true. However, even before Oni fans really knew that there would never be official modding tools from Bungie, they were already eagerly diving into the game data to see how they could mod it.2 Nevertheless, the lack of any documentation of tools for modding undeniably slowed the development of mods within the community. Only for the last 16 years has the community's modding capabilities covered nearly all aspects of the game.

There are three basic areas in which the game can be modded. In order of difficulty they are: scripting, binary resources, and the engine code. Along the way, we'll look at some key discoveries the community made in more detail.

BSL scripting

Konoko pulls her gun on the secretary in the beginning of Chapter 2, a change to the original cutscene made by a script which tightens up the story and provides a new challenge for veteran players.

Since the .bsl files were plain-text, and in plain sight within the folders that held Oni's game data, it's not surprising that fans quickly learned some basic commands by seeing what Bungie had written, and making their own scripts. Further commands were discovered by dumping readable text from the engine, although not everything worked as it seemed it should.

As scripters were learning BSL, they produced scripts that at first merely modified the original level logic in minor ways. Later, they produced more original, often epic fight scripts (e.g. OTA); finally, some ambitious modders scripted totally new objectives and mission layouts (e.g., Mariachi Bear's alternate storyline). However, fully original scripts are all the more prone to bugs. The first two are easier to set up, but extreme situations tend to overload the engine (as in Blam!) in ways that the scripters have trouble preventing.

Testing the scripts required large numbers of attempts in launching Oni and running the scripts to see how they worked. This process became much faster when the Developer Mode console was unlocked (see below) and individual commands could be tested easily. While this is the easiest way to mod Oni, it's also the most limited; partly because of the lack of full documentation for BSL (which this wiki hopes to provide at some point), and partly because scripts are limited to the resources that an original level has to offer.

Binary resources

Ian Patterson was probably the most influential early binary hacker, and his trail-blazing program OniTools for the Mac was quickly ported to Windows. It had support for delta patches, and the earliest binary mods were probably based on this method.

Fans with some expertise in parsing files with hex editors found that the binary data (i.e., the files ending in .dat and .raw, not to be confused with "binary" as a term for an application) held four-letter codes, indicating the start of each resource within that file. Within a week of the street date for Oni, the community had its first resource modding tool, OniTools (pictured, right). While the author did not yet know how all the data worked, his program could at least parse it, and allow the modder to more easily edit each resource without having to count in hexadecimal. It also supported user-friendly replacement of texture maps and allowed in-line viewing of the game's 3D models. There seems to be little evidence that this knowledge was put to use in modding the game resources beyond simple mods such as texture replacements, no doubt due to the lack of a complete understanding of how Oni's 65 resource types were inter-related.

This did not stop one intrepid programmer named Pierre from deciding to import data from Oni into the game engine that he was writing from scratch. Called Konoko Payne, it is a long-term project which currently takes the form of (1) an underlying engine, and (2) a short scenario for it that resembles a sequel to Oni. In order to extract models and animations from Oni and recreate them precisely in his project, Pierre became one of the early pioneers in "reverse engineering" the game's resources, although his acquired knowledge remained largely private, as his work predated the community's organized public attempts at gathering this information.

Efforts in "hacking" the binary data began, as far as the modern community is concerned, in the fall of 2004 when Ssg started a site on the newly-opened Oni2.net, a domain run by Alloc (carrying over and translating information that he had originally placed on another site in his native German). A year later, this pool of knowledge was painstakingly moved by geyser and Ssg to its current home on the wiki to allow collaboration; at this point, Neo appeared on the scene, adding his own knowledge that he had been acquiring independently until then, and collaborating on further investigations into the resource formats. Today at least 90% of the binary resource formats are documented byte for byte thanks to their hard work.

Originally, modders had to alter these binary resources manually with hex editors to adapt them to their scripts. Loser was the first modder to manually edit the game data to go along with his scripting, with a massively reshuffled Warehouse. Loser's Warehouse mod included a global component (modified level0_Final), level-specific binary modifications, and a set of customized scripts that took full advantage of the modified binaries.

OniUnPacker by Alloc, premiering in fall of 2005, provided a simple interface for finding the resource you wanted and displaying it, as well as replacing it.

Minor binary modding had already occurred before Loser's Warehouse (thus, while compiling the OBD database, Ssg had released a version of level0_Final in which all of Konoko's combos were unlocked). Still, it was the Warehouse mod which first showed the "full" potential of binary modding. It inspired a short-lived initiative called the Binary Improvement Project, aimed at providing upgraded binaries for all levels, not just level0_Final and level1_Final. BIP was hindered by large upload/download sizes as well as by the potential legal issues involved in distributing entire files from the game, and was promptly put on standby.

An equally short-lived alternative to supplying whole levels was developed in the form of OniUnPacker-based patches and was termed Oni ni Kanabô. The modder would edit his DAT/RAW files in OUP, and then release a single binary resource patch. This was both bandwidth-efficient and more legal-friendly, but suffered from one major limitation: the indexation of DAT resources and the offsets of RAW data vary a lot across the available versions of Oni. Thus, resources exported with OUP were not truly standalone or portable. Also, OUP still lacked the ability to import new resources alongside existing ones.

The advent of Neo's OniSplit in late 2007 marked a radical improvement. A command-line tool for Windows (that can also run on Macs), OniSplit breaks Oni's resources into truly standalone and portable modules. These modules can be edited and recombined to create the level data files that Oni reads, but new modules can also be created easily from scratch; image files can be made into texture resources, 3D models into new character models, etc.

OniSplit has in turn made possible the creation of the comprehensive mod known as the Anniversary Edition.

Engine patching

SFeLi documents his discovery in 2006; in examining the binary, he noticed that the list of cheat codes had a gap in it where one code had been removed; that code was for Developer Access. For more history, see here.

This ultimate form of modding becomes necessary for modders who want to do things the game's code does not currently allow, as well as to fix bugs. Bug fixes were the earliest notable achievement in engine patching, originally performed by a patching application that altered the PC Oni executable directly, but a revolution in this type of modding occurred in 2006 when Developer Mode was finally discovered in retail Oni's code, and a means for unlocking it was needed. The most foolproof method of altering the engine turned out to be replacing a library that Oni loads at runtime. Now known as the Daodan DLL, this library-as-patch can alter many aspects of Oni's behavior. This allows the fixing of bugs (some of which result from new computers running a 23 year old game), as well as the adding of new features. (All changes made by Daodan are documented here.)

Not long after Daodan DLL was released for Windows, it was discovered that the Mac versions of Oni still had Dev Mode in them, too. Unlike Windows, the Mac version does not seem to have any libraries that can be exploited for runtime patching, so the changes were simply made with a hex editor, directly modifying the executable. In the fall of 2008, it was discovered that numerous BSL functions and variables that were thought to be removed from Oni for the Mac before release were still present in the code, and the ones that were needed to allow Macs to run (almost) all scripts written for the PC version were also "unlocked" by EdT using hex edits. This patched executable is freely downloadable in its altered form, which also corrects various age-related bugs and makes some improvements to the game that mirror what the Daodan DLL does for the Windows version. (All changes made by hex edits are documented here.)

One of the most visible changes to the game that the Daodan DLL (and equivalent hex edits on the Mac side) made possible came about in July '07, when an error in Oni's AI routines was corrected, allowing the AI to dodge incoming fire. Players had originally expected at least basic dodging abilities in the AI, and so, when Oni was released, they were surprised to see the AI run blindly at Konoko while being shot at. With the community's patch in place, previously unused code is now enabled, allowing the AI to intelligently take cover from gunfire.

Work continues in all areas of modding Oni. You can add to the effort by looking at the page for the AE Team and seeing if you have any skills that can help us out.
Even if you don't know how to make something possible, your ideas are welcome!


1In Harry's interview with Brent Pease, who was the project coordinator at the time, Pease said: "what we will do is, I'm about 90 percent sure of this, is give away the file format." He also promises with equal certainty that the tools for converting 3D Studio Max models into Oni models will be given away. Pease eventually left the project before its completion. Hardy LeBel, his replacement, would later say that, due to the time crunch, "our primary focus had to be on completing the content and features of the game rather than building in support for the mod community."

2Fans wasted no time in dumping the readable text from the executable and trying to figure out how to enable Developer Mode, as this thread from before the game's official release date attests. Little did they know it would take another five years before this particular goal would be reached.