General Modding Questions Thread (All Welcome)

Whilst i'm creating this for my own little pet project to ask dumb basic questions in, anyone who has a question and wants it answered should feel free to drop by, the lack of anything like this that i've been able to find, (maybe i'm blind :p), is a bit sad for everyone else who has questions.

 

 

Ok my first really basic question. is there any way to modify an existing entry in an XML file without overwriting the entire file? The readme talks about adding new stuff and Total Conversions fine, but my modified tech tree is going to need to add tech option entries to some existing improvements. Having to completely overwrite the existing improvements file is not ideal, and their may be other examples i need to edit.

 

Does anyone know is ComponentClasDefs.xml is working as far as adding and using entries. I know occasionally some files won't be enabled in some games and this strikes me as the type of file that's most likely to have issues.

80,457 views 118 replies
Reply #1 Top

No, the artform of proper patching died many years ago.  Its just a matter of shutting down, replacing the file, and restarting.  In the grand scheme of things, replacement is by far less complex.

 

I'm a bit biased as I spent my career in the telecommunications sector, where 99.999% and now 99.99999% uptime reliability was an industry mandate.  That very small amount of downtime was "reserved" for outages/crashes :)  But now with the architecture being fully distributed, even we dont properly patch anymore.  I dont know anyone who does anymore...

 

Just keep a copy of the original in a safe place, and have a good version control convention.

Reply #2 Top

Thanks it's just doing a complete file replacement for a tech tree mod is going to introduce all kinds of compatibility issues :(.

 

Another question, i've tried editing ComponentClasDefs.xml but adding a new class there produces an enumeration error. I think i've found the .xcd files that handle that but editing those seems to have no effect, anyone familiar with editing this sort of thing care to lead me through adding a new class to the relevant xml plus any other file entries i have to make for dependencies sake. 

Reply #3 Top

Quoting KarlBar99, reply 2

Another question, i've tried editing ComponentClasDefs.xml but adding a new class there produces an enumeration error. I think i've found the .xcd files that handle that but editing those seems to have no effect, anyone familiar with editing this sort of thing care to lead me through adding a new class to the relevant xml plus any other file entries i have to make for dependencies sake. 

 

Yeah, don't mess with the Schema - it's not moddable and there's apparently no plans to make it so. Changing it in the mod folder does nothing, and in the game folder just results in a horrible post-menu crash. 

 

I had the same issue when trying to add a strategic resource. I believe that the schema is basically saying that the only valid values that can be used for the uniqueid are the ones listed in Enums/ShipComponentTypes.xsd - itself another schema file, and thus un-editable. I know of no-one who's found a way round this (though I've only really searched in the case of adding resources), but if you do find a way then it'll probably unlock a lot of other potential changes.

Reply #4 Top

Well bugger.

Thats a bit of an issue as i'm setting the dread lords up to be fairly unique in their weaponry and defences. Specifically they don;t use separate modules for each type, they get universal modules that whilst less powerful in any one area, (meaning they suffer more against mixed defences wit weaponry, defences get a separate unique aspect that accounts for their weakness), are a lot more mass efficient for broad spectrum uses. In mean sure i could use an existing weapon and defence type but doing so is not exactly ideal for getting the game to use them intelligently.

Hmmm, need to think on this some more. See what else i can do.

 

Thanks for pitching in though.

Reply #5 Top

You can always use the EscortCarrierModule type, that's currently unused :P

Reply #6 Top

It might be worth seeing what happens if you re-activate the cloaking devices that are presently commented out, too - they might have component types that are usable in the same manner.

Reply #7 Top

Quoting naselus, reply 6

It might be worth seeing what happens if you re-activate the cloaking devices that are presently commented out, too - they might have component types that are usable in the same manner.

ooh yeah, I'd forgotten about those!

 

I suspect it will 'work' as a container, so long as you give it a handled PrimaryStat. I expect the cloak itself wasn't included because the AI couldn't handle it - perhaps there are even models for it in-game, though I haven't seen them. There also isn't currently a ship component which uses them - though it'd be interesting to add one :)

Reply #8 Top

From looking at the schema the cloaking module stuff was never implemented, i'll have to try the carrier module idea out later. Having a weird localisation fle issue. The inputted text doesn't appear to be getting used and i'm not sure why. Relevant sections of code. It's specifically the display name that's not showing up.

 

