New Utility project in the works... YAModXMLEditor!

Looking at the screen shots, I think it would be useful to add numbering for the items in each file, since this is the actual value used in Python in C++ code.
For example:
Where you have the list

Code:
TERRAIN_COAST
TERRAIN_DESERT
TERRAIN_GRASS
etc.

You'd have
Code:
0. TERRAIN_COAST
1. TERRAIN_DESERT
2. TERRAIN_GRASS

etc. (or any other string format you find appropriate)
 
Looking at the screen shots, I think it would be useful to add numbering for the items in each file, since this is the actual value used in Python in C++ code.
For example:
Where you have the list

Code:
TERRAIN_COAST
TERRAIN_DESERT
TERRAIN_GRASS
etc.

You'd have
Code:
0. TERRAIN_COAST
1. TERRAIN_DESERT
2. TERRAIN_GRASS

etc. (or any other string format you find appropriate)

Ok.. you will have to clarify something here. Do you mean c++ or python?

If you mean C++, Some files have hard coded enumerations in c++ but most don't (if I remember correctly... It has been a LOOOOONG time). If they did, then adding more in the XML would be pointless. Most c++ enumerations are accessed indirectly through the loaded xml. This would mean that they are numbered after the order they exist in the file.

I think python gives you access to the xml items indirectly because all python code is mapped through the c++ info loader so this means again, that the enumerations are based on the order in the file.

As far as numbering them in the order they exist in the file, that is a possibility but you will have to remind me if I don't get to it by the time this comes out.

However, my goal is to make the mod editor type specific. Basically this means that if the editor can tell from the schema (or from an alias file which I am providing with the editor) which type (info type) is represented by an xml tag, editing that tag will not give you an edit box. Instead, it will give you a drop down list of sorted matching info types to choose from. Actually... this feature is next on my todo list (after I have finished fixing the current thing I am working on). The "typecasting" ability is already there. I just need to add the functionality to mark tags in the loading xml with the specific types and then to load the type lists from the other relevant files into the dropdown lists to be used.

Not sure if that helps in your particular case... but we might be able to add enumerations at some point.
 
The infos are indeed numbered according to the order in the XML. What I mean is that when you debug code (either actual debugging in C++, or even logging in Python/C++) you have access to the number, not the 'UNIT_XXX' type string.
And then you're in a situation in which you ask yourself 'which unitclass is 137?'
 
I decided to post an update on what is currently happening with this project. I also have some screenshots for you.

The editor now successfully loads all but 3 files plus LSystem files for Vanilla and Warlords. I have not tested BtS yet since I do not yet have it on my computer. Once I have the editor capable of manipulating files and schemas I will add BtS.

I had particular trouble with text files... I had even forgotten about them since I set them aside as files that don't follow any XML schema. (It is not even possible to write a schema for them since they use the same tags names for different kinds of tags). But after working straight for a day and a half, I have them working.

It also loads some mods. It has trouble with mods that are scenario based. Not sure why at this point but I will look into it. For mods that do load (world based mods that do not focus on a specific scenario), it can load all files that I have checked so far.

Here is the mod menu from which you load mods.
attachment.php



A screenshot of the editor with the Genetic Era Mod loaded:

attachment.php

You may notice a few new things. First are the colors of some of the tags. This was functionality I had put in over a year ago but since it wouldn't load Warlords files correctly back then I didn't see it until a few weeks ago. Tags are colored after the edition that introduced them. Original tags are in black. Tags new to warlords are in brown and tags that are new to the Genetic Era (or any mod that is loaded) are in blue.

Second, the status bar at the bottom also color codes the file name based on the edition folder it is loaded from. Files that have updates are color coded after the color of the most recent update. (They follow the same coloring as the tags).

Comments are also colored green.

Finally... let me introduce a particular feature I wanted to include which I have referred to as "Type casting." Basically by following a defined set of rules, the editor recognizes tags that are supposed to be set to a particular info type. (I referred to this feature in one of my most recent posts). Those rules are defined in a text based "settings" file and can be edited both by the user hard-coding... and eventually by the editor itself (once I add the dialogs and menu's that let you set them up).

Tags that are recognized as being associated with an info type are in bold. Clicking on a bold tag will give you a combo box (drop down box) filled with values for the recognized info type as shown below:

attachment.php

Above we have selected to edit a recognized tech node.


attachment.php

Here we have our dropdown list of tech infos.


attachment.php

And our resulting edit change! You may notice the StateReligion is not bolded. Right now only global recognition seems to be working. Rules for specific files don't work yet. I have noticed that this is used in more than one file however so making it recognized in all files will be simple. I will simply move the rule to the global section

Here we are editing a recognized religion node in the BuildingInfo's file:
attachment.php


After removing a recent bug that makes unloading mods cause a crash, Next on the agenda is to be able to save files that have been altered. This functionality shouldn't be too hard to add.

After that I will be finally working on editing functionality beyond simply changing values. Next after saving will be copying infos and creating new ones. That will probably be followed by adding new tag types to the schema!
 

Attachments

  • Religion-building.jpg
    Religion-building.jpg
    139.4 KB · Views: 132
  • ModMenu.jpg
    ModMenu.jpg
    71.1 KB · Views: 164
  • ColorCoded.jpg
    ColorCoded.jpg
    376.1 KB · Views: 119
  • InfoTypeEdit.jpg
    InfoTypeEdit.jpg
    40.8 KB · Views: 128
  • InfoTypeEditControl.jpg
    InfoTypeEditControl.jpg
    144 KB · Views: 179
  • AfterEdit.jpg
    AfterEdit.jpg
    38.6 KB · Views: 139
This is looking very, very good! :king:
 
Saving now works perfectly. I used a file comparing tool to check for differences on both unmodified and modified files.

New mods can be created and files you edit are backed up to a backup directory in case you make your mod "unopenable" or something drastic with your changes ;-).

I successfully made the first "modification" to the Genetic Era mod today. (Something rather simple... but I wanted to make the change for my current game because I personally don't think monasteries/missionaries should go obsolete with Scientific Method. (There are plenty of missionaries still out there in the world lol... any come knocking on your door lately? And even those that don't still give out tracts, literature, and write books).

Would people rather the editor work in BtS before I make an alpha version available for download? It might be easy, or it might be difficult. Depending on how well the BtS files follow the schema structure in the previous versions.

I still have a few other things to do before I post one but... I was just curious what people thought.
 
Would anybody be interested in a non-BtS version? :confused:
 
I agree a BTS version would be better ... most of the main mods have moved to BTS or a continued to be developed in BTS.
 
Alright. Will do.
 
I agree a BTS version would be better ... most of the main mods have moved to BTS or a continued to be developed in BTS.

yeah, but many mods use a different XML system anyway (known as WoC modular)

Anyway, looking forward to this. Let us know if you need some help. I was very happy to see that this project isn't dead :)
 
By the way... I need a quick favor if any of you have the "Complete" version. See this thread.
 
I remember people speaking of modular loading. I will have to look into the way its done to see if it will work with the system I have developed.
 
I am happy to announce that BtS is now loading. All files load except the ones that don't load for the previous editions. And just for kicks... I tried loading the Rhye's and Fall of Civ that shipped with BtS. It worked.

I tried a few more. Again... some mods load and some mods don't. I will have to look into why.

Here is a screenshot of the UnitInfos file for the BtS NextWar mod.
attachment.php
 

Attachments

  • bts-modload.png
    bts-modload.png
    106.2 KB · Views: 114
I am sure my mods will load. ;)

Btw, I don't know if it is possible, but a cool feature would be to create a new xml block so you could just edit it if adding a new unit, building, etc. That is something Civ4xml lacks.
 
Yeah... that will be a basic feature. Should be fairly easy to do as well. That is up next right behind figuring out why some mods don't load. I find it strange that Civ4Xml doesn't do that because from what I read it said or at least implied that it could.
 
Making some more progress! ALL SHIPPED MODS LOAD (at least the UnitInfos File) EXCEPT ONE... and I find this humorously ironic:

The only mod that does not load is the "DefaultValues" mod for warlords that seems meant to give you a single unit UNIT_LION as an example of default values. The reason it doesn't load is because Firaxis enclosed a <UnitCombatCollateralImmunes> tag within a <UnitCombatCollateralImmunes> tag... the enclosed one should NOT have the s on the end. It should be singular.

I'll tell you what... this editor will find any XML errors you have lol. It is very picky. Now I just have to get it to give you the option of fixing the file rather than throwing an exception (crashing and presenting you an error). (Most of the time it does throw an error now, it is an error I invented for files that do not follow the schema.).

Please note: When I say that all mods load... I am referring to their schema files, all of their info files (but only up to the singular info tags to retrieve the names of the tags for "type casting") and the full "CIV4UnitInfos.xml" file. I am NOT GOING to test all full files for all mods. I will test a few random ones but that would take an IMMENSE amount of time. This is what beta testing will help do... iron out little detailed bugs.
 
All of this sounds awesome. :goodjob:
 
Back
Top Bottom