Modding Tool [1.1.0 Released!]

Please post here for questions and discussion about scenario, art and sound modding and the game editor for Distant Worlds.

Moderators: Icemania, elliotg

Post Reply
Sabranan
Posts: 474
Joined: Wed Feb 24, 2016 4:05 pm

Modding Tool [1.1.0 Released!]

Post by Sabranan »

Intro:

This tool is designed to be used with Distant Worlds: Universe. It will not work with any older expansions or plain DW. It "may" work with older versions of Universe, but I'd recommend just using the latest which is 1.9.5.12.

I am in no way affiliated with Code Force or Matrix Games, this tool is entirely a personal project.

Editing Capabilities:

It can edit most of the files you would want to change if you were making your own mod. This includes the “root” files in a mod folder which are:

about.txt, components.txt, facilities.txt, fighters.txt, governmentBiases.txt, governments.txt, plagues.txt, raceBiases.txt, raceFamilies.txt, raceFamilyBiases.txt, research.txt and resources.txt.

The only current limitation in editing the above files is the index of each project cannot be changed. This will likely be enabled in a future update.

It can also edit all files in the races, policies, dialog, characters and designTemplates subfolders.

There are certain files it does not edit:

agentNames.txt, characterNames.txt, colonyNames.txt, designNames.txt, designs.txt, GameText.txt, shipNames.txt, systemNames.txt and systems.txt.

The reason for excluding the above is that editing those files doesn't require the user to reference anything outside of the line they're editing, so there's no advantage to doing it in a form as opposed to a standard text editor.

It doesn't edit the help files, because there's plenty of MHTML editors out there that can do it far better than I could program a tool to.

It doesn't edit pictures or sound files, again, there are far better programs for that kind of work. However, where pictures or sound files are referenced, it'll let you select which one to use and show you the picture or allow you to play the sound file. Upon outputting, it’ll copy any picture or sound files you’ve selected into your mod folder and rename them appropriately.

Functionality:

The tool works by loading all relevant files in your mod folder into the tool’s memory. When you change anything in the tool, the change is not made directly to the files. Your files are only changed after clicking “Output to Disk”.

The first time you output changes, backups will be made of any changed files or subfolders. I still recommend that you make your own backup of your mod folder before editing it with my tool though.

From the main menu you can select the mod you want to work on, and what section you want to edit.

Image

There are a few advantages to using a tool like this as opposed to text editing.

Firstly, it helps prevent simple mistakes like missing a semicolon or adding an extra space or comma. DW might still load in these cases, but can behave strangely due to a simple typo.

Mostly though, the tool helps by making it easier to know exactly what you’re editing. In the research.txt file you’d see something like this:

Image

Most modders will remember off the top of their heads that the first value after the PROJECT ; is the project ID, and the next value is obviously the name of the project. But after that it’s just numbers, requiring you to scroll up and reference the big block of text at the top of the file to find out what the next values mean (in this case they’re the Tech Level, Row, Industry, category, Special Function Code and Base Cost Multiplier).

On the next line it’s even worse, because the component ID’s aren’t stored in the research.txt file, so you’d have to go open the components.txt file to know what number to put in there. Then you have to look up the component type to even know what the other values represent.

Finally you have the parent line, which is relatively simple because it happens to be referring to the project before this one (Advanced Laser Focussing in this case).

By contrast, using this tool you can open up the research form from the main menu and select the project (you can also type the first few letters into the box to use the inbuilt search feature displayed) you want to edit. I’ll use the same project here as an example:

Image

As you can see, everything is now not only labelled, but those numeric values that are a reference to something else (Industry, category, Special Function Code and Parent Project) are displayed by name. They’re all in drop down menus so you can easily set them without having to open up anything else.

Hitting the “Improve Components” button will open up a subform showing you this:

Image

Basically a visual view of the component improvements line, showing you not only the name of the component (again, this can be changed by selecting the component from a drop down menu) but also what each of the values means.

Just a small example of how much easier the tool makes modding all the major elements of Distant Worlds.

Latest Version: 1.1.0.19 attached!
Attachments
setup.zip
(4.97 MiB) Downloaded 994 times
Sabranan
Posts: 474
Joined: Wed Feb 24, 2016 4:05 pm

RE: Modding Tool

Post by Sabranan »

Well it's been almost 9 hours since the initial release, time for a new update!

The Mod Editor can now write a research file. I've set it to forcibly make a backup first, because now it can write data it can (and quite probably will) foul up your mod. That said just using the default values it does write a file that actually works when used in game.

You might notice that even if you don't change anything, the file it outputs is a few KB's smaller than the original inputted file. This is because the program removes any tab characters in the file to make things a bit simpler.

Any value you change is applied internally immediately, the only things you can't change are the Project ID (because that would confuse the hell out the program) and you can't yet make a new project. Of course you can always just stick a new "PROJECT ; somenumber" line in the research file manually and then edit it with the program from there.

Your changes are not saved to the research file until you hit the button on the Main Menu that says "Output Changes to Disk". Until that point you're safe to make whatever changes you like, so don't press the button unless you're sure you haven't screwed up somewhere!

I've updated the OP with the latest version.
Sabranan
Posts: 474
Joined: Wed Feb 24, 2016 4:05 pm

RE: Modding Tool

Post by Sabranan »

Now, I realise this game is not as popular as once it was. It's been almost 6 years since release after all, so I can totally understand a drop-off in how many people are playing and by extension, modding the game.

But nobody is interested? Really? Not that I'm doing it for the props or anything, but I must admit I expected someone to say "hey, this looks really promising!" or maybe "hey, your tool would look better in green" or even "hey, your tool sucks eggs and you are a tool!".

Just a little bit depressing that nobody can be bothered to say anything at all lol.

That said, here's version 3. The main menu now handles all file reading/writing (initially I had it so each form only dealt with its own data) so it's all in one place ready for combining information from different files later on. After choosing a mod folder you'll notice only two of the buttons become active, the Research button and the Racial Family Biases button.

These features work, both reading and writing. The Racial Family Biases is the new feature for version 3, and all those other buttons will become working as I release new versions.

I’ve updated the OP with the latest version.
User avatar
Shogouki
Posts: 200
Joined: Sun Aug 11, 2013 7:35 pm

RE: Modding Tool

Post by Shogouki »

Depending on how it works I might give it a shot. Though it would be a few weeks out before I could. And yeah, I do wish this game was still popular for modding. I would really love to see an expansive technology mod that primarily focuses on creating a balanced tech tree.
User avatar
kbobbato
Posts: 24
Joined: Fri Mar 07, 2014 9:57 am

RE: Modding Tool

Post by kbobbato »

I think that this game still has a lot of people using it. Maybe these forums are not as active as they once were. But I downloaded version two yesterday....and am subscribed to this thread. I am currently working on a warhammer 40k mod. And am trying to stabilize someone elses 40k that has not been active in like a year. So this tool will come in handy. Recreating the research tree is a very tedious task. But if you take away some of that tedium that would be great. Thanks for taking the time to make this program, it is going to be very helpful to me in the near future.
User avatar
Osito
Posts: 878
Joined: Thu May 09, 2013 8:55 am

RE: Modding Tool

Post by Osito »

The sub-forums for DW are often a little sluggish I'm afraid. To be honest I think most of the modding for DW:U has probably been done, and most people are just waiting (hoping) for DW2. Another problem is that you're not the first to try to work on this type of project, so we may be a little sceptical, and, sadly, some people are reluctant to run '.exe' files from the Internet.

A couple of years ago, a tool like this would have been really helpful to me, but if I'm honest I probably wouldn't use it now.

That's not to say it isn't a worthwhile project, and some, like dawnstorme, may still find it useful, so I certainly wish you luck with it.

Osito
Osito
Sabranan
Posts: 474
Joined: Wed Feb 24, 2016 4:05 pm

RE: Modding Tool

Post by Sabranan »

Ah shucks thanks guys, that’s all I really wanted lol. I realise that this tool is unlikely to kickstart a new era of DW modding but primarily I started designing it for myself anyway, I’d never done any sort of DW modding before and to a new modder the text files look awfully daunting because they’re mostly just filled with numbers.

So I figured the process of coding for it would teach me a lot about how DW stores and parses data and it’s definitively done that.

Then I realised actually this is a problem facing any modder, even experienced ones are not going to remember all the component numbers of the top of their heads. So if it ends up helping others too then that’s great.

Osito I have noticed the other main attempt at making a project like this, in fact that was one of my “go to” threads as a lurker. It looked gorgeous, but after the point where an alpha release was being talked about everything seemed to go wrong.

I’d like to think mine is different even though it’s in the early stages because I’m releasing once I get a new feature working right, so you can use it from day 1. The other project has been running for two years and as far as I’m aware nobody ever got to see it beyond screenshots (which looked awesome, but at the end of the day are just pictures). Of course from the sound of it real life has been doing what it does so while it’s a shame it’s understandable.

I do take your point about people maybe being unwilling to run exe files from the internet, especially from a new poster when an exe was their first upload lol. I’m not sure I can really get around that at least initially, but if a few longer term posters use it and confirm it’s ok then maybe people will be more willing to give it a go.

Right now I’m working on the raceFamilies file, so I expect version 4 to be released in a few hours.
Sabranan
Posts: 474
Joined: Wed Feb 24, 2016 4:05 pm

RE: Modding Tool

Post by Sabranan »

And we're done, version 4!
User avatar
Retreat1970
Posts: 1125
Joined: Wed Nov 06, 2013 11:09 am
Location: Wisconsin

RE: Modding Tool

Post by Retreat1970 »

Thanks, I'll check it out.
Sabranan
Posts: 474
Joined: Wed Feb 24, 2016 4:05 pm

RE: Modding Tool

Post by Sabranan »

Version 5 is up, it now has the Race Biases working. Also using the version system that Visual Studio provides, so this is 0.0.5. Once I have all the buttons working I'll move to 0.1.x, then 0.2.x etc as I look into the various subfolders. Once it's all working I'll release 1.0.0 and then up it from there as it becomes prettier, more efficient or with new features.

The Race Biases file was a bit more of a pain lol, the original file isn't well formatted. Some entries have spaces at the start, some comma-separated values have spaces and some don't...

It does mean that the actual output file is cleaner than the input one, which is nice.
User avatar
Shogouki
Posts: 200
Joined: Sun Aug 11, 2013 7:35 pm

RE: Modding Tool

Post by Shogouki »

Nicely done. I'm looking forward to trying this.
Sabranan
Posts: 474
Joined: Wed Feb 24, 2016 4:05 pm

RE: Modding Tool

Post by Sabranan »

Ok, good news and bad news...

Bad news is any downloads prior to 0.0.6 aren't going to work. Turns out clickonce applications require deploy & manifest files to do anything much...

Good news is I think I've got the auto-update functionality working. So once you've downloaded 0.0.6 you "shouldn't" have to download new setup files. Just run the app and it'll auto update off my NAS.
Sabranan
Posts: 474
Joined: Wed Feb 24, 2016 4:05 pm

RE: Modding Tool

Post by Sabranan »

A couple more buttons done and a new feature for 0.0.7!

Government Biases and Plagues are now working.

As a side note Plagues was a real pain, it's by far the biggest form so far with 14 values for each Plague and a potential for 50 different plagues. I may have to look at making the forms a bit more responsive, if you're viewing it on any resolution other than 1920x1080 it could be a pain. For now scroll bars will appear if there's things outside of the form so you'll at least be able to use it.