<Improvement>
<InternalName>DreadResearchChamber</InternalName>
<DisplayName>DreadResearchChamber_Name</DisplayName>
<ShortDescription>DreadResearchChamber_ShortDec</ShortDescription>
<Description>DreadResearchChamber_Dec</Description>
<Icon>ResearchChamber.png</Icon>
<BuildIcon>ResearchChamber_Build.png</BuildIcon>
<ListIcon>ResearchChamber_Icon.png</ListIcon>
<ImprovementType>Research</ImprovementType>
<SecondaryType>Military</SecondaryType>
<PlacementType>Research</PlacementType>

 

 

And

 

<StringTable>
<Label>DreadResearchChamber_Name</Label>
<String>Military Prototyping Facility</String>
</StringTable>

<StringTable>
<Label>DreadResearchChamber_ShortDec</Label>
<String>Improves Research and Military Manufacturing</String>
</StringTable>

<StringTable>
<Label>DreadResearchChamber_Dec</Label>
<String>The military prototyping centre is where all the technology our military machine needs is developed, from starship, to personal weaponry, to manufacturing centres to the Logistics buildings required to support them.</String>
</StringTable>

Reply #9 Top

Huh. Again, there's nothing wrong with this section of xml. Like, at all. Can you show us the entry immediately before it? There may be an error there which is preventing it reading the research chamber.

Reply #10 Top

Complete XML text file:

 

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<StringTableList
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../Schema/Lib/StringTable.xsd">

<StringTable>
<Label>DreadResearchChamber_Name</Label>
<String>Military Prototyping Facility</String>
</StringTable>

<!-- <StringTable>
<Label>DreadResearchChamber_ShortDec</Label>
<String>Improves Research and Military Manufacturing</String>
</StringTable>

<StringTable>
<Label>DreadResearchChamber_Dec</Label>
<String>The military prototyping centre is where all the technology our military machine needs is developed, from starship, to personal weaponry, to manufacturing centres to the Logistics buildings required to support them.</String>
</StringTable> -->

<StringTable>
<Label>DreadResearchStockade_Name</Label>
<String>Military Testing Range</String>
</StringTable>

<StringTable>
<Label>DreadResearchStockade_ShortDec</Label>
<String>Improves Research and Military Manufacturing</String>
</StringTable>

<StringTable>
<Label>DreadResearchStockade_Dec</Label>
<String>The addition of even more extensive testing ranges and facilities to our existing prototyping facilities allows for much improved testing regimes to be employed, allowing for the development of more complex items. Additional on-site manufacturing facilities support the production of the new more complex prototypes in a timely manner.</String>
</StringTable>

<StringTable>
<Label>DreadResearchMotivator_Name</Label>
<String>Large-Scale Military Prototyping Facility</String>
</StringTable>

<StringTable>
<Label>DreadResearchMotivator_ShortDec</Label>
<String>Improves Research and Military Manufacturing</String>
</StringTable>

<StringTable>
<Label>DreadResearchMotivator_Dec</Label>
<String>Provided with Manufacturing and Testing facilities on a scale never before seen these new large-scale facilities allow for previously impossible project concepts to be considered, prototyped, and tested.</String>
</StringTable>

<StringTable>
<Label>DreadResearchExtractor_Name</Label>
<String>Large-Scale Testing Ranges</String>
</StringTable>

<StringTable>
<Label>DreadResearchExtractor_ShortDec</Label>
<String>Improves Research and Military Manufacturing</String>
</StringTable>

<StringTable>
<Label>DreadResearchExtractor_Dec</Label>
<String>Our initial designs of large-scale prototyping facilities have been found to be a little deficit in testing range area. These new larger facilities correct this flaw allowing for even more efficient progress towards our goals.</String>
</StringTable>

<StringTable>
<Label>DreadResearchAmplifier_Name</Label>
<String>Rapid-Prototyping Facility</String>
</StringTable>

<StringTable>
<Label>DreadResearchAmplifier_ShortDec</Label>
<String>Improves Research and Military Manufacturing</String>
</StringTable>

<StringTable>
<Label>DreadResearchAmplifier_Dec</Label>
<String>Utilising the latest rapid construction techniques combined with what are virtually city sized accommodation and planning habitats and the largest testing facilities constructed so far these enormous facilities allow us to push towards our ultimate goal at the ultimate rate.</String>
</StringTable>

<StringTable>
<Label>DreadDarkPowerPlant_Name</Label>
<String>Dark Energy Powerplant</String>
</StringTable>

<StringTable>
<Label>DreadDarkPowerPlant_ShortDec</Label>
<String>Improves Military Manufacturing.</String>
</StringTable>

<StringTable>
<Label>DreadDarkPowerPlant_Dec</Label>
<String>Utilising a more primitive form of the dark matter power generation systems that powered our old empire these facilities greatly increase the power available to our worlds. Naturally the majority of their prestigious output is earmarked for use by our military forces and no one else.</String>
</StringTable>

