Jump to content

[MOD|TOOL] OnionPatcher


Recommended Posts

IMPORTANT!!! IMPORTANT!!!

OnionPatcher is no longer being activly developed as it's own thing but is instead integrated and maintained by @Etiam as a modular/opt-in feature in his MaterialColor mod. The full source of the latest OnionPatcher (post-merge, warning dirt simple code) here

This was a mutual decision (I asked) so that we can avoid merges and that we can have a better and more developer supporting the features. I hope you all understand...

 

IMPORTANT!!!

The current Alpha Branch breaks the force seed function in the current OnionPatcher, since I don't know when it will hit the public branch I can't remove the current one. This version is compatible with the Alpha Branch and should be used if you are either on an alpha branch or it hits the public branch. If you are unsure if the current version needs the new OnionPatcher or the current one, try forcing a seed, if the world generation hangs, it needs the new otherwise stay on the current (can be found further down in this post).

The new world generation uses 4 seeds (worldseed, layoutseed, terrainseed and noiseseed) whereas the (at the time of writing) current public version uses a single seed for it's world generation.

It's a bit messy but I don't want to bloat the code-base with compatibility checks, so please forgive this transition period.

What is OnionPatcher?

OnionPatcher is a little IL (Intermediate Language) Patcher I wrote during my free-time that enables one to access features that aren't immediately accessible in-game. Remember to check this thread for updates to the patcher as it is in development!

It doesn't currently support a lot, and most of the features will probably be obsolet in a near future. Currently you can:

  • Enable Debug Mode (Always On), which allows you to use the Debug-commands, such as super-speed, Deplicant-spawning and turning off the entire HUD (makes for some great screen-dumps). There is a lot more, but unfortunately not all of them works as intended, some WILL crash your game, you have been warned. Every available debug-command can be found under the Control-menu in-game.
  • Enable Free Camera Mode, this will allow you to zoom out quite a bit more and isn't accessible normally. It can flicker sometimes due to fast scrolling but will allow you really get a sense of your accomplishments, capturing all of your work in a single screen.
  • Force World Generation Size - Klei is definitively planning on bringing us a choice in how big we want to make our world, until then, this will suffice. The standard size of the world (in tiles) is 256x384. Note that will REQUIRE you making a new world if you want your new sizes to be applied. A fair warning is that too small or large of a size WILL either crash or soft-lock your computer. I tried 512x512 and it worked well, 1024x1024 allocated 16 GIG of RAM and another additional 16GB of Pagefiles. Use this with moderation, or if you got some of them 64GB RAM builds, go nuts! Minimum size I have personally been successful without crashing the game with as small as 128x128.
  • Force World Generation Seed - Generate the same world over and over, compete against others and see who can survive the longest, try figure out an optimal strategy for a specific world, the possibilities are limited! A seed of -1 will default back to the games random seed.
  • Enable Seed Logging - So you can easily check the seed of that one awesome world you had that one time. Relive the nostalgia over and over again until nothing else matters. The logging information is stored in the games root-folder and is named onionlog.txt.

eDjDH2R.png

f07IY8r.png

Is it safe to use?

Yes and no! Going bananas with OnionPatcher will put strain on the game-engine. Crashing the game might result in save-data loss, so please be careful. When patched, a backup will be stored in the data-folder of OnionPatcher-root directory, if you wish to restore this backup, press the restore button.

Here is a TotalVirus scan-result: https://www.virustotal.com/sv/file/a471e8ef74ae114524cee1348425ecabfa68721da9f85df70c821c41142c11f8/analysis/1490500598/

