XML:Basic tutorial: Difference between revisions
m (link fix) |
(rewriting intro to be more intro-y) |
||
Line 1: | Line 1: | ||
{{update}} | {{update}} | ||
==XML tutorial for Anniversary Edition== | ==XML tutorial for Anniversary Edition== | ||
This tutorial is written with the [[Anniversary Edition]] in mind, because it installs the modding tools you need, gives you the framework for making a mod package, and globalizes more data. Global data can be used in any level. | |||
''' | '''What is XML?''' | ||
: [[ | :[[wikipedia:XML|E'''X'''tensible '''M'''arkup '''L'''anguage]] is a plain-text file format designed to be both human-readable and machine-readable. It stores data in between tags, e.g. <tt><Data>Some data here.</Data></tt>, and these tags can be arranged in a hierarchy to keep things organized. The only difference between a normal text file and an XML file is that the file ends in .xml instead of .txt and that it typically begins with the string <tt><?xml version="1.0" encoding="UTF-8" ?></tt>. While you thus could easily make an XML file by hand in any text editor, there are programs listed below which are better suited for easy XML editing. | ||
'''AE installed. What now?''' | '''Okay, so what is XML modding?''' | ||
: OniSplit cannot be opened | :In the old days, most of Oni's resources had to be edited by [[wikipedia:Hex editor|hex editor]]. Then [[User:Neo|Neo]], a fan and hacker, introduced XML exporting. This turns "binary data" -- raw Oni resource data -- into human-readable XML which allows much easier modding. You can then import your edited XML back into Oni's resource format with a simple command. The list of file types with XML support can be seen [[#supported_file_types|HERE]]. | ||
'''So I just export some data to XML and start editing. Got it.''' | |||
:Not so fast! A lot of the data is not that self-explanatory; it simply can't be, when the game engine is so complex. That's what the XML namespace on this wiki is for: documenting the game data tag by tag according to what you'll be seeing in the XML files, but just as importantly, explaining ''what all that data does''. That's important, because the wiki's original game data documentation in the [[OBD]] namespace was written for hackers and is lacking in plain-English explanation. | |||
'''Okay, what do I need to get started?''' | |||
: [[OniSplit]] will be your main tool. [[xmlTools]] is also needed for making XML patch mods. Installing the [[AE]] is the recommended way to get these tools and a helpful framework installed. | |||
'''I've got the AE installed. What now?''' | |||
: OniSplit cannot be opened by simply double-clicking it; it's a command-line tool. But you are lucky -- we now have a [[wikipedia:GUI|GUI]] for it. | |||
:: Mac user will want to get '''"[[AE:Anniversary_Edition_Tools|AETools]]"''' | :: Mac user will want to get '''"[[AE:Anniversary_Edition_Tools|AETools]]"''' | ||
::: Install instructions are on same page. | ::: Install instructions are on same page. | ||
Line 14: | Line 22: | ||
::: Unpack and put the executables into your "GameDataFolder" inside "edition" folder. | ::: Unpack and put the executables into your "GameDataFolder" inside "edition" folder. | ||
'''What | '''What kinds of mods can I make?''' | ||
: See [[#supported_file_types|HERE]] again. It's an overview | : See [[#supported_file_types|HERE]] again. It's an overview of the kinds of resources that allow XML editing. But note that some types can be more difficult to mod than other. | ||
: If you need some ideas look at this page: '''[[Modding_brainstorms|modding brainstorms]]'''. | : If you need some ideas look at this page: '''[[Modding_brainstorms|modding brainstorms]]'''. | ||
: If you want to contribute AE: [[AE:Bug-fix_and_feature_requests|bug-fixes and feature requests]]. | : If you want to contribute AE: [[AE:Bug-fix_and_feature_requests|bug-fixes and feature requests]]. |
Revision as of 18:19, 12 April 2013
This page contains information that is out of date. |
XML tutorial for Anniversary Edition
This tutorial is written with the Anniversary Edition in mind, because it installs the modding tools you need, gives you the framework for making a mod package, and globalizes more data. Global data can be used in any level.
What is XML?
- EXtensible Markup Language is a plain-text file format designed to be both human-readable and machine-readable. It stores data in between tags, e.g. Some data here., and these tags can be arranged in a hierarchy to keep things organized. The only difference between a normal text file and an XML file is that the file ends in .xml instead of .txt and that it typically begins with the string <?xml version="1.0" encoding="UTF-8" ?>. While you thus could easily make an XML file by hand in any text editor, there are programs listed below which are better suited for easy XML editing.
Okay, so what is XML modding?
- In the old days, most of Oni's resources had to be edited by hex editor. Then Neo, a fan and hacker, introduced XML exporting. This turns "binary data" -- raw Oni resource data -- into human-readable XML which allows much easier modding. You can then import your edited XML back into Oni's resource format with a simple command. The list of file types with XML support can be seen HERE.
So I just export some data to XML and start editing. Got it.
- Not so fast! A lot of the data is not that self-explanatory; it simply can't be, when the game engine is so complex. That's what the XML namespace on this wiki is for: documenting the game data tag by tag according to what you'll be seeing in the XML files, but just as importantly, explaining what all that data does. That's important, because the wiki's original game data documentation in the OBD namespace was written for hackers and is lacking in plain-English explanation.
Okay, what do I need to get started?
- OniSplit will be your main tool. xmlTools is also needed for making XML patch mods. Installing the AE is the recommended way to get these tools and a helpful framework installed.
I've got the AE installed. What now?
- OniSplit cannot be opened by simply double-clicking it; it's a command-line tool. But you are lucky -- we now have a GUI for it.
- Mac user will want to get "AETools"
- Install instructions are on same page.
- Windows user will want to get "OniSplit GUI" or Vago GUI
- Unpack and put the executables into your "GameDataFolder" inside "edition" folder.
- Mac user will want to get "AETools"
What kinds of mods can I make?
- See HERE again. It's an overview of the kinds of resources that allow XML editing. But note that some types can be more difficult to mod than other.
- If you need some ideas look at this page: modding brainstorms.
- If you want to contribute AE: bug-fixes and feature requests.
- Check also the AE's current To-Do page and maybe there are fields that need a modder.
Is there an easy exercise to get me started?
- Just see at the following table. Read left side if you use a Macintosh PC, read right side if you use a Windows PC.
Mac: | PC: | ||
---|---|---|---|
converting an ONI file into an XML file | |||
Open Edition's AETools_Data folder and create a new folder named "ONIfiles".
|
Open Edition's GameDataFolder and create two new folders named "XML" and "ONI".
|
||
modifing the XML file | |||
Open the extracted file with a simple text editor. Search for "HasSupershield" tag and set its value to "1". Save file. | Open the extracted file with a simple text editor. Search for "HasSupershield" tag and set its value to "1". Save file. | ||
creating the ONI file | |||
Choose "Convert" tab. Now click onto "Select File(s) for Conversion" button and mark "ONCCk4_L.xml". Click "Choose" button. Then click "Select Destination Folder". Search for your ONIfiles folder, mark it, and click "Choose button."
|
Goto "XML -> ONI" section. Click first browse button and search for "ONCCk4_L.xml" inside the XML folder. Click second browse button and choose the ONI folder as target. Now click on Convert button.
|
||
creating and installing a mod package | |||
Choose "Package" tab.
The GUI is actually pretty much self-explaining.
|
|
Click on GUI's "AE Package" tab.
Browse Edition's GameDataFolder and choose the ONI folder as source folder. Browse Edition's install folder and choose the package folder as target.
|
|
testing the modification | |||
Let's test our modification. Therefore we start TCTF HQ redux (pre-last level). The supershield becomes automatically switched on at 51% overpower (301 healh points). "chenille" cheat works too. | Let's test our modification. Therefore we start TCTF HQ redux (pre-last level). The supershield becomes automatically switched on at 51% overpower (301 healh points). "chenille" cheat works too. |
supported file types
Question: "I want to modify files in chapter X. But what level archive is that?"
Answer: "Check out this overview."
Documentation status:
BINA
BINA/ONIE
|
BINA/PAR3
|
BINA/SABD
|
BINA/TMBD
|
OBJC
BINA/OBCJ/CHAR
|
BINA/OBCJ/CONS
|
BINA/OBCJ/CMBT
|
BINA/OBCJ/DOOR
|
BINA/OBCJ/FLAG
|
BINA/OBCJ/FURN
|
BINA/OBCJ/MELE
|
BINA/OBCJ/NEUT
|
BINA/OBCJ/PART
|
BINA/OBCJ/PATR
|
BINA/OBCJ/PWRU
|
BINA/OBCJ/SNDG
|
BINA/OBCJ/TRGV
|
BINA/OBCJ/TRIG
|
BINA/OBCJ/TURR
|
BINA/OBCJ/WEAP
|
Others
AISA
|
AKEV
|
CONS
|
DPge
|
DOOR
|
FILM
|
HPge
|
IGHH
|
IPge
|
Impt
|
M3GM
|
Mtrl
|
OBAN
|
OFGA
|
ONCC
|
ONCV
|
ONGS
|
ONLD
|
ONLV
|
ONSK
|
ONVL
|
ONWC
|
OPge
|
OSBD
|
StNA
|
PSpc
|
PSpL
|
PSUI
|
SUBT
|
TRAC
|
TRAM
|
TRAS
|
TRBS
|
TRGE
|
TRIG
|
TRMA
|
TRSC
|
TXMB
|
TXMP
|
TxtC
|
WMCL
|
WMDD
|
WMM
|
WPge
|
working with XML files: good to know
- capitalization rules (use of capital and small initial letters): You need to care about it because also Onisplit does.
- text position in a line: most tags have some distance towards line begin. It is not needed but preserve the overview.
- structure: some tags have children. Destroying the structure doesn't affect the reconversion but it is not good for the overview. Example:
good:
<Instance id="4" type="IGSA"> <Strings> <Link>#7</Link> </Strings> </Instance>
bad:
<Instance id="4" type="IGSA"><Strings><Link>#7</Link></Strings></Instance>
- code folding: A simple text editor (and being aware of the search function) is actually enough to work with Oni's xml. Anyway, big files might be easier to handle with code folding. So, if you like code folding, you maybe try Microsoft Visual ... Express (PC) or Xcode (Mac). Both are for free.
- You can fold whole instances and parent tags.
- Folded code can be previewed in Microsoft Visual Express applications. Xcode provides an extra scroll popup.
Windows |
way without Windows GUI: window address bar
Put the newest OniSplit.exe into the "edition\GameDataFolder" folder and use the window's address bar (that's where you can see the directory in full length).
Delete that address, type (for example) the code below, and hit enter.
onisplit -extract:xml xml_dir level0_Final/ONCCkonoko*.oni
The star is good for mess extraction/creation and good for shorten long unique file names. ("ONCCkonoko_generic" will be extracted in new folder "edition\GameDataFolder\xml_dir".)
It's also a good idea to keep the code in a temporary opened text file. There you can easily modify the code for other files and doesn't need you to type it from beginning into the address bar. (Be aware of Windows' short cut "CTRL + C" for coping marked text and "CTRL + V" for pasting text.)
way without Mac GUI: the terminal
Put the newest OniSplit.exe into the "Oni/GameDataFolder" folder.
Open the Terminal program then "change directory" to the GameDataFolder (Type "cd " then drag the GameDataFolder into the Terminal window, now press the RETURN key)
At this point you can enter the OniSplit commands, such as:
mono onisplit.exe -extract:xml xml_dir level0_Final/ONCCkonoko*.oni
("ONCCkonoko_generic" will be extracted in new folder "GameDataFolder/xml_dir".)
XML advanced tutorial
Read on HERE.