<StringTable>
<Label>DreadPrecusorPowerplant_Name</Label>
<String>Dark Energy Powerplant</String>
</StringTable>

<StringTable>
<Label>DreadPrecusorPowerplant_ShortDec</Label>
<String>Improves Military Manufacturing.</String>
</StringTable>

<StringTable>
<Label>DreadPrecusorPowerplant_Dec</Label>
<String>At last we can now build dark matter based powerplants to our original superior design. We are once again the pre-eminent civilisation in the universe. Or we will be once we can figure out how to turn it on.</String>
</StringTable>

<StringTable>
<Label>DreadTerraformingPlant_Name</Label>
<String>Primitive Ultra-Terraformer</String>
</StringTable>

<StringTable>
<Label>DreadTerraformingPlant_ShortDec</Label>
<String>Terraform Multiple Good Tiles.</String>
</StringTable>

<StringTable>
<Label>DreadTerraformingPlant_Dec</Label>
<String>We long ago replaced the primitive terraformers used by the upstarts of the rest of the galaxy with much better system's, however our defeat and rebirth has left us without access to many of our former technologies. This adaptation of their technologies combined with certain technologies of our own that we are able to once again produce provides us with a less capable form of large scale terraforming system.</String>
</StringTable>

<StringTable>
<Label>DreadUltraTerraformingPlant_Name</Label>
<String>Total Terraformer</String>
</StringTable>

<StringTable>
<Label>DreadUltraTerraformingPlant_ShortDec</Label>
<String>Terraform Any Tile.</String>
</StringTable>

<StringTable>
<Label>DreadUltraTerraformingPlant_Dec</Label>
<String>With our Technology of old once again restored we can once again conduct the large scale terraforming projects of yesteryear.</String>
</StringTable>

</StringTableList>

 

Also here's a screenshot of the in game, notice how the name displays in the building list but not on mouseover...

 

 

And a fresh rar with the files in inn case you want that too.

 

http://www.filedropper.com/dreadlords2

Reply #11 Top

Again, not much looks wrong there - though the fact it's appearing correctly in the list but not on mouseover suggests the problem might be in the building definition itself, rather than the localization files. This again looks ok, though. Try rewriting in a new file; might be some weird unicode issue or something.

 

Reply #12 Top

This has been commented out. Remove the green symbols to make the code live again.

<!-- <StringTable>
<Label>DreadResearchChamber_ShortDec</Label>
<String>Improves Research and Military Manufacturing</String>
</StringTable>

<StringTable>
<Label>DreadResearchChamber_Dec</Label>
<String>The military prototyping centre is where all the technology our military machine needs is developed, from starship, to personal weaponry, to manufacturing centres to the Logistics buildings required to support them.</String>
</StringTable> -->

Reply #13 Top

That's not the bit which is broken, though - it's the one above the comment which is refusing to run properly.

Reply #14 Top

Oh! Ok, I will have deeper look at the files.

First thought is that maybe there are too many characters in <Something>BlahBlah_TooManyBlahBlah's</Something>

<InternalName> in other files certainly has a character limit. Maybe here too. And when there is nothing else it could be in the code, certainly a suspect. Maybe its 19 and not 20. Edit, No It depends.

 

Reply #15 Top

Yep! too many characters in the text <String>Military Prototyping Facility</String>

<StringTable>
<Label>DreadResearchChamber_Name</Label>
<String>Military Prototyping Facility</String>
</StringTable>

<StringTable>
<Label>DreadResearchChamber_ShortDec</Label>
<String>Improves Research and Military Manufacturing</String>
</StringTable>

<StringTable>
<Label>DreadResearchChamber_Dec</Label>
<String>The military prototyping centre is where all the technology our military machine needs is developed, from starship, to personal weaponry, to manufacturing centres to the Logistics buildings required to support them.</String>
</StringTable>

If you shorten this to something like <String>Military Prototyping</String> or something it should work.

28,29 or 30 characters, including spaces, depending on the characters, seems to be the limit for this string. To clarify why it may vary depending character type, its the total length of the string which matters. So if your string has lots of wide upper-case characters you won't be able to fit as many in as compared to a string with all skinny characters like lower case "i" & "l". 

Some of the other ImprovementDefText...... _Name strings will have to be shortened also.

Reply #16 Top

Ahh cheers, so far only two seem to be affected, the one noted and the T3 version of the research Lab, weird that that's affected when the other 3 aren't and they're much longer. probably a weird formulae or something for determining the limit.

 

Thanks for figuring it out.

