BurstsOfRain
ALPHA RELEASE: Burst Assembly Loader and Redistribution of specific Unity.DOTS libraries.
Screenshots 3 screenshots
About this mod Author’s original text
Bursts of Rain
Bursts of Rain is a lightweight assembly loader that's used to load Burst compiled unity assemblies, allowwing for the usage of Burst-Compiled Jobs within mods for Risk of Rain 2.
To allow for the full utilization of the Data Oriented Technology Stack (DOTS)'s systems, this Package redistributes the following unity assemblies, which are not found within the base game:
| Assembly | Unity Package Version |
|--|--|
| System.Runtime| Not Applicable |
| Unity.Burst | 1.8.18 |
| Unity.Collections | 1.5.1 |
| Unity.Mathematics | 1.2.6 |
These assemblies should not cause issues on existing profiles.
For Developers
Bursts of Rain is used mainly as a front-end and ease of loading for Bust Assemblies utilizing `BurstRuntime.LoadAdditionalLibrary's method, BurstsOfRainMain contains a method that can be used to simplify this process, by giving it your PluginInfo, which serves as the start location, and a string`, which should be the name of the bursted assembly.
//Example
public class MyModWithBurstedAssemblies: BaseUnityPlugin
{
private void Awake()
{
//Load the assembly named "MyMod_Burst.dll" onto the Burst Runtime
BurstsOfRainMain.AddBurstAssembly(Info, "MyMod_Burst.dll");
}
}
Below are the main entries for each of the unity packages this package redistributes, alongside a brief description:
| Package | Description |
|--|--|
| Burst | Burst is a compiler that translates from IL.NET bytecode to highly optimized native code using LLVM. |
| Collections | A C# collections library providing data structures that can be used in jobs, and optimized by Burst compiler. |
| Mathematics | Unity’s C# SIMD math library providing vector types and math functions with a shader like syntax. Methods within are Job Safe |
While not redistributed by the mod since its part of the Core module, an understanding of the Jobs System is also required.
Development of Mods using Burst
Development of mods utilizing burst follows very similar procedures as regular Burst-centered job development, utilization of Data oriented programming is recommended over Object oriented programming to allow for the full utilization of the Jobs and Burst system, an example on how to "Burstify" a complex behaviour can be found in this Github Repository, courtesy of Nebby.
Utilizing ThunderKit as your main mod development environment is recommended, as there you can utilize the direct packages of Burst, Collections and Mathematics.
Burstifying an Assembly
Burstifying an existing assembly is done utilizing the `BCL.exe file found within the Burst package, specifically in Burst.Runtime`
For more information on how to utilize the `BCL.exe` file directly, look below at the "Non ThunderKit" section.
ThunderKit:
For burstifying your assembly utilizing the ThunderKit development environment, it is recommended to utilize the RoR2ThunderBurster package, which contains the following utilities for deploying your bursted assemblies
- Import Extension: for ensuring the installation of Burst, Collections and Mathematics.
- `BurstAssemblyDefinitionsDatum: A subclass of ThunderKit's AssemblyDefinitions` manifest datum, which is used to mark that the Assembly Definitions within should be passed thru the Burst Compiler if possible.
- `BurstStagedAssemblies: A custom PipelineJob that requires a BurstAssemblyDefinitionsDatum`, it utilizes reflection to enqueue and compile the selected assemblies with BCL, mimicking as close as possible the actual compilation of Bursted Assemblies when a Player is Built.
Replacing your `Manifest's AssemblyDefinitions datum with a BurstAssemblyDefinitionsDatum, and running a BurstStagedAssemblies job after a StageAssemblies` is enough to burst-compile your assembly.
Non ThunderKit:
To burstify an assembly without ThunderKit you'll need to get access to the internal Burst compiler (BCL.exe), a download of the package can be found in this website: ` altern
Install & use Install: BepInEx plugin
- The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
- Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
- Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
- Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.
Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file.
Install these first, or the mod will not work: