[Tool] Unit XML Editor

By on July 11, 2010 12:11:58 PM from Elemental Forums Elemental Forums

Dioxus

Join Date 02/2008
+5

For those out there who feel that editing XML files might be too confusing (or, like me, are just too lazy to go editing through tons of XML-files manually) I'd like to present a small unit-editor. What i've tried to do with it is to make it as easy to fill in most of the data as possible, with dynamic lists for items like sound-effects, background-images and equipment that will update themselves as you add more content to the game.

 

31.07.2010:

Ok, with Beta 4 now out i've been able to go along way towards finishing this editor. It now automatically builds list of the following things:

  • Unit Prerequisites (Technologies)
  • Eye textures / skin textures (With thumbnaills)
  • Animations (With thumbnaills)
  • Talents and abilities
  • Background and medallion images (With thumbnaills)
  • Equipment (With thumbnaills)
  • Spellbooks (With lists of spells contained in the book)
  • Soundeffects (With playback of the soundeffects from the editor)

Still left to do:

  • Automatic list-creation of units for easy editing
  • General error-handling, editor is still too sensitive to typo's in the xml files (Which you'll discover the first time you run it, since there's an typo in one of the official stardock equipment xml files)
  • Automatic list-creation for ModelPath and UnitModelType (Editor currently always uses Gfx\HKB\Units\K_Male_Mesh_01.hkb and KingdomMale respectively)
  • Implementing editing of xml files and support for xml-files containing multiple units. Currently only the "SaveAs" button works and not the "Save".

Huge thanks to John Hughes for having the patience to test this for me.

If anyone wants to try it out then the latest version can be found here.

http://www.megaupload.com/?d=52S5UTJQ

New stuff:

Abilities

SpellbooksAnimation Browser

Prerequisites

http://www.megaupload.com/?d=52S5UTJQ
Locked Post 28 Replies +3
Search this post
Subscription Options


Reason for Karma (Optional)
Successfully updated karma reason!
July 11, 2010 1:05:43 PM from Elemental Forums Elemental Forums

Lol, I was just thinking about something like this and here it is.

 

It's looking nice.

Reason for Karma (Optional)
Successfully updated karma reason!
July 11, 2010 5:04:38 PM from Elemental Forums Elemental Forums

I'd like to try it out.

What I'd really like, though, is to know how to make one.  I bet it's really simple once you know how to do it, but incredibly useful.  For this one game alone there could be a dozen types of files for which you could create an editor, and then there are files in other games, files you use at work--I'd really like to know how you made this.

Reason for Karma (Optional)
Successfully updated karma reason!
July 12, 2010 2:05:38 PM from Elemental Forums Elemental Forums

Easiest way i've found in .net goes something like this:

 

XmlTextReader XmlReader = New XmlTextReader(PathToXml);

While(XmlReader.Read()) //Loops through the xml file one line at a time untill the end.

{

if(XmlReader.NodeType != XmlNodeType.EndElement) //Only the Start and ends of the elements seems to have names. Makes sure that the one currently selected is the start of the element.

{

switch(XmlReader.Name) //Gets the name of the element and matches it to one of the cases below.

{

Case "NameOfVariable": //Here you can put for instance KingdomModelType if thats one of the values you want.

{

XmlReader.Read(); //Reads another line ahead to get to the value part.

Variable = XmlReader.Value; //Saves the value-part to a variable of your choosing. You can also save directly to for instance a text-box.

break;

}

}

}

}

 

There are some better and way more robust methods for reading the xml-files, but i have no idea how they work.

Reason for Karma (Optional)
Successfully updated karma reason!
July 12, 2010 4:36:11 PM from Elemental Forums Elemental Forums

Thanks.  That gives me some good new keywords to search.  I found lots of savegame editors written in VB, but not one tutorial on how it was done.

Reason for Karma (Optional)
Successfully updated karma reason!
July 12, 2010 10:14:35 PM from Elemental Forums Elemental Forums

Added some comments to the above explanation. One of the things that seemed a bit strange to me when working with this is that the xml reader seems to treat what we see as one line as 3 or more lines. So if you had the following in xml:

  <InfoCardBackground>BG24_Volcano</InfoCardBackground>

And then started reading through it with the Xmlreader it would in a simplified way go something like this:

XmlReader.Read()

"<InfoCardBackground>"

XmlReader.Read()

"BG24_Volcano"

XmlReader.Read()

"</InfoCardBackground>"

Reason for Karma (Optional)
Successfully updated karma reason!
July 14, 2010 8:17:25 AM from Elemental Forums Elemental Forums

