Modding Tool [1.1.0 Released!]
RE: Modding Tool
Well done. I love modding tools like this, reminds me of the Civ 2 editor that made things an easy breeze for a 10 year old me to make whatever I wanted.
"The imaginary number is a fine and wonderful resource of the human spirit, almost an amphibian between being and not being." - Gottfried Leibniz
RE: Modding Tool
Thank you very much for this tool, Sebranan! I'll be checking it out, for sure 
Yeah, these forums aren't as lively as they used to be. You could also post a link to your mod to the Distant Worlds Reddit. There are discussions there, too
Yeah, these forums aren't as lively as they used to be. You could also post a link to your mod to the Distant Worlds Reddit. There are discussions there, too
RE: Modding Tool
Yeah that's a good idea salemonz, I'll make a post there. Might also stick one in the Steam forum for the game too, can't hurt.
RE: Modding Tool
I just saw your post on Reddit. Hope you get some more downloads!
RE: Modding Tool
I found a bug with the resource inputs. It wont let you add additional resource locations after the first one is filled out. It happened on resource 9 and 25 for me
RE: Modding Tool
darkriot, is this with 1.0.0.3? I pushed a minor fix related to this with revision 3 and I'm not sure if you posted before or after I did that.
RE: Modding Tool
yes. I even uninstalled and reinstalled to make sure. I get an unhandled exception for value 5.
RE: Modding Tool
When you reinstalled, did the tool update to 1.0.0.3? The version number is on the bottom left of the main menu under the "about" section.
I ask because I can't seem to reproduce the issue, for me, as soon as you select the "Location Type" in one column the fields in the next column are enabled. You do have to work left to right, it won't let you write values more than one column ahead of whichever one has the "Clear" button enabled, but that's by design so you don't have blank location values getting outputted.
I ask because I can't seem to reproduce the issue, for me, as soon as you select the "Location Type" in one column the fields in the next column are enabled. You do have to work left to right, it won't let you write values more than one column ahead of whichever one has the "Clear" button enabled, but that's by design so you don't have blank location values getting outputted.
RE: Modding Tool
It is the latest version. I found the problem tho. Apparently I left 2 values blank when I outputted and it wouldn't recognise the blanks when I reloaded the mod
RE: Modding Tool
Ah yes that would probably do it. Usually when it crashes I find it's because of some invalid (or null) value being loaded in, but of course it's somewhat impractical to have code everywhere to test each value before it loads.
I'm actually working on a data validation routine to run when you load a mod to catch this sort of thing before you actually load the forms. I don't know how fast it will run (since eventually it will have to check every single value in the mod) but VB is surprisingly quick at looping through large arrays so if it's efficient enough I may enable it by default.
So right now I've just got the research file's project lines being done, and it shows up on the input log like this (this is testing with the WH40K mod):
Beginning data validation on Research
Invalid special function code value "190" found in Research record 553, value changed to "0"
Invalid special function code value "190" found in Research record 623, value changed to "0"
Invalid special function code value "190" found in Research record 676, value changed to "0"
Data validation on Research complete, found and corrected 3 values
If this wasn't corrected, it would cause a crash when loading those research projects into the research form since it's trying to set the special function code drop-down box to an index that doesn't exist. DW itself has also been known to have a hissy fit due to this sort of thing so I think this will not only reduce crashes with the tool but it should also be brilliant for just testing mods to make sure you haven't forgotten values or made a typo.
I'm actually working on a data validation routine to run when you load a mod to catch this sort of thing before you actually load the forms. I don't know how fast it will run (since eventually it will have to check every single value in the mod) but VB is surprisingly quick at looping through large arrays so if it's efficient enough I may enable it by default.
So right now I've just got the research file's project lines being done, and it shows up on the input log like this (this is testing with the WH40K mod):
Beginning data validation on Research
Invalid special function code value "190" found in Research record 553, value changed to "0"
Invalid special function code value "190" found in Research record 623, value changed to "0"
Invalid special function code value "190" found in Research record 676, value changed to "0"
Data validation on Research complete, found and corrected 3 values
If this wasn't corrected, it would cause a crash when loading those research projects into the research form since it's trying to set the special function code drop-down box to an index that doesn't exist. DW itself has also been known to have a hissy fit due to this sort of thing so I think this will not only reduce crashes with the tool but it should also be brilliant for just testing mods to make sure you haven't forgotten values or made a typo.
RE: Modding Tool
This is me dding my voice to the cacophony of awe, praise and thanks for this, Sabranan!!![X(][&o][8D]
RE: Modding Tool
Would be really helpful in converting all the old mods into usable versions too...
RE: Modding Tool
So in preparation for the next feature release (1.1.0.0) I figured I’d show off some of what’ll be coming in the next partial feature release (1.0.1.0). This revision (number 4) contains my latest work on the on-load data validator. It now checks the research file with the exception of the ability lines and the component improvement lines (they’re a fair bit more complex because the valid values change depending on the ability/component type).
As an example of what this can do for you, I’ve manually introduced some errors into the default games first project “Wave Weapons”. It looks like this:
PROJECT ;0, Wave Weapons, X, -5, 10, armour, I'm Special, 10000000000.0,
COMPONENTS ;129, , 4
FIGHTERS;48
FACILITY; 4
PLAGUE CHANGE; -1, Random Plague, 200000000, -10x00, Duration, -200000000, 50%, 2 Hours
ALLOWED RACES; happyonish
PARENTS ;N
As you might imagine, DW would freak if you tried to load a research.txt file containing the above into it and so would my tool when you tried to open the project in the research form. It can’t allocate words to a number field or set a drop-down box to a negative value or something beyond its range. It also doesn’t always deal well with missing values like the blank component or the orphaned “N” in the parents line.
Until now.
Now it pre-emptively finds those invalid values and sets them to something that is valid. Usually this is just a default value so you’ll probably see a lot of 0’s in the log.
But it can also fix issues like the blank components value, it’ll remove that value entirely and move the third one up a level. So “COMPONENTS ;129, , 4” becomes “COMPONENTS ;129, 4” (or actually it becomes “COMPONENTS ;0, 4” since 129 isn’t a valid component).
Another useful thing it can do is try to figure out which genuine race name is closest to what you’ve typed in and sets it to that. So “happyonish” gets changed to “Haakonish” rather than just getting dropped. Very handy for when you make a simple capitalisation error or you’ve missed a letter.
This is the actual contents of the input log when loading in the above project:
Beginning data validation on Research
Invalid tech level value "X" found in Research record 0) Wave Weapons, value changed to "0"
Invalid row value "-5" found in Research record 0) Wave Weapons, value changed to "1"
Invalid industry value "10" found in Research record 0) Wave Weapons, value changed to "0"
Invalid category value "armour" found in Research record 0) Wave Weapons, value changed to "0"
Invalid special function code value "I'm Special" found in Research record 0) Wave Weapons, value changed to "0"
Invalid base cost multiplier override value "10000000000.0" found in Research record 0) Wave Weapons, value changed to "0"
Invalid enable component 0 value "129" found in Research record 0) Wave Weapons, value changed to "0"
Invalid enable fighter 0 value "48" found in Research record 0) Wave Weapons, value changed to "0"
Invalid plague change index value " -1" found in Research record 0) Wave Weapons, value changed to "0"
Invalid plague change mortality rate value "200000000" found in Research record 0) Wave Weapons, value changed to "0.001"
Invalid plague change infection chance value "-10x00" found in Research record 0) Wave Weapons, value changed to "0"
Invalid plague change duration value "Duration" found in Research record 0) Wave Weapons, value changed to "1"
Invalid plague change exception mortality rate value "-200000000" found in Research record 0) Wave Weapons, value changed to "0.001"
Invalid plague change exception infection chance value "50%" found in Research record 0) Wave Weapons, value changed to "0"
Invalid plague change exception duration value "2 Hours" found in Research record 0) Wave Weapons, value changed to "1"
Invalid race (allowed races) value "happyonish" found in Research record 0) Wave Weapons, value set to "Haakonish"
Invalid project parent 0 value "N" found in Research record 0) Wave Weapons, value changed to "0"
Invalid project parent 0's obligatory flag value "" found in Research record 0) Wave Weapons, value changed to "N"
Data validation on Research complete, found and corrected 18 values
As it turns out, this runs really well so I've set this to run by default for the time being. If you do find it's causing you issues there's a new checkbox on the main menu to disable it.
Minor warning, my free digital certificate has expired so I've published this as unsigned to avoid forcing users to reinstall which happens when you sign it with a new certificate. It'll say "Unable to verify publisher" or something similar and ask if you still want to install. It seems redundant to sign an application that's just not used enough to gain trust status from Microsoft and naturally I'm unwilling to pay for a permanent certificate when I'm doing this for free.
As an example of what this can do for you, I’ve manually introduced some errors into the default games first project “Wave Weapons”. It looks like this:
PROJECT ;0, Wave Weapons, X, -5, 10, armour, I'm Special, 10000000000.0,
COMPONENTS ;129, , 4
FIGHTERS;48
FACILITY; 4
PLAGUE CHANGE; -1, Random Plague, 200000000, -10x00, Duration, -200000000, 50%, 2 Hours
ALLOWED RACES; happyonish
PARENTS ;N
As you might imagine, DW would freak if you tried to load a research.txt file containing the above into it and so would my tool when you tried to open the project in the research form. It can’t allocate words to a number field or set a drop-down box to a negative value or something beyond its range. It also doesn’t always deal well with missing values like the blank component or the orphaned “N” in the parents line.
Until now.
Now it pre-emptively finds those invalid values and sets them to something that is valid. Usually this is just a default value so you’ll probably see a lot of 0’s in the log.
But it can also fix issues like the blank components value, it’ll remove that value entirely and move the third one up a level. So “COMPONENTS ;129, , 4” becomes “COMPONENTS ;129, 4” (or actually it becomes “COMPONENTS ;0, 4” since 129 isn’t a valid component).
Another useful thing it can do is try to figure out which genuine race name is closest to what you’ve typed in and sets it to that. So “happyonish” gets changed to “Haakonish” rather than just getting dropped. Very handy for when you make a simple capitalisation error or you’ve missed a letter.
This is the actual contents of the input log when loading in the above project:
Beginning data validation on Research
Invalid tech level value "X" found in Research record 0) Wave Weapons, value changed to "0"
Invalid row value "-5" found in Research record 0) Wave Weapons, value changed to "1"
Invalid industry value "10" found in Research record 0) Wave Weapons, value changed to "0"
Invalid category value "armour" found in Research record 0) Wave Weapons, value changed to "0"
Invalid special function code value "I'm Special" found in Research record 0) Wave Weapons, value changed to "0"
Invalid base cost multiplier override value "10000000000.0" found in Research record 0) Wave Weapons, value changed to "0"
Invalid enable component 0 value "129" found in Research record 0) Wave Weapons, value changed to "0"
Invalid enable fighter 0 value "48" found in Research record 0) Wave Weapons, value changed to "0"
Invalid plague change index value " -1" found in Research record 0) Wave Weapons, value changed to "0"
Invalid plague change mortality rate value "200000000" found in Research record 0) Wave Weapons, value changed to "0.001"
Invalid plague change infection chance value "-10x00" found in Research record 0) Wave Weapons, value changed to "0"
Invalid plague change duration value "Duration" found in Research record 0) Wave Weapons, value changed to "1"
Invalid plague change exception mortality rate value "-200000000" found in Research record 0) Wave Weapons, value changed to "0.001"
Invalid plague change exception infection chance value "50%" found in Research record 0) Wave Weapons, value changed to "0"
Invalid plague change exception duration value "2 Hours" found in Research record 0) Wave Weapons, value changed to "1"
Invalid race (allowed races) value "happyonish" found in Research record 0) Wave Weapons, value set to "Haakonish"
Invalid project parent 0 value "N" found in Research record 0) Wave Weapons, value changed to "0"
Invalid project parent 0's obligatory flag value "" found in Research record 0) Wave Weapons, value changed to "N"
Data validation on Research complete, found and corrected 18 values
As it turns out, this runs really well so I've set this to run by default for the time being. If you do find it's causing you issues there's a new checkbox on the main menu to disable it.
Minor warning, my free digital certificate has expired so I've published this as unsigned to avoid forcing users to reinstall which happens when you sign it with a new certificate. It'll say "Unable to verify publisher" or something similar and ask if you still want to install. It seems redundant to sign an application that's just not used enough to gain trust status from Microsoft and naturally I'm unwilling to pay for a permanent certificate when I'm doing this for free.
RE: Modding Tool
1.0.1.0 is up, a partial feature release that includes data validation on all of the research.txt file.
Next up will be 1.0.2.0, which will have the components.txt file done. I’m hoping this is going to be considerably easier now that I’ve sorted out the data validation rules for the component values already, that part took up about 90% of the time for the research.txt file.
Enjoy!
Next up will be 1.0.2.0, which will have the components.txt file done. I’m hoping this is going to be considerably easier now that I’ve sorted out the data validation rules for the component values already, that part took up about 90% of the time for the research.txt file.
Enjoy!
RE: Modding Tool
So my understanding is this will allow us to load in an already modified components file, and have it check for errors based on the current DW:U formatting, correct? Meaning it should be relatively easy to resurrect all the old DW:Shadows mods into being playable for Universe once you finish the other parts?
RE: Modding Tool
I only started playing DW after the release of Universe so I'll have to ask, did Shadows even have a components file? I've tried downloading a few Shadows mods but none of them had it, and I can't find reference to it in the modding guide for Shadows.
But basically yeah, it'll check for any invalid values and show them in the input log, so you'll be able to correct them in the tool (assuming it's not possible to just guess the correct value like it does with the "ALLOWED RACES" line). It'll set those variables that it corrects to a standard default value so it at least won't cause a crash if you try to load it (either in DW or my tool).
But basically yeah, it'll check for any invalid values and show them in the input log, so you'll be able to correct them in the tool (assuming it's not possible to just guess the correct value like it does with the "ALLOWED RACES" line). It'll set those variables that it corrects to a standard default value so it at least won't cause a crash if you try to load it (either in DW or my tool).
RE: Modding Tool
Ahhhh, I honestly don't know, I thought the old BSG mod did at least, perhaps not. Regardless, this will take outdated/buggy mods and make them usable again. Maybe someone more knowledgeable than me could compile them all? [:D]
RE: Modding Tool
My understanding is that the components.txt file was introduced in Universe as a new file...... mods created for Shadows would need to go through the process of being converted over to Shadows.
The Battlestar Galactica mods prior to Universe were for Return of the Shakturi and Legends but I do not think there was a version for Shadows.
The Battlestar Galactica mods prior to Universe were for Return of the Shakturi and Legends but I do not think there was a version for Shadows.
RE: Modding Tool
Ah ok, just to get a better idea I've downloaded the Legends version of BSG and had a looksie. The first issue is just that some of the folders are in different locations and/or differently named (ship images being contained in \shipimages as opposed to \images\units\ships for example), but that's easy enough for anyone to fix with some cutting and pasting just using the default files as a guide to the new layout.
There don't appear to be any root files for that mod other than biases.txt, which would just need renaming to raceBiases.txt. That makes things easy, because there's literally nothing to change to make them work for Universe, it would just use the default files anyway.
The Characters folder seems to be the same as it is now, as does the dialog folder barring a couple of obsolete variables that the tool already accounts for because they were mistakenly included in several Universe mods. The Races and Policy folders also don't seem to contain anything that data validation wouldn't sort out, except the policies files have some extra lines for ship design which are obsolete now due to Universe's designtemplates folder.
The designtemplates folder is the biggest difference, but the primitive version of design templates stored in the policies just doesn't have enough information there to automatically translate it into a Universe design template, it's just too general and open to interpretation what the flat values should be. Creating new design templates will likely therefore be the biggest job in getting an old mod up to Universe standards.
So basically when my tool is at 1.1.0.0 and you wanted to update an old mod to work with Universe you'd have to:
1) Rename some of the files/folders to their Universe equivalents.
2) Load the mod into the tool.
3) Create new design templates.
4) Output everything.
And in theory that should be it, you'd have a Legends or Shadows mod that works for Universe.
There don't appear to be any root files for that mod other than biases.txt, which would just need renaming to raceBiases.txt. That makes things easy, because there's literally nothing to change to make them work for Universe, it would just use the default files anyway.
The Characters folder seems to be the same as it is now, as does the dialog folder barring a couple of obsolete variables that the tool already accounts for because they were mistakenly included in several Universe mods. The Races and Policy folders also don't seem to contain anything that data validation wouldn't sort out, except the policies files have some extra lines for ship design which are obsolete now due to Universe's designtemplates folder.
The designtemplates folder is the biggest difference, but the primitive version of design templates stored in the policies just doesn't have enough information there to automatically translate it into a Universe design template, it's just too general and open to interpretation what the flat values should be. Creating new design templates will likely therefore be the biggest job in getting an old mod up to Universe standards.
So basically when my tool is at 1.1.0.0 and you wanted to update an old mod to work with Universe you'd have to:
1) Rename some of the files/folders to their Universe equivalents.
2) Load the mod into the tool.
3) Create new design templates.
4) Output everything.
And in theory that should be it, you'd have a Legends or Shadows mod that works for Universe.
RE: Modding Tool
Noticed the other day that the editor is not picking up on my pre-existing added races when opening the race biases editor. So loading my custom theme, and pulling up the race biases tab, all the vanilla races are listed in the drop down menu, but my custom races do not show up at all.
So unless I've managed to point it to the wrong files? Don't see how, went to my DW/customiztion/theme folder to load from. Might want to check on that by testing a test theme rather than just editing from the base game. Could just be me though.
Just to verify, this is a fully working DW:U theme. I'm just making some balance tweaks to it and stumbled on this issue.
So unless I've managed to point it to the wrong files? Don't see how, went to my DW/customiztion/theme folder to load from. Might want to check on that by testing a test theme rather than just editing from the base game. Could just be me though.
Just to verify, this is a fully working DW:U theme. I'm just making some balance tweaks to it and stumbled on this issue.
Distant Worlds Fan
'When in doubt...attack!'
'When in doubt...attack!'


