NetLib
A networking library for mods. Currently in beta and looking for feedback.
Last updated | 4 years ago |
Total downloads | 7052 |
Total rating | 1 |
Categories | Mods Libraries |
Dependency string | Rein-NetLib-0.0.3 |
Dependants | 3 other packages depend on this package |
This mod requires the following mods to function
bbepis-BepInExPack
Unified BepInEx all-in-one modding pack - plugin framework, detour library
Preferred version: 3.1.0README
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