Kasuromi-Nidhogg icon

Nidhogg

Nidhogg is a networking event API for GTFO

Last updated 2 weeks ago
Total downloads 265
Total rating 2 
Categories Libraries
Dependency string Kasuromi-Nidhogg-1.1.0
Dependants 1 other mod depends on this mod

This mod requires the following mods to function

BepInEx-BepInExPack_GTFO-1.3.0 icon
BepInEx-BepInExPack_GTFO

BepInEx pack for GTFO. Preconfigured and includes Unity Base DLLs.

Preferred version: 1.3.0

README

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

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  
2021-8-31 1.1.0 237 Version 1.1.0 Install
2021-8-23 1.0.0 28 Version 1.0.0 Install