How do I use it?

  • Download OnionPatch here (or here if you the other doesn't work when forcing a seed)
  • Unzip it
  • Start it up
  • Click the Browse-button, and navigate to your common/OxygenNotIncluded folder and press OK.
  • Press the Patch-button, and if everything went well you will be prompted that it was successful.
    • A backup of the Assembly-CSharp.dll will be made (which can be restored by the Restore-button).
    • At the root-folder of ONI, there is a file called onion.json, open this with a text-editor and change the settings to your liking.
  • DONE
  • Start the game, enjoy your changes!

Requirements and Issues

.NET 4 and Windows OS (Sorry Linux-fams <3)

Ethical

This does not use or re-distribute any of Klei or Unity's work, it is all coded by me. If Klei has a issue with this, I will respect that choice and pull it down, if it comes to that, please respect their wishes and do not re-distribute OnionPatch. Thank you!

Why is development slow?

There are a couple of reasons for this. I'm currently developing this all on my own, which means that the development process is at the mercy of my free time. I'm also doing my masters which involves a lot of studying (unfortunately) so there are stretches of time where I might be able to work on ONI-tools at all, it's not ideal but it is what it is. There is also the fact that patchers have to scan/inject IL which is a very low-level language (think assembly/asm). On my end, editing and modifying the game is quite fast and effortless because I can use C#, but that only works for modifying the assembly directly. I can't distribute the modified assembly, as that is distributing of IP I do not own. This ties heavily in with the Ethics above. Having to package these modifications in a dynamic patcher requires a lot more effort, which is why it's a lot slower.

Link to comment
Share on other sites

1 minute ago, ImDaMisterL said:

I myself probably won't be using this, but I know lots of people will. You sir, are awesome. Thanks for giving us this tool!

Thank you! Klei will probably make this tool obsolete soon enough, but until then! :D
I honestly did this out of pure nostalgia lingering from the Don't Starve Way-Back-When-Days, feels good to be (somewhat) back!

Link to comment
Share on other sites

is there any chance to change mapgen settings? the yaml files don't seem to affect anything

great tool

I so wanted a wider than taller world

I'd like to see different start biome settings (swirls, starts, pentagrams, chaotic instead of round blob, tho they will probably refine it)

Link to comment
Share on other sites

3 hours ago, dunny said:

is there any chance to change mapgen settings? the yaml files don't seem to affect anything

great tool

I so wanted a wider than taller world

I'd like to see different start biome settings (swirls, starts, pentagrams, chaotic instead of round blob, tho they will probably refine it)

It should be possible, I'll see what I can do! Thanks for the feedback/suggestion!

Link to comment
Share on other sites

I had a look myself and was able to change a few settings, I have not found the settings for increasing the sedimentary startworld blob but managed to ruin the mapgen (too much noise) as well as set a starting temperature for the gate room (i chose mild which gives an immediate area with ~15 degrees, changes a lot)

Sadly I have no understanding of the math behind possier discs and penlin fractals ^^

it's possible to change amount of starting lakes, copper blobs, co2/vacuum caverns, mob stuff and many other things

 

also I dunno how much of an interest it is to you and your tool ideas, but hex editing for dupes works pretty well, especially easy to make out what is what rig ht after starting a new game

but things like parsing stats, traits, stress level or modifying them with script/tool 

Link to comment
Share on other sites

39 minutes ago, dunny said:

I had a look myself and was able to change a few settings, I have not found the settings for increasing the sedimentary startworld blob but managed to ruin the mapgen (too much noise) as well as set a starting temperature for the gate room (i chose mild which gives an immediate area with ~15 degrees, changes a lot)

Sadly I have no understanding of the math behind possier discs and penlin fractals ^^

it's possible to change amount of starting lakes, copper blobs, co2/vacuum caverns, mob stuff and many other things

 

also I dunno how much of an interest it is to you and your tool ideas, but hex editing for dupes works pretty well, especially easy to make out what is what rig ht after starting a new game

but things like parsing stats, traits, stress level or modifying them with script/tool 

I messed around with world-gen before, it's not hard to modify, given you know a bit of the required math. The problem is that the world-gen is huge and spans over a great deal of functions and classes. Modifying it on my end is easy, but it requires considerably more effort writing the patcher for it so that others can use it. World-gen is also something that will most likely be drastically changed, meaning that any patcher will most likely break every update or so. Still it certainly would be interesting...

Link to comment
Share on other sites

Wow,  This deserves far more attention than it's currently received!  Really looking forward to playing with the world size and eventually some tuning / balancing of current game mechanics.  Definitely takes me back to the beginning of Don't Starve!  Good times!

Link to comment
Share on other sites

On 2/21/2017 at 11:21 PM, achoo said:

Wow,  This deserves far more attention than it's currently received!  Really looking forward to playing with the world size and eventually some tuning / balancing of current game mechanics.  Definitely takes me back to the beginning of Don't Starve!  Good times!

Thank you! It was a very adventurous time, and I can easily say it was probably one of the most fun and memorable periods in my life.

20 hours ago, sundrop said:

i love it 4 thumbs up @Moonkis thx! will be great if there is update too

Thank you for the kind words! I'm a bit confused, what do you mean by update? I am actively working on each tool, though I have limited time to work on it. If you have any suggestions or features you would like to see, feel free to post them, I'll try to look into it.

Link to comment
Share on other sites

Awesome! I had posted a suggestion that the devs allow map seed exchange. The tool is a little clunky, and if possible I'd like to see the following improvements:

You've already done this: Warn the user to backup Assembly-CSharp.dll (not too big of a deal, really, because verifying game integrity with Steam will fix it).

For a more streamlined end-user experience, I'd say after making a backup, rename the original Assembly-CSharp.dll to something else very specific, like Onion.dll. Then run the program, select your desired function and click the Patch button. The program looks for Onion.dll and uses it to create a patched Assembly-CSharp.dll. If a file named Assembly-CSharp.dll already exists, the program moves it to the recycle bin. This would make trying different seeds much easier, as the user wouldn't have to keep deleting a patched Assembly-CSharp.dll and putting a copy of the original back, then deleting it after the patch is created and renaming Assembly-CSharp.onion.dll every time. If it worked as I just described, I'd simply be able to type in a new seed and click Patch after every try.

Either that or figure out a way to patch a patched Assembly-CSharp.dll. Once you patch in a new seed value, re-patching the modified file doesn't work. It keeps giving you the first seed's map.

It would also be nice if the program remembered where the game directory is located after the user locates it the first time, rather than having to do that every time you run it.

Link to comment
Share on other sites

37 minutes ago, chrispy1 said:

hello I would like to have more water in my world and also some more sand.
How can I get this done.
I have the union patcher.
please help me Thanks greetings chrispy

OxygenNotIncluded_Data\StreamingAssets\worldgen\features
OxygenNotIncluded_Data\StreamingAssets\worldgen\biomeTables

you can modify values in any of these yamls to change the type and quantity of elements generated, just remember to back up any files you edit, and return them to original when you run into game crashes

only way to do it until papa moonkis adds more features to his super cool tool

Link to comment
Share on other sites

5 hours ago, chrispy1 said:

hello I would like to have more water in my world and also some more sand.
How can I get this done.
I have the union patcher.
please help me Thanks greetings chrispy

 

For more water, change the blobSize min and max (line 6) in feature_Sedimentary_SmallLake.yaml and feature_Sedimentary_MediumLake.yaml.

For more sand change the bandSize for sand in biomes_Sedimentary.yaml.

@noodog Hex editing the save file isn't illegal. Wouldn't matter anyway, since you'd just be explaining how to do it, not actually doing it.

I'll pass this along for those interested in these kinds of things: To get the map seed of a map you just generated, open WorldGenDataSave.dat in My Documents\Klei\OxygenNotIncluded with a hex editor. The map seed can be found at offsets 9AB through 9AE. Type these numbers in a hex to decimal converter - BACKWARDS - to get the map seed to use with OnionPatcher. So if, for example, your file looks like this: B9 32 D7 46, you would type into the converter: 46D732B9. Note that WorldGenDataSave.dat is overwritten every time you generate a new map, so be sure to save the seeds of maps you like before rolling a new game.

Link to comment
Share on other sites

3 hours ago, noodog said:

i think hex editing the save file is illegal? i duno, i could show how to do that if it isnt

this is what would need to be edited inside the Assembly-CSharp.dll
tuning > duplicantstats > distributions

  Reveal hidden contents


        public class DISTRIBUTIONS
        {
            public static List<int[]> TYPES;

            static DISTRIBUTIONS()
            {
                List<int[]> numArrays = new List<int[]>()
                {
                    new int[] { 7, 6, 5, 4, 3, 2, 1 },
                    new int[] { 7, 4, 2, 1 },
                    new int[] { 7, 2, 2, 1 },
                    new int[] { 8, 1 },
                    new int[] { 8, 4, 1 },
                    new int[] { 4, 4, 4, 4, 1 },
                    new int[] { 6 },
                    new int[] { 4 },
                    new int[] { 2 },
                    new int[] { 1 }
                };
                DUPLICANTSTATS.DISTRIBUTIONS.TYPES = numArrays;
            }

            public DISTRIBUTIONS()
            {
            }

            public static int[] GetRandomDistribution()
            {
                return DUPLICANTSTATS.DISTRIBUTIONS.TYPES[Random.Range(0, DUPLICANTSTATS.DISTRIBUTIONS.TYPES.Count)];
            }
        }

 

 

For now, I suggest you don't post code directly taken from the assembly itself, as that might be prohibited (most likely?).

 

2 hours ago, techActual said:

 

@Moonkis Thanks for getting the modding/tool momentum going.

It was fun, and I'm happy to see there are people interested in modding this game, I'm sure a lot of cool stuff will come out of it.

Link to comment
Share on other sites

On 3/13/2017 at 10:14 AM, Yuno_Gasai said:

I couldn't find any kind of 'managed' file or folder, only my save and autosave folders.  Is this outdated already, or am I looking in the wrong place?

first on OxygenNotIncluded_Data then managed

 

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...