"Unprecedented Modding Tools"

In the Civ4 AI, units explore a certain multiple of their speed to find a target.

The faster they move, the larger the area they have to search to find targets they could attack in a round or two.
...

Yakk, Thank you for the detailed explanation.
I really appreciate your taking the time to explain all that.

I was fixated on using the algorithm to find the fastest route between two known points. Using the same algorithm to find potential destinations is certainly a different use case than I was considering and I can see how that requires additional inputs and would significantly increase the effort involved.

Thanks again.
 
To be honest, I doubt we're going to see any awesomely efficient path-finding algorithms in Civ5, if only because they appear to be putting strong limits on the number of units you can have so it's a much smaller issue. That doesn't make it any more pleasant for all those modders who already desire to undo the 1-unit-per-tile rule. (Has that actually been confirmed yet? Some posters seem to be speaking like it has been confirmed)
 
Hypothetically speaking, let us say a Civ4 editor is being developed, say for units. Assuming, as Dale has suggested, the schemas are being used so that the UI widgets can be dynamically generated, how should those schemas and their xml files be parsed?

Could/Should the Civ4 dll be hijacked and modified to remove/ignore the actual game code so that its parsing code can be reused, or would their be some third-party library that could be used to do all the work?

This is a topic that has piqued my interest as my preferred field is GUI development and if the xml parsing with schemas is possible (ie without hand writing a parser) my interest might become more then just piqued. :)
 
Hypothetically speaking, let us say a Civ4 editor is being developed, say for units. Assuming, as Dale has suggested, the schemas are being used so that the UI widgets can be dynamically generated, how should those schemas and their xml files be parsed?

Could/Should the Civ4 dll be hijacked and modified to remove/ignore the actual game code so that its parsing code can be reused, or would their be some third-party library that could be used to do all the work?

This is a topic that has piqued my interest as my preferred field is GUI development and if the xml parsing with schemas is possible (ie without hand writing a parser) my interest might become more then just piqued. :)

There are quite a few third party libraries for parsing XML.
 
A tool for creating leader art would be good. If they check out the avatar editor in Cities XL, that is a great example. It allows you to alter size and shape of several facial features, and allows modification of skin/hair colour, haircut, clothing, build and accessories (glasses, moustache etc). YOu can make almost anyone without being an artist.
 
The ability to import art and civ/lh modules from Civ III or Civ IV would be great too. Gaps in XML properties could be solved by using inbuilt defaults for missing values. Some default art files (eg a default unit or leaderhead that appears only when there is missing art) would be good for preventing crashes to desktop when modding.
 
Gaps in XML properties could be solved by using inbuilt defaults for missing values.
Yes. Actually, most xml elements don't even need to be there as they are always empty. Making these optional would go a great length in order to simplify modders' work.
 
If you use a DOM parser for the XML, it will give you a tree of elements and attributes that is much easier to walk generically. Do not try to use the SDK code as it's so brittle and not at all generic. Depending on the language you'll use, I would bet you can even find a library to parse a schema (or massage a DOM) into a schema-specific data structure.
 
Making these optional would go a great length in order to simplify modders' work.

I don't think that's true. It would seem to be easier at first, because there won't be a zillion tags with the default values making the file intimidating, but it would actually be harder for all but the simplest things. For example, let's say you want to allow a unit to explore enemy territory that couldn't before. Just add the tag, right? WRONG. The tag has to go in the right place (if the tags aren't in the right order, you will break your mod). How do you find the right place? If you're lucky, there will be an element that does use that tag that will have the tags that the element you're modifying which are above and below the tag you're adding. If not, you'll need to look at the schema file to find out where it goes, which is more intimidating than having the default values there to begin with.
 
I don't think that's true. It would seem to be easier at first, because there won't be a zillion tags with the default values making the file intimidating, but it would actually be harder for all but the simplest things. For example, let's say you want to allow a unit to explore enemy territory that couldn't before. Just add the tag, right? WRONG. The tag has to go in the right place (if the tags aren't in the right order, you will break your mod). How do you find the right place? If you're lucky, there will be an element that does use that tag that will have the tags that the element you're modifying which are above and below the tag you're adding. If not, you'll need to look at the schema file to find out where it goes, which is more intimidating than having the default values there to begin with.
No. There's no necessary order in the tags. If they build a DOM tree, it really doesn't matter. If they use SAX, order may matter, but only if they do it wrong. In general, if elements need an order, they must be nested. If elements at the same level of the xml need to be ordered, then there's probably a flaw in the design of the xml format.
Ordered elements may make sense for some documents, but for game data, I can't see why one would want something that complicated. considering itt's easier not to bother about the order of elements, I can't see why they'd do it.
 
Hopefully they'll write their parsing code so it doesn't depend on the order of elements. There's simply no reason to require this other than to allow writing brittle parsing code. It's easy enough to read the entire document into a DOM object and walk the tree searching for elements or use a SAX parser for maximum modder hostility. :)

Either way would allow them to remove all the empty XML elements without making life harder for modders. A modder would be able to add a missing tag anywhere in the parent element.
 
If you use a DOM parser for the XML, it will give you a tree of elements and attributes that is much easier to walk generically. Do not try to use the SDK code as it's so brittle and not at all generic. Depending on the language you'll use, I would bet you can even find a library to parse a schema (or massage a DOM) into a schema-specific data structure.

The language will be C++ and I agree that DOM would be more appropriate then SAX. I've done some work with non-schema xml files using TinyXML library which is DOM, so I know that would work. Could load up two DOM objects, one with the schema and the other of the xml file and then use one to validate the elements in the other. However, that seems like a lot of grunt work to do by hand.

At the moment, I am doing some research towards the idea of using an xml data binding code generator to create the initial classes based off the schema files, but that still has the drawback of the xml elements being hard-coded at compile time, or at least that is how it seemed from what I read.

I am looking for a library that handles a schema as a natural part of parsing an xml file, but the best googling skills don't help when your searching for broad words like xml, schema, parser, etc. I am going to keep looking as this is something I need to handle regardless of the Civ editor issue, but maybe I'll get lucky and some one will know of a good library that can handle the task.
 
This is getting deep, and you may want to start a new thread specifically about it. In the meantime I would suggest loading the data into your own tree structure (or leave it in the DOM depending on how nice the API is). There's no reason to parse it into a field-level data structure since this is just for editing values and saving back to XML.

You'd use the schema to generate the UI components and the data XML for the values. I can't help with tool selection as I haven't had to do XML in C++ before. God help anyone who has to. Oh, er, I guess that's you. :mischief:
 
Hehe, yea, I was also thinking this would need its own thread (in the Civ4 forum maybe ;)), but I'm going to do a little experimenting with ways to design the UI and layout a base plan so specific issues can be addressed before I start the thread.

I'm not going to promise that I'll code this, but I love making tools and creating them to access xml data is very high on my list of priorities. And hey, even failing is a success if you learn something from it. :)
 
Back
Top Bottom