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

Details

Latest version
0.0.3
Last Updated
First Uploaded
Downloads
7.2K
Likes
1
Size
18KB
Dependants

Categories

Tags

Deprecated

NetLib is a networking library for mods. Currently beta and looking for feedback.

For Users:

Install:

  • Download
  • Open the Zip file
  • Locate NetLib.dll inside the zip
  • Right click on it and select copy
  • Navigate to RoR2 directory
  • Open the BepInEx folder
  • Open the Plugins folder inside BepInEx
  • Right click, click new, then folder
  • Name the folder NetLib
  • Open the folder
  • Right click, and select paste
  • You're done

Uninstall

  • Navigate to RoR2 directory
  • Open BepInEx folder
  • Open the plugins folder
  • Locate either NetLib.dll, or the NetLib folder and delete them
  • You're done

Bug reporting

If you see errors or bugs of any kind please create an issue on github, or you can DM me on discord (@Rein#7551)

For Developers:

What does it do?

There are three major functionalities offered by NetLib:

Framework

NetLib offers a framework for sending messages over network. The framework is heavily styled after UNet (the style of networking present in base game) with a few key differences:

  • Uses a single message index for all messages (Helps ensure mod interoperability)
  • Forces proper structure of messages through inheritance
  • Simplified process for sending the messages
  • Catches most errors before they reach game code

BuiltIns

In addition to the framework, NetLib also offers built-in implementations of commonly used networking functionality. These BuiltIns are wrapped in a single static method. The BuiltIns are also heavily commented and documented, and serve as a good way to get started with writing a custom message type. There are two (and a half) BuiltIns currently:

  • ExampleTest, which is really just a debugging message that enters a message into chat over network.
  • SendBuff, which allows a client to send a message to server to add or remove buffs from a body.
  • SendDamage, which allows a more flexible way to send damage to server than BulletMessages, in that you can choose what parts of the damage process occur.
  • SendDoT, which allows a client to tell host to apply a DoT to a target.

How to use

Using BuiltIns:

  • Add: a reference in your project to NetLib.dll
  • Add: [BepInDependency( NetLib.NetLib.guid, BepInDependency.DependencyFlags.HardDependency )] to your plugin attributes
  • Add: Dependency to your manifest
  • Add: using NetLib; to your usings in the script(s) that need to use them.
  • Add: Logic to your code that will make sure that all clients aren't executing the function. typically: if( something.isAuthority ) SomeBuiltInFunc();
  • You're done.

Writing custom messages:

  • See the various built-ins for examples.

Changelog

0.0.3

Breaking Changes

  • Removed the Extensions as Hopoo was kind enough to make them accessible to us.

0.0.2

  • Some general cleanup for artifacts update
  • Added SendDoT

Breaking changes

  • N/A

Changes

  • Fixed major bugs in extensions for DamageInfo and ProcChainMask (They also will perform better since the expressions are compiled load time instead of on first use)
  • Some internal stuff for allowing extensions to do things on plugin constructor (Like caching methods)

0.0.1

Breaking changes

  • N/A

Changes

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