Last updated | 2 years ago |
Total downloads | 3211 |
Total rating | 2 |
Categories | Libraries |
Dependency string | Kasuromi-Nidhogg-1.1.1 |
Dependants | 6 other packages depend on this package |
This mod requires the following mods to function
BepInEx-BepInExPack_GTFO
BepInEx pack for GTFO. Preconfigured and includes Unity Base DLLs.
Preferred version: 1.3.0README
Nidhogg - a networking API for GTFO
An API for plugin developers to implement networking between players.
This plugin is not meant for Rundown developers. It's an API for plugin developers
Example
Everything is exposed by the NetworkingManager
class. You need to create a marshallable struct that will be used to pass data between clients.
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ExampleEventData {
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 101)]
public string ExampleText;
public uint ExampleNumber;
}
In order for Nidhogg to be able to send and receive events, they must be registered.
NetworkingManager.RegisterEvent<ExampleEventData>("Nidhogg_Example", (senderId, packet) =>
{
// This action will be invoked whenever the current user receives the event
Log.LogInfo($"Example received from {senderId}: {packet.ExampleText}. {packet.ExampleNumber}");
});
Now that we have registered our event, we can invoke it with the data we want other users to receive
NetworkingManager.InvokeEvent<ExampleEventData>("Nidhogg_Example", new ExampleEventData
{
ExampleText = "Hello world!",
ExampleNumber = 12345
});
The receiver will log Example received: Hello world!. 12345
to the console.
Notes
Due to how the internal protocol is made, every player must use the same version of the plugin.
This plugin is not meant for Rundown developers. It's an API for plugin developers