TOAWxml Editor

Post new mods and scenarios here
Post Reply
User avatar
76mm
Posts: 4765
Joined: Sun May 02, 2004 4:26 am
Location: Washington, DC

TOAWxml Editor

Post by 76mm »

I've been playing around to create an editor for TOAW XML (*.gam) files and have come up with the attached file. So far, it basically allows players to revise most Force, Formation, Unit, and Equipment data in the OOBs and various scenario and force settings.

I decided it would be easier to keep updating this post with the latest version of the app. and the manual, so see below for both. Note that it is too much of a hassle to format the manual text on this forum, if you want to see a properly-formatted version of the manual, a pdf version is included with the install files):
*****************
TOAW XML Editor

Manual

December 8, 2020

v1.23

Current Features:

Revise Force, Formation, and Unit Settings: Change any of the enabled settings. IF YOU CHANGE ANY SETTINGS, BE SURE TO PRESS THE “SAVE CHANGES” BUTTON OR THE CHANGES WILL BE LOST WHEN YOU LEAVE THAT SCREEN!!!

Equipment: The quantity of a unit’s currently assigned equipment is indicated by x (ie, ten units is x10). A unit’s max quantity is indicated in square brackets. Therefore, “Howitzer x5 [10]” indicates that a unit currently has 5 of a maximum of 10 guns.

Color-Coding: Formations and units are color-coded as follows:
Formations: Formations which are locked are indicated in red.

Units: Divided units are indicated in grey. Divided units’ subunits are indicated in blue. Units which are reinforcements are indicated in green.

Dividing/Re-Uniting Units:

Dividing Units: To divide a unit, right-click and select the “Divide Unit” menu option, which will open a screen allowing use to choose whether to create two or three subunits. Once a unit has been divided, it’s name will be indicated in grey, while the divided subunits will be placed directly under the parent and indicated in blue (note that subunits of parent units divided with the in-game editor rather than TOAWxml may not be right below the parent). Units which are already divided, subunits, and sections cannot be divided.

