XML:Basic tutorial: Difference between revisions

From OniGalore
Jump to navigation Jump to search
mNo edit summary
m (added a marker dot I forgot, typo fixed)
Line 123: Line 123:
: List of patrol paths in a specific level. A patrol path has an Id which is used by CHAR and script command "ai2_dopath".
: List of patrol paths in a specific level. A patrol path has an Id which is used by CHAR and script command "ai2_dopath".
|-
|-
|'''BINA/OBCJ/[[OBD_talk:BINA/OBJC/PWRU|PWRU]]'''
|'''BINA/OBCJ/[[OBD_talk:BINA/OBJC/PWRU|PWRU]]''' [[Image:Aqua Dot-Green.png]]
: List of powerups (items, e.g. hyposprays) in a specific level which are spawned at level load. There you can setup their position.
: List of powerups (items, e.g. hyposprays) in a specific level which are spawned at level load. There you can setup their position.
|-
|-
Line 219: Line 219:
|-
|-
|'''[[OBD:TRMA|TRMA]]''' [[Image:Aqua Dot-Grey.png]]
|'''[[OBD:TRMA|TRMA]]''' [[Image:Aqua Dot-Grey.png]]
: Character's texture map array. Every body part is covered by textures. This file type holds a links. See TRIA to identify to parts.   
: Character's texture map array. Every body part is covered by textures. This file type holds links to those textures. See TRIA to identify to parts.   
|-
|-
|'''[[OBD_talk:TXMB|TXMB]]''' [[Image:Aqua Dot-Green.png]]
|'''[[OBD_talk:TXMB|TXMB]]''' [[Image:Aqua Dot-Green.png]]

Revision as of 11:33, 17 July 2009

XML modding: getting started

What is XML modding?

Binary data becomes converted into more human-readable form which allows easier modding. All supported file types can be seen HERE.

Okay, what do I need?

OniSplit will be your tool. It's part of AE. Installing AE spares you some work because it splits the level achieves right away and globalize some more data. Global data can be used in any level.

AE installed. What now?

OniSplit cannot be opened in a classic way. But you are lucky. Now we have a GUI (graphical user interface) for it.
Mac user will want to get "AETools (Beta)"
Unpack and put "AETool" and "AETools_Data" into your "edition" folder.
Windows user will want to get "OniSplit GUI v0.6"
Unpack and put the executables into your "edition" folder.

Is there an easy exercise to get me started?

Just see at the following table. Read left side if you use a Macintosh, read right side if you use Windows.


converting an ONI file into an XML file
Open AETools. Click on "Export" tab, select checkbox "Export as .xml file", then click on "Export .oni file" and chose "ONCCk4_L.oni". See "XMLfiles" in "AETools_Data". There you should find "ONCCk4_L.xml". XML_tutorial_mac_img1_TN.png Open the GUI. Chose "ONI - XML" tab. Write "GameDataFolder/level0_Final/ONCCk4_L.oni" into the first line. "extracted" into the other. After clicking on "Convert" you should see a new folder named "extracted". XML_tutorial_img1_TN.png
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. XML_tutorial_mac_img2_TN.png Open the extracted file with a simple text editor. Search for "HasSupershield" tag and set its value to "1". Save file. XML_tutorial_img2_TN.png
creating, debugging, and transporting the file
Let's choose the "Import" tab now. Click on the first drop down menu in case there is not level0_Final already chosen. AETools will create the ONI file in that folder.


Now click on "Import source file" button. Navigate to your XML file, select it and click "Choose source" button.


Made a mistake when modified the XML file? The terminal window would appear now and telling you the trouble making line. Find the line in you XML file and fix it. Line number isn't always accurate. (It can shift - often by 1.) Then try again creating the file.

XML_tutorial_mac_img3_TN.png


XML_tutorial_mac_img4_TN.png

Goto GUI's "XML -> ONI" section and write "extracted/ONCCk4_L.xml" into its first line and "created" into its second line. After clicking "Convert" you should see a new folder named "created".


Try THIS method if no oni file was created. Use then "onisplit -create created extracted/ONCCk4_L.xml" and look for error messages. Find the line in you XML file and fix it. Line number isn't always accurate. (It can shift - often by 1). Then try again creating the file.


Copy the file from "created" folder and insert it into the "level0_Final" folder which is located in the "GameDataFolder". Confirm the replacement.

XML_tutorial_img3_TN.png


XML_tutorial_img4_TN.png

recombining the level archive
Click on "Select Level to rebuild" and then "LEVEL 0: GLOBAL DATA". XML_tutorial_mac_img5_TN.png Let's choose the GUI's first tab now, "Compile". Write "GameDataFolder/level0_Final" into the first line, "level0_Final" into the second and "GameDataFolder" into the third line. Click now on "Compile" and wait until onisplit's black window disappears again. XML_tutorial_img5_TN.png
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. XML_tutorial_img6_TN.png 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. XML_tutorial_img6_TN.png