Not only that, but in the last value (the description) they use commas, and they're already being used as separators! That sure made for some fun coding around that.

The new feature is that it'll now store up to 10 mod folder paths in the registry, so you should only need to select your mod folder once. After that it'll appear in the list of recent folders for easy access.

If you're interested the values are stored under HKEY_CURRENT_USER\Software\Distant Worlds Mod Tool, this contains the app name and a list of mod paths.

If you've already installed 0.0.6, just run it and it should ask if you want to update.
Sabranan
Posts: 474
Joined: Wed Feb 24, 2016 4:05 pm

RE: Modding Tool

Post by Sabranan »

Latest release includes some bugfixes on the last one, 0.0.7 wasn’t saving changes properly to the Plagues data. Should be sorted now.

Version 0.0.8 includes the resources file, and I'm pretty happy with how this turned out. Potentially it was even bigger than the plagues one, what with its 10 basic values for 80 potential resources.

Then location information having 5 values each for each location.

The original resources text file never had more than 4 such groups of locations (which would have made 30 total fields per record all on its own), but nothing in the file or modding manual indicates it's limited to 4…

I’m not 100% sure it’s right but I’ve limited it to 10. I’ve done that on the basis that a mineral only has 7 potential planet types + 1 asteroid to be on, while gases have 2 planet types + the 8 cloud types. I don’t think you can put any given resource on more than 10 locations unless you’re mixing gases with minerals, which the modding guide tells you not to do.

I've gone with using a combo box to select the resource you want to change, it makes for much more pleasant viewing than the way the plagues file is currently implemented. Once they're all done I'll go back and make them all the same way for version 1.0.0.

For now, enjoy version 0.0.8!
Sabranan
Posts: 474
Joined: Wed Feb 24, 2016 4:05 pm

RE: Modding Tool

Post by Sabranan »

0.0.9 is here, with the ability to edit the fighters file.

Nothing special to say about the fighters, but rather than waiting for 0.1.0 to address the plagues form I've just gone ahead and redone it now. While it did work it looked horrible even on a 1080 screen and took a while to load on my computer (with an SSD and i7 extreme processor). God only knows what it would have been like on something less powerful or with a 720p screen.

It now looks a hell of a lot more user-friendly, and loads instantly too.

This is my (rather basic) overview of what's happened so far and where I expect it to go:

0.0.0 Project Begins

0.0.1 Research File Read
0.0.2 Research File Write
0.0.3 Racial Family Biases
0.0.4 Racial Families
0.0.5 Racial Biases
0.0.6 Auto-Updates + Actually Works
0.0.7 Government Biases + Plagues + Remembers Mod Folders
0.0.8 Resources + Plagues Fix
0.0.9 Fighters + Plagues Redesign
*We're here now
0.0.10 About file
0.0.11 Governments
0.0.12 Facilities
0.0.13 Components

0.1.0 All root text files redesigned + working
0.2.0 Race Information Working
0.3.0 Policy Information Working
0.4.0 Dialogue form
0.5.0 Images linked in (pictureref fields should display image, select by file)
0.6.0 Sounds linked in (sound file fields should play sound, select by file)

0.7.0 Will leave this version up for a few weeks to request feedback to fix any bugs, implement any good suggestions etc.

1.0.0 Everything functional

I've learned/remembered a lot as I work through these forms, the newer code is a lot cleaner and easier to edit and the forms look much nicer, so the older stuff will get redesigned to my latest standard for 0.1.0 (with the obvious exception of plagues, just couldn't stand looking at that any more).
Sabranan
Posts: 474
Joined: Wed Feb 24, 2016 4:05 pm

RE: Modding Tool

Post by Sabranan »

I've been on a roll recently, generating a lot of code automatically (thanks MS Excel) saving me a lot of time. Still a lot of work but I can now knock out a standard form in an hour as opposed to around 5 hours.

