Tutorial: Setting up a modding environment

** THIS WRITE UP IS A WIP. **
Some parts are not completed and will probably change.

I have managed to start dissecting the games code and have set up a development environment for creating mods. If you would like to work on your own mods, here is how you can do it!

** DISCLAIMER: **

The official stance is that it is not recommended to mod at this point - or at least it’s not supported yet if something goes wrong. As you noticed, it could currently break files, plus things will be changing so much with balancing and bug fixes, that mods will be out of date a lot and could break other things. So do so at your own risk!! :smiley:

Requirements:

If you plan on creating your own mods, I recommend you have a very good understanding of Unity. You should know the engine well enough to create complex games, since reverse engineering a games code is 10x harder than writing your own.


Step 1: Installing MelonLoader


To access any of the games code, or to load an external modifications, we will need a mod loader installed first. At first I attempted to use BepInEx as I have more experience using it. However, it seems that the combination of Unity 2021.3 + Il2CPP backend doesnt work well ATM.

So MelonLoader it is! Installing is fairly simple with their automated installer. Just follow the instructions in the wiki.

** IMPORTANT: **
The game is 64-bit so you MUST install that version of MelonLoader. The installer should automatically detect this.

Once it is installed you have to launch the game atleast once. You should see a new loading screen that looks like this.

** IMPORTANT: **
If you own the game on Steam DO NOT open the exe directly. Make sure you launch the game through Steam.

Once the game has loaded, if you open the games install directory you should see some new Folders (MelonLoader, Mods, UserData & UserLib) This means you have completed the MelonLoader installation :partying_face:


Step 2: Reading the games code


The first thing you must know is that this game uses the IL2CPP backend instead of Mono. I assume this is for the performance benefits of C++ (only the devs know for sure :man_shrugging:)

This is the reason we must first use MelonLoader before accessing the games code. With a typical Mono game, we can just read Assembly-CSharp.dll in DnSpy. With IL2CPP there is no Assembly-CSharp.dll to read from.

Once we have loaded the game with MelonLoader, A new Assembly-CSharp.dll file will be created in
Big Ambitions\MelonLoader\Managed

Open this file in DnSpy. You can now admire all the hard work that has gone into coding this amazing game!

Much of what happens in the game is controlled by the GameManager so that is a good place to start.

You will notice that most of the functions look the same. This is because we are not looking at the actual source code, but rather a decompiled translation of the compiled C++ code, that was translated from IL, which was compiled from the C# source code. (This is very simplified and probably incorrect :sweat_smile:)


I am not an expert in code reverse engineering, but I am trying my best to better translate the decompiled code. If anyone here has more experience in this, your help would be greatly appreciated!

For now, we can mostly infer what each function does from its name (The devs have done a great job of naming).

Next I will show you how to install the UnityExplorer mod, which will allow us to inspect gameObjects right in the game, and execute code so we can test what each function does.


Step 3: Installing UnityExplorer


By using UnityExplorer, we can inspect GameObjects in a similar way to how you would use the built in Unity Editor.

You can download it from the GitHub. Make sure you get the MelonLoader 0.5 IL2CPP version.

Drag the files into your Big Ambitions directory and launch the game.

After a few seconds you should see this UI appear in game.

I HIGHLY recommend you create a new save game for testing at this point, as there is a good chance you will start breaking things now.

There are some instructions on the GH page for how to use the mod. You will be able to see all GameObjects and inspect any scripts attached to them which will be very useful for creating mods. You can also use Hooks and the C# console to run code directly in the game!

** IMPORTANT: **
When entering a loading screen, you MUST disable any modded UIs (UnityExplorer default hotkey is f7). If the UI is enabled when entering a loading screen it will break the UI and you will no longer see it. I assume this comes from the loading optimizations.

** NOTE **
In some cases you may need additional dll files in \UserLibs that are not included in the default build. To get these, you need to clone the UnityExplorer repo and build it yourself in Visual Studio. This may seem difficult but it is good practice for making your own mods (and you can use their code as an example for complex mods).


Step 4: Creating your first mod!


** COMING SOON **

2 Likes

I tried melon loader yesterday but the game crashes on startup once I install it. :frowning:

Strange, I just tried a fresh install with the auto installer and it seems to work for me (I originally used the 0.6 alpha on GH)

Do you have a Big Ambitions\MelonLoader\Latest.log file? If so can you send me the output?

Keep in mind the game is 64 bit (The installer should auto detect this)

EDIT:
Also, if you have a steam copy of the game, make sure you open it through steam. It crashes for me when I launch the exe directly

http://codepad.org/EVIIPXvh

Is my latest.log after I run the game with melonloader installed for the first time.

Hard crash to desktop every time. I was using the latest 5.7 release of melonloader initially but this try was with the 6.0 alpha as you suggested.

I am launching through Steam.

Strange, there doesnt seem to be any errors here. Are you sure you have all the dependencies installed?

For melonloader yes I have all the dependencies. I am using a pretty underpowered machine at the moment, I guess it could be hardware related.

Tried again with .NET 7, same hard crash. Thank you for trying to help nonetheless. I appreciate your efforts to help the community get started modding this awesome game! :smile:

1 Like

Try .net 6.0 as well (or 7, that is what I am using) and make sure it is the 64 bit version.

MelonLoader only puts .net 4.8 in the requirements

EDIT:
I encourage you to dig into the MelonLoader/logs folder, you might be able to find a clue :crossed_fingers:

@DavidEstesCreations

I noticed I cant edit posts after a certain amount of time. Is there a way I can edit this post later so it can be updated?

1 Like

I’m looking into this to see what you’re not able to edit more.

It might just be a forum limitation since you’re newer and making a lot of edits at once :man_shrugging: - I’m not seeing anything flagged with this post or you that would prevent further edits but if it’s still not working after a bit of a cooldown, I’ll dive in deeper and look more!

1 Like

Level 0 and 1 users can only edit posts within one day. Higher levels can edit within 30 days after posting, then it’s locked for them as well.

1 Like

dragged the unity explorer files into the bigambition folder , everything else seems to work but UE isnt loading in game for some reason