Re-Uniting Units: To re-unite a unit, right-click on the parent unit and select the “Re-Unite Unit” menu option. The subunits will be deleted and the unit will be assigned the location and the deployment of its first subunit.
WARNING!! DO NOT add or delete equipment line items from divided units or their subunits...while you can edit the qty or max number of particular types of equipment, do not add whole new types of equipment, or delete existing equipment (while you can't currently add equipment, it is possible to drag and drop equipment line items from unit to another, but DO NOT DO THIS with divided units or subunits). I also would not reorder equipment within divided units or subunits, although I'm not sure if this would cause any problems.
For the unit division/reunification process to work, the parent and all of the subunits need to have the same number and type of equipment line items (and maybe in the same order, not sure).

Transfer (Drag-and-Drop) Unit within Tree: Select unit in the Treeview, left click on unit and drag to formation to which it should be transferred, release mouse button. It will become the last unit in the selected formation.
Transfer (Drag-and-Drop) Equipment within Tree: Select equipment in the Treeview, left click on equipment and drag to unit to which it should be transferred, release mouse button. It will become the last equipment line in the selected unit.

Change Position of Formation, Unit or Equipment within Tree: Right-click to select Move Up or Move Down, or use the indicated key shortcuts (Ctrl-Up and Ctrl-Down, respectively). Note that in the in-game editor, units are ranked by ID number and so will not be in the same order as in TOAW XML.

Delete Unit: Right-click, select Delete, or use the key shortcut (Ctrl-Del). Confirmation is required for deletion, but there is no “un-do”, so be careful with deletions!
Propagate Settings: Right-click, select Formation Propagation or Unit Propagation, as appropriate. On the form which appears, uncheck any settings which you do not want to propagate.

Copy Formation, Unit: Right-click on formation/unit, select Copy, or use the key shortcut (Ctrl-C).
NOTE: Every now and then I encounter a problem when importing a scenario with a copied formation back into TOAW—the Force Editor does not seem to work. Please save everything before copying formations and let me know if you encounter any problems.

Add New Unit/Formation: Right-click on parent force or formation and select Add New Formation/ Add New Unit, respectively. Player must carefully review and revise any default formation or unit values!

Add New Equipment: Right-click on parent unit and select Add New Equipment, which will open a new form for adding equipment. Equipment can be filtered by category, country, or any of the equipment special capability flags (arranged in general categories). Changing a filter selection will reset any filters “below” the changed filter (although all flag filters are considered to be on the same ”level”, and selecting one will reset the others.

Add, Delete, Revise Depots: . Select relevant force, then press the Next button in right panel. Click on the Supply Depots button to open Depots form. Right-click to add or delete depots, or select relevant cell to revise. Depots IDs cannot be revised.

Add, Delete, Revise Objectives: Click on relevant formation in Tree, then see Objective screen in right panel. Objective tracks can be selected via the dropdown box. Right-click to add or delete objectives, or select relevant cell to revise. Objective IDs cannot be revised.

Static Formations: If a Formation is static, just to the right of the Formation Orders menu there will be an “Entry Turn” box which will allow you to revise the turn when the Formation will be released.

Calendar / Environment Settings: Press the Calend/Environ button on the main form to edit calendar and environment settings. Note that making changes to certain drop-down lists (Turn Length, Map Scale, Climate Area & all Weather Zone 1 drop down boxes) may trigger automatic changes to other items. For instance, Weather Zone 1 is the “base” weather zones, and any changes to made Weather Zone 1 conditions will affect the other Weather Zones, if any. To set conditions for Weather Zones 2 & 3 (if present), simply make any desired changes to the specific condition in the relevant Weather Zone after setting that condition for Weather Zone 1. Note that in this form, changes made via drop down lists are saved automatically, while changes made via manual entry must be saved by pressing the Save Changes button.

Event Editor: Press the Event Editor button on the main form to access the event editor. The treeview lists the events, in order of Event ID. The list can be filtered by Event Trigger or Event Effect, at which point the treeview will also indicate the Event Effect or Event Trigger, respectively. Events can be edited by changing the data in the right panel and hitting the Save button. Events can be added or deleted by right-clicking on an Event and selecting the appropriate menu option.

CAUTIONARY NOTES:

Note re Invalid XML Characters: Certain scenarios include invalid XML characters which will prevent them from working with TOAWxml (for some reason, most occurrences of this error seem to be caused by SS unit names). When you load a *.gam file in TOAWxml, it checks the file for such invalid characters, and if it finds them, replaces them with a “$”. If seeing the “5th $$ Panzer Division” (for example) bothers you, you can go into the gam file in Notepad++ and replace with whatever you want… I should also point out that these characters don't show properly in the game, either, where they are replaced by a small square box.

Note re Unknown Values: The XML for units includes two values which are disregarded by TOAWxml at this point: “NEXT” and “CHARACTERISTICS”. As far I can tell after limited testing, both of these values are auto-generated by the TOAW game engine when you load a scenario, so there is no harm done, but at this point I can’t guarantee that no issues/problems are created by ignoring these XML values. In future, I will try to address these values as time and knowledge of the game engine permit.

Note re Invalid XML Exports: When the in-game editor exports XML files, it erroneously makes every unit in Force 2 a divided subunit, with itself as its parent unit. This is obviously incorrect! TOAWxml will fix this problem automatically when you open TOAWxml or when you load a new gam file, but note that this means that you need to restart TOAWxml or reload the gam file every time you export the gam file from the in-game editor.

HOW TO BREAK YOUR SCENARIO USING TOAWxml!!
While I’m trying very hard to validate all data, etc. to minimize the chance of scenario designers breaking their scenarios by entering the wrong data type (letters instead of numbers, etc.) or wrong data values (outside of valid numeric ranges, etc.), there are at least a few things which will take some time to validate, so I wanted to point them out so that designers DON’T DO THESE:

Overstacking: When creating new units/formations, and especially when copying existing units/formations (with the copied units using the same x,y coordinates!), TOAWxml does not do any checking to see if any hexes are overstacked! If a hex is overstacked and you load it into the in-game editor, it will probably crash…

Adding/Deleting Equipment Line Items from Divided Parent or Divided Sub Units: (see Warning! Above) When you try to re-unite divided sub-units, the program adds up all of the equipment quantities for each equipment line item in each of the sub-units and totals them into the parent unit. If a sub-unit or parent have different numbers of equipment line items, bad things will happen. Note that you can revise sub-unit Max and Current Quantities while units are divided, just don’t add new equipment line items. If you had to add an equipment line item to a particular sub-unit, re-unite the unit first, then add the equipment line item and edit the quantities so that the appropriate subunit has what you want…

Leave TOAWxml Open During Exporting gam File from In-Game Editor: See note above re Invalid XML Exports. Be sure to restart TOAWxml or reload the gam file after every time you export a gam file from the in-game editor.
Attachments
TOAWXML.zip
(533.32 KiB) Downloaded 202 times
User avatar
76mm
Posts: 4765
Joined: Sun May 02, 2004 4:26 am
Location: Washington, DC

RE: TOAW XML Editor

Post by 76mm »

Here is a screen shot of the force editor:


Image
Attachments
xmlforce.jpg
xmlforce.jpg (117 KiB) Viewed 1561 times
User avatar
76mm
Posts: 4765
Joined: Sun May 02, 2004 4:26 am
Location: Washington, DC

RE: TOAW XML Editor

Post by 76mm »

Here is screenie of formation editor:


Image
Attachments
xmlformation.jpg
xmlformation.jpg (91.03 KiB) Viewed 1555 times
User avatar
76mm
Posts: 4765
Joined: Sun May 02, 2004 4:26 am
Location: Washington, DC

RE: TOAW XML Editor

Post by 76mm »

Unit Editor:

Image
Attachments
xmlunit.jpg
xmlunit.jpg (97.28 KiB) Viewed 1554 times
User avatar
76mm
Posts: 4765
Joined: Sun May 02, 2004 4:26 am
Location: Washington, DC

RE: TOAW XML Editor

Post by 76mm »

Equipment editor:

Image
Attachments
xmlequip.jpg
xmlequip.jpg (88.5 KiB) Viewed 1555 times
User avatar
76mm
Posts: 4765
Joined: Sun May 02, 2004 4:26 am
Location: Washington, DC

RE: TOAW XML Editor

Post by 76mm »

Scenario Settings:


Image
Attachments
xmlscensettings.jpg
xmlscensettings.jpg (57.67 KiB) Viewed 1557 times
User avatar
76mm
Posts: 4765
Joined: Sun May 02, 2004 4:26 am
Location: Washington, DC

RE: TOAW XML Editor

Post by 76mm »

For many data points, there are tooltips with the applicable ranges and explanation (summarized from manual). The data points which are disabled are generally those that I could not figure out what they were for, so didn't want people messing them them. If anyone can explain any of these mechanics or point out errors in other stuff, please let me know!
User avatar
76mm
Posts: 4765
Joined: Sun May 02, 2004 4:26 am
Location: Washington, DC

RE: TOAW XML Editor

Post by 76mm »

Here's an example of the tooltips:

Image
Attachments
xmltooltips.jpg
xmltooltips.jpg (61.78 KiB) Viewed 1555 times
Oberst_Klink
Posts: 4839
Joined: Sun Feb 10, 2008 7:37 pm
Location: Germany
Contact:

RE: TOAW XML Editor

Post by Oberst_Klink »

+1 Thanks!

Klink, Oberst
My Blog & on Twitter.
Visit CS Legion on Twitter & Facebook for updates.
User avatar
Lobster
Posts: 5299
Joined: Thu Aug 08, 2013 2:12 pm
Location: Third rock from the Sun.

RE: TOAW XML Editor

Post by Lobster »

[&o][&o][&o]

Creating a Force from scratch would be nice.
http://www.operationbarbarossa.net/

Two things are infinite: the universe and human stupidity and I’m not sure about the universe-Einstein

Q: What do you call a boomerang that doesn’t come back?
A: A stick.
User avatar
76mm
Posts: 4765
Joined: Sun May 02, 2004 4:26 am
Location: Washington, DC

RE: TOAW XML Editor

Post by 76mm »

I've just figured out how to drag-and-drop units in the tree to transfer them.

Buhahahah...I've been wanting to do that in TOAW for 20 years... I've got to fix a few more things than will post a revised version.
User avatar
76mm
Posts: 4765
Joined: Sun May 02, 2004 4:26 am
Location: Washington, DC

RE: TOAW XML Editor

Post by 76mm »

ORIGINAL: Lobster
Creating a Force from scratch would be nice.
Yeah, this is on my list, I think it should be doable. But first I want to wrap up a couple of things related to existing units, such as transferring and deleting them, as well as adding individual units to existing formations and additional equipment to existing units.

Then I can look at creating units from scratch.
Rosseau
Posts: 2928
Joined: Sun Sep 13, 2009 2:20 am

RE: TOAW XML Editor

Post by Rosseau »

Sorry but how do you create the xml (.gam) files? I cannot locate anything in my directories currently. Thanks.
User avatar
JapLance
Posts: 131
Joined: Sat Nov 30, 2002 1:55 pm
Location: Mallorca, Spain

RE: TOAW XML Editor

Post by JapLance »

ORIGINAL: Rosseau

Sorry but how do you create the xml (.gam) files? I cannot locate anything in my directories currently. Thanks.

Loading the Scenario in the Scenario editor, and then selecting Save Game(XML) as from the File menu
Greetings from Spain.
User avatar
winkelried
Posts: 59
Joined: Fri Aug 10, 2007 1:01 pm

RE: TOAW XML Editor

Post by winkelried »

Having problems running on my 64bit Windows 10 machine. Already when starting up i keep getting an ".NET Framework unhandled exception" error: "Invalid character in the given encoding. Line 100, position 85". Any idea?
Honneur et Fidélité
User avatar
Lobster
Posts: 5299
Joined: Thu Aug 08, 2013 2:12 pm
Location: Third rock from the Sun.

RE: TOAW XML Editor

Post by Lobster »

ORIGINAL: 76mm
ORIGINAL: Lobster
Creating a Force from scratch would be nice.
Yeah, this is on my list, I think it should be doable. But first I want to wrap up a couple of things related to existing units, such as transferring and deleting them, as well as adding individual units to existing formations and additional equipment to existing units.

Then I can look at creating units from scratch.

Even as it is this is a wonderful tool. It is a huge p.i.t.a. to do things like set replacement priority or experience and proficiency and supply and readiness. It takes FOREVER especially when you are working with a huge OOB. So keep up the good work. This is a hugely useful tool just as it is because everything is in one place. [&o]
http://www.operationbarbarossa.net/

Two things are infinite: the universe and human stupidity and I’m not sure about the universe-Einstein

Q: What do you call a boomerang that doesn’t come back?
A: A stick.
User avatar
joey
Posts: 1456
Joined: Sat May 08, 2004 8:00 pm
Location: Johnstown, PA

RE: TOAW XML Editor

Post by joey »

I have been waiting for something like this for a long, long time. Many thanks! j
User avatar
76mm
Posts: 4765
Joined: Sun May 02, 2004 4:26 am
Location: Washington, DC

RE: TOAW XML Editor

Post by 76mm »

ORIGINAL: winkelried
Having problems running on my 64bit Windows 10 machine. Already when starting up i keep getting an ".NET Framework unhandled exception" error: "Invalid character in the given encoding. Line 100, position 85". Any idea?
That's strange, because I've got a 64 bit Win10 machine, and it works fine. Let me google the error you're getting and I can see if I can identify the problem.
User avatar
76mm
Posts: 4765
Joined: Sun May 02, 2004 4:26 am
Location: Washington, DC

RE: TOAW XML Editor

Post by 76mm »

ORIGINAL: Lobster
It is a huge p.i.t.a. to do things like set replacement priority or experience and proficiency and supply and readiness. It takes FOREVER especially when you are working with a huge OOB. So keep up the good work. This is a hugely useful tool just as it is because everything is in one place.

I don't think it will be too difficult to add a feature that allows you to apply these settings on a formation or force basis--is that what you have in mind?
User avatar
joey
Posts: 1456
Joined: Sat May 08, 2004 8:00 pm
Location: Johnstown, PA

RE: TOAW XML Editor

Post by joey »

It does not appear to work on my machine. I keep getting the below message and the program crashes. Any thoughts?

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Xml.XmlException: '', hexadecimal value 0x1F, is an invalid character. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ThrowInvalidChar(Char[] data, Int32 length, Int32 invCharPos)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
at System.Xml.Linq.XDocument.Load(String uri)
at TOAWXML.xmlform.xmlform_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2117.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
TOAWXML
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Users/john%20new/Documents/My%20Games/The%20Operational%20Art%20of%20War%20IV/TOAWXML.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2117.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2117.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2117.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2053.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2117.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2117.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Xml.Linq
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2053.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Post Reply

Return to “Mods and Scenarios”