Jump to content

Issues in updating Mods to the DLC 1


Recommended Posts

So finally I sited here to play with the dlc mod updating, and before even my chair become warm, I found some issues, two problems I could not find a proper solution. First and the major issue I have found was that in the dlc, I'm not able to use custom kanim. It seems that there was a change in the restriction or some internal priority restriction. I could not say more from the debug, but I know its related to the use of custom kanim files. The second issue is related with the TECH_GROUPING, which don't exist anymore. I kinda was able to solve it, but I could not test it because of the first issue posted here, but it would help a lot if anyone could share the solution for this particular issue too.

Link to comment
Share on other sites

So my modding skills are terrible for this game, due to no real documentation and only truly beginner C# ability.  So the way I'm doing it is probably just the worst.

However, I was able to fix (I think, my building can be built and appears to work ingame) my issue with TECH_GROUPING not existing!

 

In my old code:

[HarmonyPatch(typeof(Db), "Initialize")]
    public class MyModPatch
    {
        private static void Prefix()
        {
            List<string> list = new List<string>(Techs.TECH_GROUPING["TemperatureModulation"])
                {
                    "MyMod"
                };
            Techs.TECH_GROUPING["TemperatureModulation"] = list.ToArray();
        }
    }

 

In my new code:

[HarmonyPatch(typeof(Db), "Initialize")]
    public class MyModPatchNew
    {
        private static void Postfix()
        {
            Db.Get().Techs.Get("TemperatureModulation").unlockedItemIDs.Add("MyMod");
        }
    }

 

Basically, there's a new(?) "Tech" class and unlockedItemIDs is the location of the list of building IDs in that tech.  Have to "Get" the Db, focus on the Techs, "Get" the specific Tech using it's name/ID, then add your building to the list.

To get to it, the Techs class in Db has to be initialized first which is why I moved to a Postfix.  Otherwise I got an error.

After that, setting up the new "mod_info.yaml" allowed me to turn it on in-game!

Link to comment
Share on other sites

I will try as soon as possible, and my thanks for the suggestion. Yeah I found myself on quite a jeep trying to figure out this. One solution I have found was using Peter Han PLib to allow circumvent this issue, allowing me to set tech for both vanilla base game and dlc in the same mod. However, it seems unstable, since the method worked on one mod of mine but no other. I have expended quite some time trying to figure out the reason of the issue, which according to the Peter Han himself, was a missing static. I can very much it was not case, because I copied the entire mod files ( which were working perfectly ) to a different project, adjusted them, build them, and when testing, it gave the same error as the mods I tried to update with it before.

Anyway its an option worth to try, its available on his GitHub page if anyone is interested.

Link to comment
Share on other sites

19 hours ago, shinseitom said:

So my modding skills are terrible for this game, due to no real documentation and only truly beginner C# ability.  So the way I'm doing it is probably just the worst.

However, I was able to fix (I think, my building can be built and appears to work ingame) my issue with TECH_GROUPING not existing!

 

In my old code:


[HarmonyPatch(typeof(Db), "Initialize")]
    public class MyModPatch
    {
        private static void Prefix()
        {
            List<string> list = new List<string>(Techs.TECH_GROUPING["TemperatureModulation"])
                {
                    "MyMod"
                };
            Techs.TECH_GROUPING["TemperatureModulation"] = list.ToArray();
        }
    }

 

In my new code:


[HarmonyPatch(typeof(Db), "Initialize")]
    public class MyModPatchNew
    {
        private static void Postfix()
        {
            Db.Get().Techs.Get("TemperatureModulation").unlockedItemIDs.Add("MyMod");
        }
    }

 

Basically, there's a new(?) "Tech" class and unlockedItemIDs is the location of the list of building IDs in that tech.  Have to "Get" the Db, focus on the Techs, "Get" the specific Tech using it's name/ID, then add your building to the list.

To get to it, the Techs class in Db has to be initialized first which is why I moved to a Postfix.  Otherwise I got an error.

After that, setting up the new "mod_info.yaml" allowed me to turn it on in-game!

This works well, at least on the DLC. The "unlockedItemIDs" goes down, as Tech does not have a definition for it on the vanilla base game however. Anyway, it was a good start, and at least it works!

Link to comment
Share on other sites

On 1/15/2021 at 4:00 PM, Rainbowdesign said:

Before all modders start to search for a new unofficial way to register a building perhaps klei wants to answer what the official way to register building to a tech is right now, or perhaps add it to modutil? @Ipsquiggle

I completely agree. If there is an "official" way to do this, then we would have a much lower risk of mods breaking.

20 hours ago, Ronivan said:

This works well, at least on the DLC. The "unlockedItemIDs" goes down, as Tech does not have a definition for it on the vanilla base game however. Anyway, it was a good start, and at least it works!

I just checked and you are right. There is a difference here between the DLC version and base game. Looks like we will need mod_info.yaml to solve this.... more work when modding.

Link to comment
Share on other sites

21 hours ago, Ronivan said:

This works well, at least on the DLC. The "unlockedItemIDs" goes down, as Tech does not have a definition for it on the vanilla base game however. Anyway, it was a good start, and at least it works!

Indeed, I probably should have mentioned this.  The "DLC" is really a different game.  I think I read that eventually they want the base game and dlc version to have the same codebase but for now there are some significant differences.

Link to comment
Share on other sites

A while ago I wrote my own API to add buildings to the tech tree. I just updated it to support the DLC (code written before I saw the same in this thread) and since that breaks vanilla support, the file now has both. I added a solution, which defines DLC1 when compiling and that way I can have one file, which supports both. Feel free to copy this if you can use it.

It's still a messy situation because I need to turn the DLC on/off to compile for the other situation as well as testing. Each time I need to download the entire game again. It would be nice if mod creators would be able to compile and test in both cases without having to download nearly half a TB in order to switch. It looks to me like it becomes way too tempting to create mods for the DLC only and I don't think that was the intention.

Ideas for a more streamlined mod development process are most welcome.

Link to comment
Share on other sites

On 1/16/2021 at 7:18 PM, Nightinggale said:

Ideas for a more streamlined mod development process are most welcome.

I'd like to help!

I had a very simple mod that was working before the DLC, and have experience with software development.

I will get a public Github repo started with this mod, hopefully the upgrade process can serve as a starting point?

Link to comment
Share on other sites

28 minutes ago, Clinch said:

I'd like to help!

I had a very simple mod that was working before the DLC, and have experience with software development.

I will get a public Github repo started with this mod, hopefully the upgrade process can serve as a starting point?

Not quite what I meant. I have a few mods of my own, which now works with the DLC. The problem is that you compile for the DLC, then test in the DLC, then you switch to vanilla, test, adjust, test etc until it is working and then you test the DLC again because you changed some shared code. Every time you switch, steam will download around 500 MB meaning writing a mod for the DLC and jumping into vanilla to test that it still works and then returning to the DLC requires downloading one GB from steam.

I'm asking if anybody knows a way where switching is faster than that and doesn't include annoying waiting time.

Link to comment
Share on other sites

7 hours ago, Nightinggale said:

Not quite what I meant. I have a few mods of my own, which now works with the DLC. The problem is that you compile for the DLC, then test in the DLC, then you switch to vanilla, test, adjust, test etc until it is working and then you test the DLC again because you changed some shared code. Every time you switch, steam will download around 500 MB meaning writing a mod for the DLC and jumping into vanilla to test that it still works and then returning to the DLC requires downloading one GB from steam.

I'm asking if anybody knows a way where switching is faster than that and doesn't include annoying waiting time.

Copying snapshots of the game to a backup directory than swapping out the version you want to test might work.

Link to comment
Share on other sites

On 1/20/2021 at 3:02 PM, Nightinggale said:

Not quite what I meant. I have a few mods of my own, which now works with the DLC. The problem is that you compile for the DLC, then test in the DLC, then you switch to vanilla, test, adjust, test etc until it is working and then you test the DLC again because you changed some shared code. Every time you switch, steam will download around 500 MB meaning writing a mod for the DLC and jumping into vanilla to test that it still works and then returning to the DLC requires downloading one GB from steam.

I'm asking if anybody knows a way where switching is faster than that and doesn't include annoying waiting time.

You can use SteamCMD to maintain two separate installs, and then create symlinks to those installs so that you can run the game under Steam DRM.

Link to comment
Share on other sites

On 1/20/2021 at 5:02 PM, Nightinggale said:

I'm asking if anybody knows a way where switching is faster than that and doesn't include annoying waiting time.

Aah, I see - thank you for the clarification.

Those seem like unnecessary downloads, time for me to get up-to-speed on the dev environment :D

On 1/22/2021 at 3:36 PM, AzeTheGreat said:

You can use SteamCMD to maintain two separate installs, and then create symlinks to those installs so that you can run the game under Steam DRM.

This is the first time I've seen those terms...that leads me to believe that you can maintain your Steam library programmatically, at least on an OS with symlinks ;)

Cool!

Link to comment
Share on other sites

On 1/26/2021 at 12:53 PM, Clinch said:

you can maintain your Steam library programmatically

It's probably worth me mentioning that I had to abandon that approach because I couldn't get it to work well consistently.  Had issues with it downloading the wrong files, validation was difficult, and every update with SteamCMD signed me out of the Steam Client which was too much of a pain.  I've ended up just maintaining two install folders and renaming them as I need them.

Link to comment
Share on other sites

20 hours ago, AzeTheGreat said:

I've ended up just maintaining two install folders and renaming them as I need them.

Happy to see that there's at least a workaround, thanks for sharing - I just got my first simple mod working with the DLC (added a recipe to the Molecular Forge), I'll see how it behaves without it now (just to catalogue the process of switching DLC off will be worth it!).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...