Okay. What mod possibilities do I have?

See HERE again. It's an overview what you could do. 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 AE's current To-Do page and maybe there are fields that need a modder.


supported file types

General information.
In which level is chapter X stored? See HERE.
Aqua Dot-Green.png : XML documentation available
Aqua Dot-Yellow.png : XML documentation available but incomplete
Aqua Dot-Red.png : XML documentation not available but that doesn't mean you cannot mod the file type
Aqua Dot-Grey.png : XML documentation not needed / uninteresting file type
BINA/OBCJ/CHAR Aqua Dot-Yellow.png
List of characters in a specific level. There you can setup their position, script name, weapon, ammunition, items, team, combat, melee id, etc..
BINA/OBCJ/CONS Aqua Dot-Green.png
List of consoles in a specific level. There you can setup their position, script name (Id), screen images, and script functions. Basically they are used to open doors.
BINA/OBCJ/CMBT Aqua Dot-Red.png
List of combat profiles for global use. There you can set AI's conditions for hand-to-hand, weapon combat, and retreat - in dependence of distances and enemy's counterattack.
BINA/OBCJ/DOOR Aqua Dot-Green.png
List of doors in a specific level. There you write conditions when a door opens (or not), and what events are triggered by a character who come passes/comes near the door.
BINA/OBCJ/FLAG Aqua Dot-Green.png
List of flags in a specific level. There you can setup their position. They are used by script commands and patrol paths.
BINA/OBCJ/FURN Aqua Dot-Grey.png
List of furniture in a specific level. This file type could be extract as XML file but it's obsolete, nothing more than a relict from time of development.
BINA/OBCJ/MELE Aqua Dot-Red.png
List of melee profiles for global use. It means how the AI use it's combat moves.
BINA/OBCJ/NEUT Aqua Dot-Green.png
List of neutral behaviors in a specific level. Every character has melee, combat and netral behavior Id. It determines whether a non-player character (NPC) talks to you or not, this includes also rewards you could get from such characters.
BINA/OBCJ/PART Aqua Dot-Green.png
List of particle in a specific level. There you can setup their position, script name and scaling.
BINA/OBCJ/PATR Aqua Dot-Green.png
List of patrol paths in a specific level. A patrol path has an Id which is used by CHAR and script command "ai2_dopath".
BINA/OBCJ/PWRU Aqua Dot-Green.png
List of powerups (items, e.g. hyposprays) in a specific level which are spawned at level load. There you can setup their position.
BINA/OBCJ/SNDG Aqua Dot-Red.png
List of sound "groups" (spheres) in a specific level.
It used to create sound spheres. Come near a machine and you might hear a sound, that's because of SNDG.
BINA/OBCJ/TRGV Aqua Dot-Green.png
List of trigger volumes in a specific level. They are invisible areas which trigger script functions, this depends on character's team Id.
BINA/OBCJ/TRIG Aqua Dot-Green.png
List of laser triggers in a specific level. There exist several forms and can trigger not only script functions.
BINA/OBCJ/TURR Aqua Dot-Green.png
List of turrets in a specific level. Not that their pods are part of the level geometry. Spawn one additional and it might be located somewhere in the air. Basicly you can setup their head's position, the weapon inside the turrent head, and the team Id which is the target.
BINA/OBCJ/WEAP Aqua Dot-Green.png
List of weapons in a specific level which are spawned at level load. Actually only the position of them is set there.
BINA/ONIE Aqua Dot-Yellow.png
ONIE is a list of all impacts effects which can happen in the game. That includes weapon particle, hand-to-hand combat and movements. The impact effects depends on sorce type and the material which is hit.
BINA/TMBD Aqua Dot-Green.png
TMBD is a list of all materials in the game which groups texture map under them. That way environment gets materials which are used by ONIE.
CONS Aqua Dot-Red.png
Console. You can write there user's position and facing and also the screen images.
DPge Aqua Dot-Green.png
Diary page. You what to write a page for a new level or alternative story then there you go.
FILM Aqua Dot-Green.png
Movement record. Usually used for cutscenes. During that time of animation, AIs have no AI. ^_^
HPge Aqua Dot-Grey.png
Help page. But, ahm, who wants to mod that?
IGHH Aqua Dot-Red.png
In-game HUD. That's your health bar, compass, etc..
IPge Aqua Dot-Green.png
Item page. If you have created a new item then there you can describe it, give warnings, whatever.
Impt Aqua Dot-Green.png
Impact. This file is used to build up the hierarchy of impacts. See ONIE for more information.
Mtrl Aqua Dot-Green.png
Material. This file is used to build up the hierarchy of materials. See ONIE for more information.
ONCC Aqua Dot-Yellow.png
Character class. It contains weapon skills, behavior Ids, view radius, jump power, sounds, 3D model (TRBS), animation collection (TRAC), textures (TRMA), and much more.
The XML file contains also the character's body part material (CBPM), body part impacts (CBPI), and particles for animations (ONCP and ONIA).
ONCV Aqua Dot-Green.png
Character variant. 1) It's used to build up the hierarchy of randomness pools. Some characters with different appearance can form a pool for randomness. A flag in CHAR determinze if a character use one of these pools. 2) It can be also used to upgrade characters on difficult level hard - enabled by a flag in CHAR.
ONGS Aqua Dot-Yellow.png
Game settings. There you can modify the values of the health bar, hypospray strength, game difficult setting, at what distance item glow is displayed, and autoprompts (text message when picking up a new kind of item).
ONLD Aqua Dot-Red.png
Level descriptor. In other words it is the level name in the save game menu.
ONSK Aqua Dot-Red.png
Sky. It's design as box so you will need five images. (The buttom has of course no image.)
ONVL Aqua Dot-Green.png
Variant list of characters. It's used for randomize characters' appearance.
ONWC Aqua Dot-Red.png
Weapon class. Contains primary and secondary fire mode, more flags, particle, 3D model, and textures.
OPge Aqua Dot-Green.png
Objective page. That's the place where you can write the objective for a new or modified level.
PAR3 Aqua Dot-Yellow.png
3D particle. Particle are used as weapon's damage doer, decals and light effects.
PSpc Aqua Dot-Green.png
Part specification. Oni can decorate a page (OPge, TxtC, maybe other too) with images from one source. You write coordinates there which means these parts.
PSpL Aqua Dot-Red.png
Part specification list.
PSUI Aqua Dot-Red.png
Part Specifications UI (User Interface).
TRAC Aqua Dot-Red.png
Animation collection. Every character can move and fight thanks to a collection.
TRAM Aqua Dot-Red.png
Animation. Theoretical it's possible to write animations in XML but so far nobody has been crazy enough to do that. The format might change in near future enabling real animation modding. At the moment we use it only for minor tweaks and particle links.
TRGE Aqua Dot-Red.png
Laser trigger emitter. This file type holds the 3D model and it's coordinates. Used by TRIG.
TRMA Aqua Dot-Grey.png
Character's texture map array. Every body part is covered by textures. This file type holds links to those textures. See TRIA to identify to parts.
TXMB Aqua Dot-Green.png
Big texture map. Only used for spalsh screens, you know .. these big Intro, WinLevel and LoseLevel images.
TXMP Aqua Dot-Red.png
Texture map. Well, this type covers all images in Oni. (TXMB are actually TXMP too.)
TxtC Aqua Dot-Green.png
Console text. Each time you access a console you get a text page. That's TxtC.
WMCL Aqua Dot-Red.png
Window menu cursor list. Mouse pointer(s).
WMDD Aqua Dot-Green.png
Window Menu Dialog Data. It shapes pages like TxtC and WPge. However, new button functions would require engine modding.
WMM Aqua Dot-Red.png
Window menu menu.
WPge Aqua Dot-Green.png
Weapon page. That's the place where you can write descriptions page about a specific weapon.

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. It doesn't hurt to break the structure but is also not good for the overview. Example:
   <Instance id="4" type="IGSA">
       <Strings>
           <Link>#7</Link>
       </Strings>
   </Instance>
   <Instance id="4" type="IGSA"><Strings><Link>#7</Link></Strings></Instance>
  • code folding: don't destroy the structure to compress code. There are tools which can handle large xml files. (e.g. Microsoft Visual ... Express and xcode both for free)
