Skip to content

Modifying the DLL

Pedro S. Lopez edited this page Sep 2, 2019 · 7 revisions

Using tools like .NET Reflector (paid) or ILSpy (free), you can decompile the Assembly-CSharp.dll and view the classes and (most of) the code that make up the game. Furthermore, using Reflexil you can patch the DLL with changes, generating a new, modified DLL.

The original, unmodded DLLs for both Mac and Windows can be downloaded here. Note that there are separate DLLs for each platform and they will need to be patched individually.

Known / Modified Variables

Game Version

The Game class has a static Version property where the version number is set. There is also a VersionSync property that is used to detect if two clients are compatible for multiplayer. They grab version information from BuildFlags and VersionSync adds the AssetList version as well, but you can override the version returned in the method.

// Game.cs (original)
public static string Version
{
	get
	{
		string text = BuildFlags.Instance.version;
		if (DevMode)
		{
			text = text + "." + BuildFlags.Instance.devVersion.ToString();
		}
		return text;
	}
}

public static string VersionSync
{
	get
	{
		string version = BuildFlags.Instance.version;
		version = version + "." + BuildFlags.Instance.devVersion.ToString();
		version = version + "." + RemoteResourceManager.Instance.AssetListVersion;
		if (RestrictJoiningToSession)
		{
			version += ".dev";
		}
		return version;
	}
}

Currently we are returning "1.0.1", setting the game version to v1.0.1. Whenever a change is made to the DLL, this version number should be updated.

Max Level Capacity

The Map class has a static property maxCapacityPoints that sets the maximum capacity that can exist in a level. This is broken up into three parts: CPU cap, Bandwidth cap and Physics cap.

Original Values:

  • CPU: 1500000f
  • Bandwidth: 30f
  • Physics: 200f

Current Values (3x):

  • CPU: 4500000f
  • Bandwidth: 90f
  • Physics: 600f

Multiplayer Server URL

The Servers class, in its Awake method, initializes the multiplayer servers available to the game:

if (NetworkEx.Type == NetType.Photon)
{
	string str = (!PhotonEx.USE_TCP) ? "5055" : "4530";
	servers.Add(new Data("USA", "photon.atmosphir.com:" + str, devModeOnly: false));
	servers.Add(new Data("AMAZON", "ec2-184-73-135-121.compute-1.amazonaws.com:" + str, devModeOnly: true));
}

This can be modified to point the game to a custom Photon server and make multiplayer work. At the moment, it's patched to a specific AWS server we used to run, but it has since been taken down.

To run the server, you will need Photon Server version 2.6. Newer versions are not compatible, but other 2.x ones may work.

Design Mode Item Category

The ItemCategory enum contains the possible values for categories. A new classification may be added by adding it to this enum.

// ItemCategory
public enum ItemCategory
{
	none = -1,
	block,
	floor,
	connector,
	movingPlatform,
	fallingPlatform,
	basicProp,
	interactive,
	hazard,
	treasure,
	powerUp,
	flag,
	music,
	skybox,
	ugc,
	racingProps,
	experimental
}

You'll see that experimental has been added. To actually show it in the design mode dropdown, you need to modify the Design class, which contains an array propFilters with the names of the categories:

private string[] propFilters = new string[17]
{
	"Blocks",
	"Floors",
	"Connectors",
	"Moving Platforms",
	"Falling Platforms",
	"Basic Props",
	"Interactives",
	"Hazards",
	"Treasures",
	"PowerUps",
	"Flags",
	"Music",
	"Skyboxes",
	"UGC",
	"Racing Props",
	"Experimental",
	"All"
};

Again, you'll see Experimental has been added. Everything that's not fully working should be added to this category. To actually use the category on design props, AssetBundle modification is required. (I don't remember how this works right now, will create a section for this when I have time to re-learn the process)