superceded
BridgeNet
Typescript
Description
BridgeNet is a networking library bundled with features to make optimizations easier, alongside optimizing remote events itself. It also has numerous features such as :FireAllInRange
, and :FireToMultiple
.
Documentation
Documentation here.
Benchmarking / Performance
This performed way better than I expected it to. Test was run w/ 200 blank remote calls sent per frame.
BridgeNet 63 KB/s average:
Roblox, 110 KB/s average:
Test code is in the github repository.
Why should I care about the amount of data being sent/received?
Because that’s integral to your game’s performance. Less data and calls means lower frame times, lower ping, easier for players with packet loss & bad connections, and overall a better experience. Although, I think that the best way to put it is this. If you have a player cap on your game of 50, and each player is receiving 100 kilobytes per second, that means your server is sending 5000 kilobytes per second. 5000/1000 (kilobytes in a megabyte) is 5, which means you have 5 megabytes being sent out per second. Now, we all know Roblox servers are suboptimal compared to your average dedicated game server. And 5 megabytes… isn’t that much nowadays, right?
Well, in the networking world, megabits are used to measure things like speed. One megabyte is 8 megabits, and things like speedtest.net use megabits (abbreviated as Mb). So, if your internet upload speed is 40 megabits per second, that means running your computer as a server for your Roblox game would result in your entire bandwith being taken up.
(Take this with a grain of salt. I’m not 100% sure why BridgeNet performs better here) So this other thing that BridgeNet does better is ordering. When Roblox sends out packets, it waits to make sure it’s done in all the right orders. I expected BridgeNet to not play nicely with packet loss, but I suppose I am incorrect. I’m pretty sure this is because Roblox orders each remote event individually, so when one doesn’t play nice / gets sent earlier or before, it stops and waits before resuming networking. So the more RemoteEvents that are fired / received, the higher the probability is it stops and waits. With BridgeNet, since it’s one remote call per frame, this isn’t an issue. Roblox already sends packets out per frame, so the big packets aren’t an issue.
This makes 100% sense, and this test proves it, but I’m making an explanation for the results, not the other way around. This is my so to say, very educated guess.
Roblox Remotes
BridgeNet
Features
- Easy-to-use utility features such as
:FireAllInRange()
,:FireAllExcept()
,:FireMultiple()
- Dynamically create/destroy “remote events” with ease
- Configure the rate of which remotes send and receive information
- Serialization of RemoteEvents for optimization
- Using compressed ID strings to reduce the amount of data each remote call takes, mimicking multiple remote calls.
- Utilities to compress the data you’re sending over such as
.DictionaryToTable
, and.PackUUID
- Incredibly easy optimization beyond what’s already provided
- No direct interaction with instances, that’s all abstracted and wrapped away.
- InvokeServer (returns a Promise) and InvokeServerAsync allow for “RemoteFunction” usability with promises
- roblox-ts support!
Goals
- Make optimization easy, but manual. Don’t intrude on the developer where they don’t expect it, but give them the tools to optimize.
- Keep a simple and human-readable API while still retaining functionality of other net tools.
- Make all functionality extra- you don’t need to understand middleware in order to use the module, but if you do, you can use middleware.
If your game starts using BridgeNet, please let me know! The amount of people using BridgeNet lets me realize how battle-tested it is and helps me develop the module. It also helps me know when to fully release!
On the topic of networking, reliablity types are a must.
Due to Roblox’s RemoteEvents being reliable and ordered, it can make systems like head rotation systems cause tons of lag and take up a bunch of unused bandwith. It also means any custom humanoid system like Chickynoid will be less effective than if this feature existed.
This feature would improve the Roblox platform tremendously if added, and I ask you all to support this feature. If this is added, I can assure you BridgeNet will immediately update to have streaming data support.
The lack of this feature is a direct roadblock to many MMOs. It’s one of the biggest roadblocks on the platform right now. Please- take your time and show your support.