Reply #17 Top

Hmmm, that implies the lengths of the strings are determined by the field they match in improvements.xml. That's bad - we'll need to test each string 'type' individually in order to determine max length (I'd hoped it was in the schema, but IIRC then in C you declare the max length of the string, so I'm guessing it's buried in hardcode).

Reply #18 Top

Yeah lots of damms being said here too Naselus. Here's a selection of the finalised strings that do work so everyone can do length comparisons with them.

 

<String>Military Prototyping Lab</String>
<String>Military Testing Range</String>
<String>Large-Scale Lab Facilities</String>
<String>Large-Scale Testing Ranges</String>
<String>Rapid-Prototyping Facility</String>
<String>Primitive Ultra-Terraformer</String>
<String>Total Terraformer</String>

Reply #19 Top

Quoting naselus, reply 17

Hmmm, that implies the lengths of the strings are determined by the field they match in improvements.xml. That's bad - we'll need to test each string 'type' individually in order to determine max length (I'd hoped it was in the schema, but IIRC then in C you declare the max length of the string, so I'm guessing it's buried in hardcode).

Yeh! the string length is not determined by the schema and as such I don't think anything to do with the xml. Likely the field widths are a pixel dimension determined by the UI programming. It may be possible to change the font for the fields thus allowing more text, but don't know for sure yet, as I haven't looked into it. If that is possible, likely it would be a global setting changing the font for everything in that field or field type.

Reply #20 Top

Okay i'm going to go open a thread for testing the version i've got working now. But i thought i'd show you a bit of text that produced a chuckle when i tracked the bug in it down.

 

<TechAge>
<Option>AgeOAfWar</Option>
</TechAge>

 

Reply #21 Top

Anyone got an idea how to get the AI to use a custom constructor module without using the total conversion methode?

 

Right now i got it working by getting changing the generic name of the "TechTree" Tech and

replacing the now missing improvements and components with exact copies (only differing InternalName),

but the StarbaseModules are problematic because of the way Mining works (Prerequ Module in StrategicResourceDefs).

So i just added "my" TechTree Tech as an option to the 4 BaseModules.

Reply #22 Top

Can you clarify. Is the AI simply not building ships equipped with the module, or is auto-generation not producing ships using the module?

 

 

Also a more mechanics based question i'm hoping someone can answer in case i ever want to play with such values, (i'm allready thinking about my next project as i have a god idea of 99% of the stuff i need/want to do with the existing one). First how does +Diplomacy transfer mechanically speaking into actual relations.

 

Second aside from the obvious +% tourism income and the very nebulous galaxy control aspect, (as in is it influence, galactic population, percentage of habitable planets controlled, e.t.c), how exactly is Tourism Income determined?

Reply #23 Top

The issue with names being too long like you encountered is entirely a UI issue.

Essentially in tooltips there is an absolute limit to the number of characters the field will accept.  Its not that its specifically limited anywhere but the tooltip window is fixed width, if you look closely in the screenshot you will see the bottom of the text peeping out.  What is happening is once text hits the limit of the fixed width of the tooltip window it tried to wrap the text to the next line, in fact if you make the string long enough you will see the end of the string start to appear in the window as it wraps down.

This is the case in a number of places I have encountered, some windows are dynamic and resize like the desc area of the tooltip window but even then most have an upper limit on how far they will extend.

Would be really nice if the dev's would expose not only the XSD's to modding but the UI files in the screens directory too when we could tweak as needed ourselves.

In regards to your question about diplomacy see the DiplomacyDefs.xml in it you will see a list of Behaviors and MinRelations, the MinRelations is directly effected by diplomacy bonuses, so for example if you have a diplomacy bonus of +2 and relations with a race of 5 then they will be willing to engage in any behavior with a MinRelations of 7 or less.  There does seem to be some +/- effect related to this figure too in regards to the negative actions they are willing to enact against you as well.

Reply #24 Top

Check the screenshot i posted, there's clearly underscores in the out of view text, that was never in the original text. I'm pretty sure there's something else going on there. But i have seen the rest of the behaviours you mention.

Also thanks for the diplomacy explanation, fills in why diplomacy is effectively non-functional. I assumed it just added/subtracted from their opinion of you in some way but if that's all it does and it's a scale of 1-10 when you can have a +3 building on every world, yeah. So non-functional.

 

Reply #25 Top

Quoting KarlBar99, reply 22

Can you clarify. Is the AI simply not building ships equipped with the module, or is auto-generation not producing ships using the module?

 

As Long as you have the Standard Constructor Module the AI will use this,

no matter how much better the custome one is.