XML:XML Modding Lessons: Difference between revisions

From OniGalore
Jump to navigation Jump to search
m (link fix)
m (wording tweaks and formatting tweaks)
Line 6: Line 6:
Oni's resources could be separated into one of two categories: media (such as textures and sounds), and non-media (such as character class data). Most of the non-media data can be exported to XML. This allows much easier modding than the hex-editing of the old days (compare the two methods [[Adding_spawnable_characters|here]]). Some media resources can also be edited as "XML", referring to the fact that an XML file will be created alongside the resource's image/sound file when it is exported from the game data, and this XML companion file contains metadata about the media resource that allows [[OniSplit]] to re-import the resource when you are done editing it.
Oni's resources could be separated into one of two categories: media (such as textures and sounds), and non-media (such as character class data). Most of the non-media data can be exported to XML. This allows much easier modding than the hex-editing of the old days (compare the two methods [[Adding_spawnable_characters|here]]). Some media resources can also be edited as "XML", referring to the fact that an XML file will be created alongside the resource's image/sound file when it is exported from the game data, and this XML companion file contains metadata about the media resource that allows [[OniSplit]] to re-import the resource when you are done editing it.


To learn what the different resource types do, and to see which types can be edited through XML, see the database link below. Though XML modding can generally be done with nothing more than OniSplit's command line interface and a text editor, the tutorials linked to below are written with the [[Anniversary Edition]] in mind, because the AE provides modding tools (including a GUI for OniSplit), gives you a framework for testing your mod package, and globalizes more of Oni's data so it can be used in any level.
To learn what the different resource types do, and to see which types can be edited through XML, see the database link below. Though XML modding can generally be done with nothing more than OniSplit's command line interface and a text editor, the tutorials linked below are written with the [[Anniversary Edition]] in mind, because the AE provides modding tools (including a GUI for OniSplit), gives you a framework for testing your mod package, and globalizes more of Oni's data so it can be used in any level.


