Wow, this is amazing. Love it man and we appreciate the work you’ve done to release Red to the community.
Is there any plans to move this over to a multi-remote system rather then the single RedEvent
system you currently have?
No, this is what creates performance benefits for Red. We pack events into a single call which has been proven to lower bandwidth usage.
By the looks of it, the code seems pretty neat. Hoping to be glad when I use it, good job!
Very good networking library been using it in my personal projects for a bit now from the OSS community.
I believe I made a mistake while doing the math and looking at the code, mainly in that Red has some form of single-character remote identifier system or something. I’m too lazy to try and look at the actual data it’s sending through the remote, so I will just say that whatever is below probably isn’t correct and may be inaccurate EDIT TO THE EDIT: THE INFORMATION BELOW IS COMPLETELY INACCURATE DONT LISTEN TO A WORD I SAY I AM WRONG DONT READ THIS RED IS PROBABLY AN PRETTY GOOD NETWORKING LIBRARBY.
Original reply that Pyseph responded to
Can I see a benchmark?
According to a thread from June of last year, RemoteEvents carry an overhead of 9 bytes just by firing them, and adding a string identifier costs length of string + 2 bytes
.
So, given the example, using Red to fire an event like so:
local Net = Red.Server("Server")
Net:Fire(Player, "MyEvent", "Hello")
Fires the event with the arguments:
"Server_MyEvent", "Hello"
So, “Server_MyEvent” is 14 characters, plus 2 identifier overhead is 16 bytes, “Hello” is 5 characters, plus 2 is 7 bytes, added together that’s 16 + 7 = 23 bytes, plus 9 from the overhead of firing the remote is 32 bytes in total from the above for a single Net:Fire
, if my math is correct.
Whereas, using a separate RemoteEvent
instead of using one and requiring a string identifier leads to a :FireClient
call taking, “Hello” is 7 bytes + 9 bytes from overhead, 16 bytes in total, exactly half of what is needed for the same effect using Red.
Maybe my math is wrong, but it just doesn’t add up in my head.
Have a question. Do I create just 1 namespace for the entire server, or create different namespaces for different purposes like holding player data, weapon firing and stuff, menu interaction etc.?
Do whatever is easiest for you
multiple namespaces is the intended way
I believe Red only offers better optimization when multiple remotes are sent or received during the same frame, which I’d argue is misleading and not as useful as one would first imagine it to be. It’s only efficient when packing multiple calls into one, since multiple strings are combined into one and thus the string size overhead becomes negligible compared to using multiple remotes.
It’s not often multiple remotes are sent during the same frame, which means it could instead downgrade performance from what I understand.
Big vouch! its the good networking library.
Now I have to rewrite my whole game and replace it with this library
Hey. I’m the person that made that thread, and the person who made the bandwidth-saving method that Red uses.
This is incorrect because Server_MyEvent
is never fired. Server_MyEvent
is created into the identifier.
Yes, kind of, but if you call it more than once per frame it saves bandwidth and time. That’s the point of Red.
But where are the benchmarks for comparison
I forgot to put this in the original post, but Red has a testing place where you can view the performance yourself with several different options. The code to this place is on the repo in the test
folder.
Thank you for that Uncontained
I’ma be honest, I think a nice chart, with results tested by you would be better.
It could be, but I lack the time or motivation to make that right now.
damn, this is good! would love to try this out and maybe fully integrate it into our current project.
Hi, I’m trying to integrate this library into my project. Since I am well used to using standard Roblox Remote events. Usually, I disconnect all of my remote connections when I don’t need them anymore.
What is the right way for this when I don’t want to listen event from Net:On(“event”) anymore?
Thanks!
And for some reason using Net:Call("Event")
on the client won’t work?
Net:Fire("Event")
works indeed.
I set it up like this to test the call method
Server:
Net = red.Server("BoxMechanicEvents", {"TestEvent"})
Net:On("TestEvent", function(player, message)
return message
end)
Client:
Net = red.Client("BoxMechanicEvents")
local message = Net:Call("TestEvent", "Test Message")
This is the error and it’s been firing every frame from the Clock Util module
Can’t figure out what am i missing.
EDIT:
I have tested it on an older version of Red (1.0.0) and it works completely fine now. Haven’t tested it on (1.1.0) yet.
I think this is a bug?
dynamically assigning events is a memory leak in red, you should never stop listening to them