BridgeNet | Insanely optimized, easy-to-use networking library full of utilities, now with roblox-ts! | v1.9.9-beta

Hi,

When I run the test below it does not show the correct values and returns a table for Val1 and nil for Val2 and 3.

What am I doing wrong?

23:06:25.493 plr CanterCrow - Server - BNet-Client-To-Server-SS:7
23:06:25.493 Val1 table: 0x986ee00f34d665e4 - Server - BNet-Client-To-Server-SS:8
23:06:25.493 Val2 nil - Server - BNet-Client-To-Server-SS:9
23:06:25.493 Val3 nil - Server - BNet-Client-To-Server-SS:10

–Local Script
local BridgeNet = require(game.ReplicatedStorage.Modules.BridgeNet)
BridgeNet.Start({})
local ClientRemoteLS = BridgeNet.CreateBridge(“Remote”)
while true do
ClientRemoteLS:Fire(“Val1”, “Val2”, “Val3”)
task.wait(1)
end

–Remote Script
local BridgeNet = require(game.ReplicatedStorage.Modules.BridgeNet)
BridgeNet.Start({})
local ClientRemoteSS = BridgeNet.CreateBridge(“Remote”)
ClientRemoteSS:Connect(function(plr, Val1, Val2, Val3)
print("plr " … tostring(plr))
print("Val1 " … tostring(Val1))
print("Val2 " … tostring(Val2))
print("Val3 " … tostring(Val3))
end)

1 Like

Apologies for this- this is due to an oversight I missed in testing. This will be fixed in 2.0.0-rc4, which should come out soon-ish (I would say within 2 days or so). I’ve been working pretty hard on it.

This is very interesting and cool, but is there a tutorial on this? Sorry, I’m not that great at scripting and don’t know a lot about this stuff.

Will there be some way of deciding the data type in Declare? Apparently you can get way better results doing stuff like encoding ints from 0 to 255 as bytes, as well as big savings from obscure data types like Vector3int16. It would be great if there was functionality for this.

There’s functionality planned, however this is separate to RemoteEvents- I plan on creating an abstraction for string.pack

I’m working pretty hard on 2.0 which is already jam-packed with improvements, so this likely won’t come soon.

2.0.0-rc4

Reminder- rc stands for release candidate. This version, and this module, are unstable. It’s available on the Roblox marketplace, and on Wally under ffrostflame/bridgenet@2.0.0-rc4. I will be updating the roblox-ts port when 2.0.0 fully releases.

  • Unpacked arguments on server receive (Thank you @MELON-Om4r)
  • Fixed numerous queue-related bugs
  • Invoke UUIDs are now packed for less network usage (34 bytes → 18 bytes)
  • The Identifiers function is a closure again
  • Added outbound middleware
  • Added middleware to the client
  • Middleware now passes in the plr argument on the server
  • Overall middleware improvements
  • Client-sided improvements w/ connections
  • Added .GetQueue() for debugging purposes
  • General improvements to client receive
  • Temporarily removed warning signals until I can figure out a better way to add them, they’re kind of a mess right now.
  • Removed config symbols
  • Removed logging features- it turns out I forgot to fully implement them, plus nobody used them.
  • Removed BridgeNet.Start(), the module now runs when you require it for the first time.
  • Removed :InvokeServer()
  • Removed both dependencies

I’m very happy with the current state of BridgeNet. This update should help accessibility and usability across architectures, and it also significantly speeds up development. I will be releasing 2.0.0 likely soon.

1 Like

I keep getting this error everytime I try to run my code:

  14:26:38.266  Infinite yield possible on 'ReplicatedStorage:WaitForChild("AutoSerde")'  -  Studio
  14:26:38.266  Stack Begin  -  Studio
  14:26:38.266  Script 'ReplicatedStorage.Utils.BridgeNet.SerdesLayer', Line 38 - function _start  -  Studio - SerdesLayer:38
  14:26:38.267  Script 'ReplicatedStorage.Utils.BridgeNet', Line 73  -  Studio - BridgeNet:73
  14:26:38.267  Stack End  -  Studio

The code:

Client:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local BridgeNet = require(ReplicatedStorage.Utils.BridgeNet)

local Remote = BridgeNet.CreateBridge("Remote")

Remote:Connect(function(stringA, stringB)
	print(stringA .. stringB) -- Prints
	-- Hello, world!
	-- Hello, someone!
end)

Server:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local BridgeNet = require(ReplicatedStorage.Utils.BridgeNet)

local Remote = BridgeNet.CreateBridge("Remote")

while true do
	Remote:FireAll("Hello, ", "world!") -- Fires to everyone
	Remote:FireTo(game.Players.Someone, "Hello, ", "someone!") -- Fires to a specific player
	task.wait(1)
end

It seems the roblox model that you can get on the marketplace is currently broken, I downloaded the latest relase from the github and that worked. One last problem though, it only starts working when you call bridgenet.Start(), I thought it does that automatically when you require the module for the first time? I made sure I’m using the 2.0.0 release btw.

ehm, .Start is literally not in the code. I think I might’ve uploaded the wrong version?

Could you take a screenshot of the BridgeNet modulescript itself? It should look like this:
image

Sure, here you go:
image

Yep, outdated version. It should be fixed.

oops.

1 Like

Hi, with the most recent version of bridgenet, anything I run does not work.

I tried using my own code and the example code from the documentation, both return 2 errors.

attempt to call a nil value

From both the client and the server.

Not sure if this would be classified as a bug or I am doing something wrong, so decided to post here instead of making an issue on github

1 Like

This is most likely because you’re using the .Start() functionality it previously had, which is now removed and it works as intended on require. Exact same error I got, tripped me up for a sec cuz the docs were outdated lol

2 Likes

yeeep. I will be updating the docs when 2.0.0 fully releases.

And likely adding this as a warn message lol

1 Like

This is the first time I have actually had time to test BridgeNet’s capabilities, and the results are astonishing.

2-3KB receive on the server (using packetprofiler) and 50+ ping on the client while replicating 128 NPCs’ position per frame without implementing any additional optimization than what’s already provided.

2 Likes

i’m curious- can you try doing the same test with a 20hz replication rate? you should be able to just do Bridge:SetReplicationRate(20)

Most of the time, the packet size is 2840 bytes…
image

… and rarely it is 5680 bytes
image

and the ping is 50ms+ (50 → 60 to be specific)

However, when I ran the test again with replicationrate as 60hz, the results were the same. I will test both 20hz and 60hz using robloxs’ performance tab instead to double check accuracy.

EDIT:
I had maxRatePerMinute as 60 during the whole tests, so does it matter?

I don’t think maxRatePerMinute should matter- rate limiting is not added yet.
20hz should compress it more and have slightly less data size- could you print .GetQueue every heartbeat?

Do you mean ._returnQueue? I have 2.0.0-rc4 and that’s probably why I don’t have it.