Thus, I'm a few versions ahead of where I expected to be today. I've just uploaded 0.0.13, meaning all the root forms are done! Next up will be redesigns of the forms, getting them all up to a decent standard for using. Not that's it's horrible now or anything, but it could be improved and some of the original code was not as clean and tidy as it could be. The whole program is starting to look a bit more professional though, which is nice.

So this would be a very good point to give me feedback on form layout and make requests in preparation for the 0.1.0 release!

Moddders, what would make the process easier for you? What fields do you tend to mod, how should they be grouped? Is it intuitive enough to use as soon as you open it (does it work at all? Nobody has told me!)?
Sabranan
Posts: 474
Joined: Wed Feb 24, 2016 4:05 pm

RE: Modding Tool

Post by Sabranan »

I wanted to do a post on updates, since anyone running a version that has them enabled is probably getting the prompt to update quite often.

Whenever you run the tool, before the main form actually appears it’ll look up my NAS and see if there’s any new updates. If the version on my NAS is higher than the one you’re currently running, it’ll ask you if you want to update.

Each time I publish an update I have the option to set a minimum required version. As long as you’re running a version higher than this, it’ll let you skip the update if you want. If not, it still won’t force you to update but it won’t let you run an earlier version either.

My plan at the moment is to only to set a minimum version when I hit key points, right now that means 0.1.0, 0.2.0 and 1.0.0.

I’ll make an exception to that rule if I fix a bug in a release that has the potential to corrupt any of your mod data. If that happens I’ll set the minimum required version to the one above the version with the bug.

At the time of writing this is set to 0.0.8, as that version fixed a serious problem with how it was writing the plague data (it was basically replacing the plague file with another one).

So you can rest assured that if the program is telling you that you have to update, there’s a good reason for that and you should do so.

Now, the versions number of the app actually has a forth number, the revision number. With the latest update this is shown in the app as well. I publish revisions at least once whenever I’m working on it, so you can potentially have several a day. Revisions will be simple bug fixes, redesign of a form or another small update of that nature.
Sabranan
Posts: 474
Joined: Wed Feb 24, 2016 4:05 pm

RE: Modding Tool

Post by Sabranan »

The latest revision has an example of just how sexy this could end up being (just run the program and accept the update to have a looksie). If you load up a mod and enter the research form, I’ve done a proof of concept for the “Enable Components” and “Improve Components” sub forms.

Normally you’d look in the text file where you’d see a list of comma-separated Component ID’s and that determines which components your research project will enable. Of course Component ID’s are just numbers, so in order to know what research project you’re enabling you have to go open the components file and look it up.

With this tool you just select the component from a drop down list. That means you don’t have to go looking anywhere else and you’re much less likely to make a mistake and input the wrong value because you can see the component name.

More importantly, when you select your component in the “Improve Components” sub form, all the labels update on the fly to tell what you’ll actually be improving! That was a huge amount of work, but it should make things so much easier for actual modding.

Naturally it still outputs the correct simple numbers to the text file.
User avatar
Shogouki
Posts: 200
Joined: Sun Aug 11, 2013 7:35 pm

RE: Modding Tool

Post by Shogouki »

Looking good!
Sabranan
Posts: 474
Joined: Wed Feb 24, 2016 4:05 pm

RE: Modding Tool

Post by Sabranan »

Thank you Shogouki!

If you (or anyone really) can confirm for me that the auto-update process is working that’d be great. It’s all well and good that it’s working for me but I have no real way to test that it’s working outside of my own network.

If it is working (and you’ve accepted the update) you should be running version 13 revision 11, and it’ll tell you so in the about box on the bottom right of the main menu.

Right now I’m polishing up the forms for all the root files, research is pretty much done so I’m onto components. That looks like it could be a bit of a bugger, there are 66 component types and each of them could have up to 7 modifiers.

Might need a couple hours to knock that out…
Post Reply

Return to “Design and Modding”