I recommend using a program called Ultra Edit. Best scripting tool I've ever used. It's awesome. Do a Google search on it and I'm sure you'll find a free-ware version or trial version that will do the trick as long as you can complete your work before the 30 day trial runs out. If not, then edit your registry, take all the entries for it Out of your Registry, then it will re-install with a new 30 days of trial time. Is doing that Illegal? No, it's a "grey area". You aren't cracking anything or applying some illegal crack. You're mearly editing Your Computers Registry.

Warning: I take NO responsibility if you Don't know how to properly edit your Registry. If you accidentally edit out the wrong thing you can f'k your computer up to the point that you may need to do a total wipe and re-install of your OS. You have been warned. Registry Editing is ONLY for those who KNOW what they are doing. Use caution.

Reason for Karma (Optional)
Successfully updated karma reason!
July 14, 2010 8:49:51 AM from Elemental Forums Elemental Forums

Quoting Raven X,
I recommend using a program called Ultra Edit. Best scripting tool I've ever used. It's awesome. Do a Google search on it and I'm sure you'll find a free-ware version or trial version that will do the trick as long as you can complete your work before the 30 day trial runs out. If not, then edit your registry, take all the entries for it Out of your Registry, then it will re-install with a new 30 days of trial time. Is doing that Illegal? No, it's a "grey area". You aren't cracking anything or applying some illegal crack. You're mearly editing Your Computers Registry.

Warning: I take NO responsibility if you Don't know how to properly edit your Registry. If you accidentally edit out the wrong thing you can f'k your computer up to the point that you may need to do a total wipe and re-install of your OS. You have been warned. Registry Editing is ONLY for those who KNOW what they are doing. Use caution.

Alternatively, if you feel the people who invested the time to create Ultra Edit did a good job, you could pay them for their time and effort by buying their product once you've tried it.

Reason for Karma (Optional)
Successfully updated karma reason!
July 14, 2010 8:55:37 AM from Elemental Forums Elemental Forums

Quoting Spitz,

Alternatively, if you feel the people who invested the time to create Ultra Edit did a good job, you could pay them for their time and effort by buying their product once you've tried it.

That's what I did. I bought a boxed copy with a license years ago back when I was still working on UO. I just brought up the other way for those who might only need it temporarily. If you know what you're doing as far as the scripting goes I really can't see a reason someone would need it for longer the 30 days anyway. If so though, the makers of Ultra Edit do indeed deserve money for their creation. As I said, it's the best scripting Tool I've ever used, and let me tell you, over the years I've tried a LOT of scripting programs. Ultra Edit is by far the easiest to understand and use even for beginners.

Reason for Karma (Optional)
Successfully updated karma reason!
July 14, 2010 9:02:26 AM from Elemental Forums Elemental Forums

I use JCreator and NetBeans, but then again, I only do java so far. JCreator is alot nicer than you might think, since it doesn'tt mess anything up at all. NetBeans is graphical but adds dozens of things I don't have a clue what they do. I did a java based editor for html with a cousin of mine, should be easy to do an xml one. But if this one works, that would be pointless. Java has predefined xml classes I have never looked at, but they are there.

Reason for Karma (Optional)
Successfully updated karma reason!
July 14, 2010 9:14:31 AM from Elemental Forums Elemental Forums

Why not just download Visual Studio Express? It's free, and all the screenshots Frogboy posts with the XML files are from VS

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2010 9:14:01 AM from Elemental Forums Elemental Forums

Quoting Annatar11,
Why not just download Visual Studio Express? It's free, and all the screenshots Frogboy posts with the XML files are from VS

 

Pretty much that.

Reason for Karma (Optional)
Successfully updated karma reason!
July 15, 2010 9:18:26 AM from Elemental Forums Elemental Forums

just use notepad wonder if they will do something from making your Sov look female and yet be male and have sons that look female... weird but it happened.... did it while i was bored

Reason for Karma (Optional)
Successfully updated karma reason!
July 19, 2010 12:17:22 AM from Elemental Forums Elemental Forums

eclipse

Reason for Karma (Optional)
Successfully updated karma reason!
July 20, 2010 3:45:08 AM from Elemental Forums Elemental Forums

There are two huge benefits to this:

1. It opens up .xml modding to people who are afraid of XML

2. It saves you from having to look up what X item or unit is called.  It's a database and editor in one, so you don't have to work in your editor (Notepad) while consulting your database (probably another Notepad) with your other hand.

The editor could be further improved by including thumbnail images of the items, units, building types, and so on.

Reason for Karma (Optional)
Successfully updated karma reason!
July 22, 2010 1:29:01 AM from Elemental Forums Elemental Forums

2. It saves you from having to look up what X item or unit is called.  It's a database and editor in one, so you don't have to work in your editor (Notepad) while consulting your database (probably another Notepad) with your other hand.

 

This is one of the things that i'm trying to focus the most on. Untill Beta 4 goes live and i get a look at the finished structure of the game i wont know how much i can make an automatic lookup for, but being the lazy git i am i'll try to make things as effortless as possible.

 

The editor could be further improved by including thumbnail images of the items, units, building types, and so on.

 

Would something like this work?

http://img27.imageshack.us/i/equipmentbrowserwiththu.jpg/

 

edit:

Why not just download Visual Studio Express? It's free, and all the screenshots Frogboy posts with the XML files are from VS

Like i mentioned in the OP, this is intended for people who does not want to edit the xml files manually, either because they're not comfortable with it or because they're too lazy (like me) to run around looking up item-codes, color-values and background images manually. Once beta 4 arrives i'll be starting on a modding-project with a mate of mine where i suspect we'll be creating quite a lot of new units and this program was originally intended as a tool for serial-producing a large number of units quickly.

Reason for Karma (Optional)
Successfully updated karma reason!
July 22, 2010 2:13:49 AM from Elemental Forums Elemental Forums

Quoting Dioxus,


Would something like this work?

http://img27.imageshack.us/i/equipmentbrowserwiththu.jpg/

That's awesome.

Reason for Karma (Optional)
Successfully updated karma reason!
July 30, 2010 8:47:19 PM from Elemental Forums Elemental Forums

Updated OP with latest version and some general information.

Reason for Karma (Optional)
Successfully updated karma reason!
August 26, 2010 2:21:10 AM from Elemental Forums Elemental Forums

Dioxus are you still supporting this tool?

Reason for Karma (Optional)
Successfully updated karma reason!
August 26, 2010 7:51:51 AM from Elemental Forums Elemental Forums

I did a search on Ultra Edit and found a list of Open Source (which is free) alternatives: http://www.osalt.com/ultraedit.

Another tool to consider is Multi Edit (http://www.multiedit.com/). I used to use this editor back in my days of programming in Clipper, and I remember it supported many types of languages. I haven't done anything with XML, but for those looking for an editor, it's something to consider.

But as with SoonerToucan, I'm also wondering if the Unit Editor is still being supported?

Reason for Karma (Optional)
Successfully updated karma reason!
August 26, 2010 1:32:54 PM from Elemental Forums Elemental Forums

Grab Notepad++ if you want a robust text editor. Much the same as Ultra Edit (I actually find it a wee bit better) and it's freeware (released under GPL license)

 

As for reading XML files. In C# you'll ideally want to read it into an XDocument, which if memory serves me right can be done from an XmlReader. Gives you the ability to query for elements and attributes. Not only that, but it will give you the ability to validate the XML on load rather than crashing on malformed XML half way through.

 

For Java JDom or Dom4J are good alternatives. Been a lil while since I read XML from a file, but I seem to recall Document and DocumentBuilder being something you used with an InputStream

 

Reason for Karma (Optional)
Successfully updated karma reason!
August 27, 2010 10:09:25 AM from Elemental Forums Elemental Forums

Hmm...........

I have no idea how to get it to work......

lots of exception error....and its not load up any setting at all....

Reason for Karma (Optional)
Successfully updated karma reason!
November 9, 2010 6:08:07 PM from Elemental Forums Elemental Forums

Hey brother, this is not working. A lot of errors. I would like to use it.

Reason for Karma (Optional)
Successfully updated karma reason!
January 30, 2011 12:15:25 AM from Elemental Forums Elemental Forums

is this going to be updated ?

 

Reason for Karma (Optional)
Successfully updated karma reason!
January 30, 2011 1:01:19 AM from Elemental Forums Elemental Forums

Probably not. Dioxus seems to be long gone from this forum. His last login was before the retail release of elemental. I have been playing with the idea of creating a unit maker, though I currently have a lot of things I want to do first.

Reason for Karma (Optional)
Successfully updated karma reason!
January 30, 2011 1:03:49 AM from Elemental Forums Elemental Forums

Questions: Can I use this to make enemy units and creatures?

                Can I use it to make Armies of said units?

                How much of their information can I edit? 

Reason for Karma (Optional)
Successfully updated karma reason!
Stardock Forums v1.0.0.0    #101114  walnut1   Server Load Time: 00:00:00.0006468   Page Render Time: