XML Append mode, how does it work?

More specifically, what information in the 'appended' XML is used by the game engine to associate it to the core XML. 

11,327 views 7 replies
Reply #1 Top

Go read the modding tutorials, then come back and ask specific questions.

Reply #2 Top

The tutorials don't answer my question.

It just tells you how to make it happen not why it happens.

I am trying to emulate the way the engine recognises which unique file belongs to which internal file, so my tech tree viewer can handle appended files.

Reply #3 Top

<?xml version="1.0" encoding="utf-8"?>
<ColorList
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../Schema/Lib/ColorDefs.xsd"> <---- This tells the game what table the code goes in.

<-- Code inbetween tells the game what to put in said table -->
  <Color> <--- The sub table
    <InternalName>BlueBlue</InternalName>
    <Red>0</Red>
    <Green>0</Green>
    <Blue>255</Blue>
  </Color> <--- End sub table

</ColorList> <---- This ends the table

Reply #4 Top

Thanks Horemvore.

 

Looks like I will have to re-code my xml parser.

 

Reply #5 Top
Quoting treborblue, reply 2

The tutorials don't answer my question.

It just tells you how to make it happen not why it happens.

I am trying to emulate the way the engine recognises which unique file belongs to which internal file, so my tech tree viewer can handle appended files.

End of treborblue's quote

since your talking about the tech tree specifically, here are the important bits.  I used color coding to link items 

 

YorTechDefs.xml

Code
  1. &lt;Tech&gt;
  2. &lt;InternalName&gt;YorCollectiveManufacturingTech&lt;/InternalName&gt;
  3. &lt;GenericName&gt;CollectiveManufacturingTech&lt;/GenericName&gt;
  4. &lt;DisplayName&gt;<span style="color: #ff6600;">YorCollectiveManufacturingTech_Name</span>&lt;/DisplayName&gt;
  5. &lt;TechTree&gt;Yor_Tree&lt;/TechTree&gt;
  6. &lt;ShortDescription&gt;<span style="color: #ffff00;">YorCollectiveManufacturingTech_ShortDec</span>&lt;/ShortDescription&gt;
  7. &lt;Description&gt;<span style="color: #33cccc;">YorCollectiveManufacturingTech_Dec</span>&lt;/Description&gt;
  8. &lt;ColorDef&gt;TechYellow&lt;/ColorDef&gt;
  9. &lt;Icon&gt;GC3_Production_Tech_Icon.png&lt;/Icon&gt;
  10. &lt;Bink&gt;GC3_lndustrail_Temp.bk2&lt;/Bink&gt;
  11. &lt;ResearchCost&gt;29&lt;/ResearchCost&gt;
  12. &lt;TechPoints&gt;1&lt;/TechPoints&gt;
  13. &lt;AICategoryWeight&gt;
  14. &lt;Military&gt;16&lt;/Military&gt;
  15. &lt;Growth&gt;22&lt;/Growth&gt;
  16. &lt;Tech&gt;20&lt;/Tech&gt;
  17. &lt;Diplomacy&gt;8&lt;/Diplomacy&gt;
  18. &lt;Expansion&gt;14&lt;/Expansion&gt;
  19. &lt;Wealth&gt;12&lt;/Wealth&gt;
  20. &lt;Influence&gt;10&lt;/Influence&gt;
  21. &lt;Fortification&gt;18&lt;/Fortification&gt;
  22. &lt;/AICategoryWeight&gt;
  23. &lt;Prerequ&gt;
  24. &lt;Techs&gt;
  25. &lt;Option&gt;PropagationTech&lt;/Option&gt;
  26. &lt;/Techs&gt;
  27. &lt;TechAge&gt;
  28. &lt;Option&gt;AgeOfExpansion&lt;/Option&gt;
  29. &lt;/TechAge&gt;
  30. &lt;/Prerequ&gt;
  31. &lt;/Tech&gt;

YorTechDefsText.xml 

Code
  1. &lt;StringTable&gt;
  2. &lt;Label&gt;Y<span style="color: #ff6600;">orCollectiveManufacturingTech_Name</span>&lt;/Label&gt;
  3. &lt;String&gt;Collective Manufacturing&lt;/String&gt;
  4. &lt;/StringTable&gt;
  5. &lt;StringTable&gt;
  6. &lt;Label&gt;<span style="color: #ffff00;">YorCollectiveManufacturingTech_ShortDec</span>&lt;/Label&gt;
  7. &lt;String&gt;Allows construction of improved colony buildings.&lt;/String&gt;
  8. &lt;/StringTable&gt;
  9. &lt;StringTable&gt;
  10. &lt;Label&gt;<span style="color: #33cccc;">YorCollectiveManufacturingTech_Dec</span>&lt;/Label&gt;
  11. &lt;String&gt;Bringing order to new worlds is a challenge, as they are often plagued by existing biological detritus. This filth must first be destroyed, but it often tries to run away. It is frustrating to see it return to formerly pristine locations while construction is still undereway.&lt;/String&gt;
  12. &lt;/StringTable&gt;

 

 

with tech trees, it's really flexible on naming of the files in my experience.  I'd suggest taking the easy route and make the user save the individual file components (techdefs, techdefstext, & umm.. the specialization one).  I've done a lot with tech trees in gc2/gc3 & almost always work mostly from one portion at a time even though I'll usually wind up opening more that one of the three files at a time when editing stuff. You could do the same for opening the files y making people open them one at a time.

 

There are good reasons to have the old and the new techdefstext open at the same time.  for example:

  • Joe is working on a mod that makes a new branch to the existing tech trees
  • if he can open newbranchtechdefstext.xml and the original, he could have a generic neebranchtext that he fluffs for each race alongside the original by loading both and making any adjustments to the original as needed before saving it.  
      • that's not all that different from something I'm working on right now where I'm taking one race and giving it a schism into two different themantically fluffed races to reflect the schism.  I'm almost positive that I've had race1.techdefs.xml & race2.techdefs.xml pulling from ..\text\racetechdefs.xml before I did the second fluff without issues and copied/renamed it. since it went from a scope of just reworking an existing race to a scope of making two new ones during/after the first fluff.
  • <TechTree>Yor_Tree</TechTree> I'm  not 100% positive, but I think an orphan tech in a new file with this would append itself into the yor tree, but never tried that sort of thing
Reply #6 Top

 

Thanks, you have given me a lot to go on.

Quoting Tetrasodium, reply 5

I'd suggest taking the easy route and make the user save the individual file components (techdefs, techdefstext, & umm.. the specialization one).
End of Tetrasodium's quote

 

I do this when asking the user to save a cloned tree, I automatically clone the other 2 connected files and rename them according the core file naming convention.

It all falls apart when trying to view trees that have the append method changes. i.e. Enhanced terraforming mod.

 

 

Reply #7 Top

Quoting treborblue, reply 6

 

Thanks, you have given me a lot to go on.


Quoting Tetrasodium,

I'd suggest taking the easy route and make the user save the individual file components (techdefs, techdefstext, & umm.. the specialization one).



 

I do this when asking the user to save a cloned tree, I automatically clone the other 2 connected files and rename them according the core file naming convention.

It all falls apart when trying to view trees that have the append method changes. i.e. Enhanced terraforming mod.

 

 

End of treborblue's quote
the genericname is what is used to allow factuionA to for trade $Ytech from factionb's wildly different equivalent while getting factionA's instead of factionB's