willis81808-UnboundLib icon

UnboundLib

This is a helpful utility for ROUNDS modders aimed at simplifying common tasks.

Last updated 2 weeks ago
Total downloads 404724
Total rating 9 
Categories Utilities
Dependency string willis81808-UnboundLib-3.2.6
Dependants 232 other mods depend on this mod

This mod requires the following mods to function

BepInEx-BepInExPack_ROUNDS-5.4.1900 icon
BepInEx-BepInExPack_ROUNDS

BepInEx pack for ROUNDS. Preconfigured and ready to use.

Preferred version: 5.4.1900
willis81808-MMHook-1.0.0 icon
willis81808-MMHook

MonoMod Runtime Hooks generated for ROUNDS

Preferred version: 1.0.0

README

Join Us!

For more mods, news, and support join us on discord here: https://discord.gg/mGfsTvc53v

UnboundLib

This is a helpful utility for ROUNDS modders aimed at simplifying certain common tasks.

Usage

NetworkingManager

The NetworkingManager abstracts the default Photon networking capabilities away into an easy-to-use interface you can use for communication between clients. Example usage:

private const string MessageEvent = "YourMod_MessageEvent";

NetworkingManager.RegisterEvent(MessageEvent, (data) =>
{
	ModLoader.BuildInfoPopup("Test Event Message: " + (string)data[0]);    // should print "Test Event Message: Hello World!"
});

// send event to other clients only
NetworkingManager.RaiseEventOthers(MessageEvent, "Hello World!");

// send event to other clients AND yourself
NetworkingManager.RaiseEvent(MessageEvent, "Hello World!");

CustomCard Framework

Create a class for your card, extend the CustomCard class, implement its methods, and then in your mod initialization register your card like so:

void Start()
{
    CustomCard.BuildCard<TestCard>();
}

CustomMap Framework

First create a map in unity by using the package and export your scene to a AssetBundle. Then in your mod initialization register your map like so:

void Start()
{
    LevelManager.RegisterLevels(TestAssetBundle);
}

Credits Framework

Registering credits for a mod is as simple as:

void Start()
{
    Unbound.RegisterCredits(string modName, string[] credits, string linkText, string linkURL);
}

GameMode Framework

The GameMode framework provides a modding-friendly API for custom game modes, allowing mods to target them without having to know about their existence.

Custom game modes are defined in two layers: the actual game mode class that does all the heavy gameplay logic, and a handler class that provides an interface between mods and the game mode.

Hooks

The framework offers a flexible hook system. With hooks, mods can trigger actions at specific points of time as a game is running, without needing to know anything about the specific game mode or its implementation.

Triggering hooks

Game modes can trigger async hooks whenever they wish:

private IEnumerator RoundStart()
{
	// Hook keys are case-insensitive
	yield return GameModeManager.TriggerHook("RoundStart");

	// A healthy set of predefined keys is provided to make hooking on to them easier.
	// Predefined keys should be used in favour of custom ones when possible.
	yield return GameModeManager.TriggerHook(GameModeHooks.HookRoundStart);
}

Registering hooks

Mods can register hook listeners wherever they wish:

private void Init()
{
	// Hooks are called with the game mode that triggered the hook, which is always the currently active game mode
	GameModeManager.AddHook(GameModeHooks.HookRoundStart, this.OnRoundStart);
}

private IEnumerator OnRoundStart(IGameModeHandler gm)
{
	// Triggers are IEnumerators so they support yields
	yield return new WaitForSeconds(2f);

	UnityEngine.Debug.Log(gm.Name);

	/* Since triggers are IEnumerators, they must be executed within a coroutine. This means triggers are guaranteed to
	 * be able to disrupt the execution of the current game mode.
	 */
	gm.GameMode.StopAllCoroutines();
}

The existing game modes in ROUNDS, namely Arms Race and Sandbox, have also been patched to trigger hooks.

Settings

The framework also adds a setting system to help mods change common game mode settings easily. Settings provide an easy-to-use method for mods to change gameplay, but they place a lot of responsibility onto game modes to provide sufficient settings.

Using settings in a game mode

private void CheckPoints()
{
	if (p1Points >= (int)GameModeManager.CurrentHandler.Settings["pointsToWinRound"])
	{
		WinRound();
	}
}

Changing settings (in a mod)

private void Init()
{
	GameModeManager.AddHook(GameModeHooks.HookInitEnd, this.OnInitEnd);
}

