GTFO
This package has been deprecated and may no longer be maintained. We recommend looking for an alternative.
Install with App

Details

Latest version
1.1.1
Last Updated
First Uploaded
Downloads
3.6K
Likes
2
Size
187KB
Dependants

Categories

Tags

Deprecated

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

Thunderstore development is made possible with ads. Please consider making an exception to your adblock.