You can fold whole instances and parent tags.
Folded code can be previewed in Microsoft Visual Express applications, although xcode provides an extra scroll popup.
collapse_code_preview.png
Windows (Visual C++)

hover_an_instance_preview.png
Windows

code_folding_preview.png
Macintosh (xcode)


way without Windows GUI: window address bar

window_address_bar_preview.png

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 "shift + c" for coping marked text and "shift + v" for pasting text.)


*.oni file creating goes like this:

onisplit -create oni_dir xml_dir/ONCCkonoko_generic.xml

level_recombine_preview.png


level recombining goes like this:

onisplit -import:nosep level0_Final level0_Final.dat

You can put this line also into a new bat file. It saves you some time during intensive modding. Then just double-click it.


way without Windows GUI: local called CMD

Useful for debugging. Copy the code into an empty text file and save it as whatever.reg, then double click it.

REGEDIT4
[HKEY_CLASSES_ROOT\Directory\shell\cmd]
@="Open Command Window Here"
[HKEY_CLASSES_ROOT\Directory\shell\cmd\command]
@="cmd.exe /k \"cd %L\""
[HKEY_CLASSES_ROOT\Drive\shell\cmd]
@="Open Command Window Here"
[HKEY_CLASSES_ROOT\Drive\shell\cmd\command]
@="cmd.exe /k \"cd %L\""

Now you can goto "Oni/edition" and mark the GameDataFolder, right-click it, a popup menu appears, click "Open Command Window Here".


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".)