Red - A simple, fast, and powerful networking library

This post is for Red 1.x. To view the latest version of Red, please go here

Red

A simple, fast, and powerful networking library.
Github | Releases | Documentation

What is Red?

Red is a networking library for Roblox that combines a good structure with blazing fast performance to provide a good developer experience. Red is suitable for any project, from tiny experiments to large-scale games.

Structure

Red allows the developer to use whatever structure they’d like. However, Red also has it’s own recommended structure that enforces good practices and creates more performant code.

Performance

Unlike many other networking libraries, which very simply wrap around Remote Events and Functions, Red uses a single Remote Event and identifiers to pack remote events and functions into a single call. This event packing allows Red to use much less bandwidth than normal Remote Event usage. This saved bandwidth comes at a minimal performance cost, and is often faster than other libraries because of it’s simplicity.

To view benchmarks yourself, Red has a testing place. Here you can view the differences between Red and normal Roblox networking in many cases. Red Testing - Roblox

Developer Experience

Red uses Luau, and is internally typed completely in strict Luau. This creates full autocomplete and type checking for the developer. The Red API is very simple and easy to use, and it fits seamlessly into any project. Red is boilerplate free, there is no setup process.

Examples

local Red = require(Path.To.Red)

local Net = Red.Server("NamespaceName")

Net:On("Message", function(Player, To, Message)
	Net:Fire(To, "Message", Message)
end)

Net:On("MessageAll", function(Player, Message)
	Net:FireAllExcept(Player, "MessageAll", Message)
end)
local Red = require(Path.To.Red)

local Net = Red.Client("NamespaceName")

Net:Fire("MessageAll", "This is pretty red!")

Getting Started

Head over to the documentation to install and get started!

90 Likes

Recommending this library over Bridgenet or any other networking alternative I’ve seen, no offense to anyone, but the dude’s been keeping it up to date and has the best docs so far. Plus, he’s super active in the Roblox OSS Community. Haven’t tried it in production yet, but no bugs popped up when playing with like 5-15 people. Since I’ve been using this, I can tell it’s better than normal, but can’t say by how much. Haven’t checked it against normal Roblox networking, but I trust the benchmarks done already.

16 Likes

Wow, this is amazing. Love it man and we appreciate the work you’ve done to release Red to the community.

4 Likes

Is there any plans to move this over to a multi-remote system rather then the single RedEvent system you currently have?

2 Likes

No, this is what creates performance benefits for Red. We pack events into a single call which has been proven to lower bandwidth usage.

2 Likes

By the looks of it, the code seems pretty neat. Hoping to be glad when I use it, good job!

2 Likes

Very good networking library been using it in my personal projects for a bit now from the OSS community.

2 Likes

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.

2 Likes

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.?

2 Likes

Do whatever is easiest for you

multiple namespaces is the intended way

5 Likes

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.

3 Likes

Big vouch! its the good networking library.
Now I have to rewrite my whole game and replace it with this library :sob:

3 Likes

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.

3 Likes

But where are the benchmarks for comparison

3 Likes

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.

1 Like

Thank you for that Uncontained

1 Like

I’ma be honest, I think a nice chart, with results tested by you would be better.

1 Like

It could be, but I lack the time or motivation to make that right now.

1 Like

damn, this is good! would love to try this out and maybe fully integrate it into our current project.

2 Likes

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!

1 Like