Is BridgeNet2 really THAT helpful?

Hey everyone, I’ve been pondering network efficiency lately, and it seems that the go-to choice for many is BridgeNet2. I’ve delved into the documentation and start tests, but in my tests, it hasn’t proven as useful as I’d hoped.

Test details

I have waited 5 seconds on server before player added.

Bridge Net
  • server
local player = game.Players:GetPlayers()[1]
local bridgeList = {}
for i = 1, 100 do
    table.insert(bridgeList, BridgeNet2.ReferenceBridge("myFirstBridge"..i))
end
while task.wait() do
    for i = 1, 100 do
        bridgeList[i]:Fire(player, {
            message = "hello world",
            test = {a = 1, b = 2, c = 3}
        })
    end
end
  • client
local BridgeNet2 = require(Replicated.Packages.BridgeNet2)
for i = 1, 100 do
    local b = BridgeNet2.ReferenceBridge("myFirstBridge"..i)
    b:Connect(function()

    end)
end
  • result 422.54kb/s
    image
RemoteEvents
  • server
local player = game.Players:GetPlayers()[1]
local folder = Instance.new("Folder")
folder.Name = "Events"
folder.Parent = Replicated
local eventList = {}
for i = 1, 100 do
    local r = Instance.new("RemoteEvent")
    r.Name = "RemoteEvent"..i
    r.Parent = folder
    table.insert(eventList, r)
end
while task.wait() do
    for i = 1, 100 do
        eventList[i]:FireClient(player, {
            message = "hello world",
            test = {a = 1, b = 2, c = 3}
        })
    end
end
  • client
local events = Replicated:WaitForChild("Events")
for i = 1, 100 do
    local r = events:WaitForChild("RemoteEvent"..i)
    r.OnClientEvent:Connect(function(message)

    end)
end

  • result 453.47kb/s
    image

The server attempts to send 100 events with a standard data table every tick, but the results are not as distinct as expected. Does the size of 30kb really matter to anyone?

Perhaps there are some aspects I overlooked, such as the non-scientific nature of my testing. Can anyone share their opinion? Thank you very much.

6 Likes

You can test it in your own place using my codes, but you have to install BridgeNet2 first

2 Likes

i dont think anything is going to optimize ~6000 remotes per second and i dont think anyone is ever going to be using that much just use normal events

2 Likes

Yeah, you are right. I was just testing an extreme scenario. The topic of my post is whether BridgeNet2 can optimize 70% to 80% as stated.

1 Like

it will only optimize like 2% in an actual game since it sends all remotes at once (less overhead overall)

1 Like

Okay, but it seems like I don’t need to install BridgeNet into my framework.

1 Like

No, you don’t need it, but you might want it. The performance aspect is great, but the actual highlight is that it abstracts a lot of annoying aspects of remotes, while keeping it advanced enough. The key reason I use libraries like these is being able to fire multiple select players and not all players without using loops.

5 Likes

No library can stop you from writing unperformant and unoptimized code. Looking at BridgeNet2, it seems to be more focused on events with a small amount of data being sent very often, thus it cuts out some of that data out to reduce overall data size, seemingly by packaging it all up into a single RemoteEvent with a cost of 9 bytes, instead of the 9 bytes being multiplied by the amount of events.

Therefore, I think the best test would be to try this on a real game that is sending a wee bit too much data per second (I’ve heard that things break down at 80kb/s, with the data sent in RemoteEvent clogging up the queue for things like physics or other instance replication), instead trying to bruteforce a ton of data and expecting it to be the end-all be-all.

As far as I can tell, you haven’t tested the part where the alleged “75%-80%” optimization comes from

You are just sending huge amounts of data, when that isn’t where the percentage is coming from. It’s coming from how long it takes for the data to get to your code after being received by the engine.

Some frameworks/libraries/whatever aren’t going to be useful to everybody, they fit a specific niche that, likely, the author of the library would find useful in their own projects. Just because a library is “good” doesn’t mean you have to use it, and neither is it mediocre just because you couldn’t find a use for it. I personally don’t use it because I don’t feel the need to, but clearly other people value it.

4 Likes

Oh, thank you very much, I just noticed my error, but the pictures in that post caught my eye. Can these pictures be real? I was testing the same aspect, but it didn’t turn out like the pictures.

2 Likes

they are real since its pretty much 1 remote vs 200 remotes

1 Like

I think so, the math seems to work out. The formula would be (packet size for an event) x (number of events) x (number of frames in a second). Remotes have a default of 9 bytes overhead, there are 200 events, and, by default, Roblox runs at 60 FPS, resulting in:

9x200x60

bytes per second, or 108000 bytes/s. Converting that to kilobytes per second (kb/s with division by 1000) gives us 108kb/s, which seems close enough.

Then, with BridgeNet, it’s just 9x60, as there’s only one RemoteEvent, which is 540 bytes/second or… 0.54 kb/s? There’s seemingly an overhead of 26 kb/s from Roblox itself, I suppose some of it is lost when under high stress to explain the difference in the first image.

3 Likes

Now I see, the cost of remote events didn’t have a huge impact, but the data I passed had the most influence.
I learned a lot, thank you.

2 Likes

By the way, how to know Remotes’ default cost? I am curious

2 Likes

I gave a hyperlink in my first post, it’s an unofficial measurement:

By the creator of this resource:

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.