==Working with XML files==
==Working with XML files==
[[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 technical 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>. You can thus edit an XML file in any text editor, such as Notepad in Windows and TextEdit on the Mac.
[[Image:Visual Studio collapsed code.png|thumb|right|Code folding in Visual Studio 2019.]]
[[Image:Xcode collapsed code.png|thumb|right|Xcode 12. If you don't see the code folding ribbon, see Preferences… > Text Editing > Display > Code folding ribbon.]]
[[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><nowiki><Data>Some data here</Data></nowiki></tt>, and these tags can be arranged in a hierarchy to keep things organized. The only technical difference between a normal text file and an XML file is that the file name ends in ".xml" instead of ".txt" and that it typically begins with the string <tt><?xml version="1.0" encoding="UTF-8" ?></tt>. You can thus edit an XML file in any text editor, such as Notepad in Windows and TextEdit on the Mac.


* '''See the tutorials''' below to learn how to extract game data as XML, modify it, and get it back into Oni.
* '''See the tutorials''' below to learn how to extract game data as XML, modify it, and get it back into Oni.
* '''Capitalization matters''': OniSplit is case-sensitive when it processes the XML.
* '''Capitalization matters''': OniSplit is case-sensitive when it processes the XML.
* '''Text indentation''': most tags have some indentation (tabs). It is not needed by OniSplit but it helps one get an understanding of the hierarchy. Example:
* '''Text indentation''': Most tags have some indentation (tabs). It is not required by OniSplit but it helps one get an understanding of the hierarchy. Two examples:
good:
 
Good:
     <Instance id="4" type="IGSA">
     <Instance id="4" type="IGSA">
         <Strings>
         <Strings>
Line 20: Line 23:
         </Strings>
         </Strings>
     </Instance>
     </Instance>
bad:
 
Bad:
     <Instance id="4" type="IGSA"><Strings><Link>#7</Link></Strings></Instance>
     <Instance id="4" type="IGSA"><Strings><Link>#7</Link></Strings></Instance>


* '''Code folding''': A simple text editor (and good use of the search function) is actually enough to work with Oni's XML. But big files might be easier to handle with what programmers call "code folding". Code folding is found in [[wikipedia:IDE|IDEs]] like [https://visualstudio.microsoft.com Microsoft Visual Studio] (Windows) and [https://developer.apple.com/xcode/ Xcode] (Mac). Both are free.
* '''Code folding''': A simple text editor (and good use of the search function) is actually enough to work with Oni's XML. But big files might be easier to handle with what programmers call "code folding". Code folding allows you to collapse tags in order to get a better sense of the overall file structure, and is found in [[wikipedia:IDE|IDEs]] like [https://visualstudio.microsoft.com Microsoft Visual Studio] (Windows) and [https://developer.apple.com/xcode/ Xcode] (Mac). Both programs are free.
: This allows you to fold whole instances and parent tags. Folded code can be previewed in Microsoft Visual Studio applications. Xcode provides an extra scroll popup.
 
<gallery>
Image:Visual_Studio_collapsed_code.png|Visual Studio 2008
Image:Xcode.png|Xcode
</gallery>
 
Bonus hint: for comparing text files you can use [https://winmerge.org/ WinMerge].


* '''File comparison''': For comparing two versions of an XML file to find the changes, you can use [https://winmerge.org/ WinMerge] (Windows) or FileMerge (Mac, comes with Xcode). Note that if one file has passed through Oni, the data may have been totally reordered and cannot be diff-gazed effectively.


==Hitting the learning curve==
==Hitting the learning curve==
;What can I change in the game?
;Which resource types do what in the game?
*[[XML:File types|Database of Oni's resource types]]
*[[XML:File types|Database of Oni's resource types]]
;How do I edit XML?
;How do I edit XML?
Line 41: Line 38:
;How do I get my mod into the game?
;How do I get my mod into the game?
*[[Making a patch mod]]
*[[Making a patch mod]]
;How do I do more complex mods?
;How do I make more complex mods?
*[[XML:Advanced tutorial|Advanced tutorial]]
*[[XML:Advanced tutorial|Advanced tutorial]]
*[[XML:Expert tutorial|Expert tutorial]]
*[[XML:Expert tutorial|Expert tutorial]]


===Popular modding types requiring XML===
===Popular modding types requiring XML===
Line 55: Line 51:
;How do I add contrails to character moves?
;How do I add contrails to character moves?
* [[XML:TRAM#Adding_colorful_trails]]
* [[XML:TRAM#Adding_colorful_trails]]


{{XML}}
{{XML}}

Revision as of 23:10, 19 March 2021

XML.png
This article builds on the general introduction to modding found at Modding Oni.

The XML namespace is devoted to explaining Oni's data types in plainer English than the technical documentation at OBD, and provides tutorials in XML modding.

Oni's resources could be separated into one of two categories: media (such as textures and sounds), and non-media (such as character class data). Most of the non-media data can be exported to XML. This allows much easier modding than the hex-editing of the old days (compare the two methods here). Some media resources can also be edited as "XML", referring to the fact that an XML file will be created alongside the resource's image/sound file when it is exported from the game data, and this XML companion file contains metadata about the media resource that allows OniSplit to re-import the resource when you are done editing it.

To learn what the different resource types do, and to see which types can be edited through XML, see the database link below. Though XML modding can generally be done with nothing more than OniSplit's command line interface and a text editor, the tutorials linked below are written with the Anniversary Edition in mind, because the AE provides modding tools (including a GUI for OniSplit), gives you a framework for testing your mod package, and globalizes more of Oni's data so it can be used in any level.

Working with XML files

Code folding in Visual Studio 2019.
Xcode 12. If you don't see the code folding ribbon, see Preferences… > Text Editing > Display > Code folding ribbon.

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. <Data>Some data here</Data>, and these tags can be arranged in a hierarchy to keep things organized. The only technical difference between a normal text file and an XML file is that the file name ends in ".xml" instead of ".txt" and that it typically begins with the string <?xml version="1.0" encoding="UTF-8" ?>. You can thus edit an XML file in any text editor, such as Notepad in Windows and TextEdit on the Mac.

  • See the tutorials below to learn how to extract game data as XML, modify it, and get it back into Oni.
  • Capitalization matters: OniSplit is case-sensitive when it processes the XML.
  • Text indentation: Most tags have some indentation (tabs). It is not required by OniSplit but it helps one get an understanding of the hierarchy. Two examples:

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 good use of the search function) is actually enough to work with Oni's XML. But big files might be easier to handle with what programmers call "code folding". Code folding allows you to collapse tags in order to get a better sense of the overall file structure, and is found in IDEs like Microsoft Visual Studio (Windows) and Xcode (Mac). Both programs are free.
  • File comparison: For comparing two versions of an XML file to find the changes, you can use WinMerge (Windows) or FileMerge (Mac, comes with Xcode). Note that if one file has passed through Oni, the data may have been totally reordered and cannot be diff-gazed effectively.

Hitting the learning curve

Which resource types do what in the game?
How do I edit XML?
How do I get my mod into the game?
How do I make more complex mods?

Popular modding types requiring XML

How do I create levels?
How do I add characters to a level?
How do I add Daodan to a character?
How do I add contrails to character moves?