private IEnumerator OnInitEnd(GameModeHandler gm)
{
	gm.ChangeSetting("pointsToWinRound", 10);
}

See /UnboundLib/GameModes for implementation details and example GameModeHandlers.

Development

Building the project is likely to work without having to change anything. However, if your ROUNDS installation resides in somewhere other than C:\Program Files (x86)\Steam\steamapps\common\ROUNDS, you will need to change the path we have pre-configured for you:

  1. Copy UnboundLib/UnboundLib.csproj.user.dist to UnboundLib/UnboundLib.csproj.user
  2. Change the ROUNDS installation folder path inside UnboundLib/UnboundLib.csproj.user

You can now open the project solution with Visual Studio, and you're set.

Available versions

Please note that the install buttons only work if you have compatible client software installed, such as the Thunderstore Mod Manager. Otherwise use the zip download links instead.

Upload date Version number Downloads Download link  
2023-1-24 3.2.6 32264 Version 3.2.6 Install
2023-1-1 3.2.5 25528 Version 3.2.5 Install
2022-12-30 3.2.4 2207 Version 3.2.4 Install
2022-12-28 3.2.3 2662 Version 3.2.3 Install
2022-12-24 3.2.2 6128 Version 3.2.2 Install
2022-12-15 3.2.1 9921 Version 3.2.1 Install
2022-12-15 3.2.0 197 Version 3.2.0 Install
2022-6-18 3.1.4 81998 Version 3.1.4 Install
2022-6-18 3.1.3 110 Version 3.1.3 Install
2022-6-14 3.1.2 4416 Version 3.1.2 Install
2022-6-13 3.1.1 940 Version 3.1.1 Install
2022-6-12 3.1.0 2098 Version 3.1.0 Install
2022-5-19 3.0.1 21246 Version 3.0.1 Install
2022-5-18 3.0.0 943 Version 3.0.0 Install
2022-5-14 2.11.2 3151 Version 2.11.2 Install
2022-3-19 2.11.1 34107 Version 2.11.1 Install
2022-3-18 2.11.0 3436 Version 2.11.0 Install
2022-1-11 2.10.2 44483 Version 2.10.2 Install
2022-1-6 2.10.1 6042 Version 2.10.1 Install
2022-1-2 2.10.0 5100 Version 2.10.0 Install
2021-12-28 2.9.0 4513 Version 2.9.0 Install
2021-12-26 2.8.2 1493 Version 2.8.2 Install
2021-12-26 2.8.1 108 Version 2.8.1 Install
2021-11-30 2.8.0 14243 Version 2.8.0 Install
2021-11-26 2.7.7 3533 Version 2.7.7 Install
2021-11-5 2.7.6 10849 Version 2.7.6 Install
2021-10-27 2.7.5 10321 Version 2.7.5 Install
2021-10-27 2.7.4 668 Version 2.7.4 Install
2021-9-29 2.7.3 19688 Version 2.7.3 Install
2021-9-26 2.7.2 2121 Version 2.7.2 Install
2021-9-7 2.7.1 8281 Version 2.7.1 Install
2021-9-3 2.7.0 2470 Version 2.7.0 Install
2021-8-31 2.6.2 1886 Version 2.6.2 Install
2021-8-28 2.6.1 1417 Version 2.6.1 Install
2021-8-23 2.6.0 2430 Version 2.6.0 Install
2021-8-11 2.5.1 7978 Version 2.5.1 Install
2021-8-11 2.5.0 510 Version 2.5.0 Install
2021-7-27 2.4.0 6658 Version 2.4.0 Install
2021-7-21 2.3.0 3612 Version 2.3.0 Install
2021-7-13 2.2.1 4446 Version 2.2.1 Install
2021-7-7 2.2.0 2828 Version 2.2.0 Install
2021-7-3 2.1.5 1920 Version 2.1.5 Install
2021-6-27 2.1.4 2092 Version 2.1.4 Install
2021-6-23 2.1.3 1296 Version 2.1.3 Install
2021-6-18 2.1.2 1074 Version 2.1.2 Install
2021-6-18 2.1.0 365 Version 2.1.0 Install
2021-6-14 1.1.2 504 Version 1.1.2 Install
2021-6-12 1.0.9 265 Version 1.0.9 Install
2021-6-11 1.0.7 77 Version 1.0.7 Install
2021-6-11 1.0.6 101 Version 1.0.6 Install