ByteNet | Advanced networking library w/ buffer serialization, strict Luau, absurd optimization, and rbxts support. | 0.4.3

ByteNet

Simple, buffer-based networking.

GitHub | Documentation | npm

ByteNet is an networking library which takes your Luau data, and serializes it into buffers. On the other end, ByteNet deserializes your data, and then feeds it back to your Luau code. You don’t need to worry about type validation, optimization, packet structure, etc. ByteNet does all the hard parts for you! Strictly typed with an incredibly basic API that explains itself, ByteNet makes networking simple, easy, and quick. There’s very few concepts you need to grasp in order to use ByteNet; it has an incredibly minimalistic & simplistic, yet powerful API.

Installation

You can install ByteNet on Wally, or through the latest release’s .rbxm file.

Performance

ByteNet performs incredibly well compared to non-buffer based libraries like BridgeNet2. This is because ByteNet has a custom serializer that takes your Luau data and transforms it into a buffer, sending that and deserializing it on the other side.

Further contact

You can contact me directly under the ByteNet thread in the Roblox OSS Server.

License

This project is under the MIT license! so, it’s open source.

95 Likes

version 0.1.1

Improvements

  • General code improvements/optimizations across the board. Will get more specific as time goes on
  • Added roblox-ts support (have not published to npm yet)

Fixes

  • Fixed a basic spamming vulnerability

This seems interesting. Currently the network library I’m using (Red) doesn’t support unreliable remotes. I find the method of defining Packet objects a little odd, I feel it would be better to name them something like “channels” or “ports” since from what the documentation states, that is what they seem to behave like.

The one issue I have with it is that while it can be useful for sending serialized information in a compact way, it seems impossible to have a key value pair where the value is a table, and because of that I don’t see this as a general purpose library. I imagine you could do arrays or dictionaries in the buffers somehow since it would be similar buffer allocation to how I imagine you allocate space for strings, since the strings could be any length.

4 Likes

I don’t see a single use case with ByteNet. Do you know any?

1 Like

it does on new version. (3-0 chars igrone)

1 Like

It is the only buffer-based networking library on Roblox currently

1 Like

it’s basically a library for reducing network bandwidth, it compresses data (serializes) before sending it over to the network, and once it arrives it is then decompressed to be read by scripts.

It’s very useful for when you need to be sending data every frame, even more useful for unreliable remotes since they have a 900 byte limit per packet.

4 Likes

Sick, now we have loads of different libraries for people to chose!

  • Bridgenet2
  • Red
  • FastNet2
  • ByteNet
1 Like

That isn’t a use case


I usually have bad network from Etisalat by e&, so I don’t know if it will help

I think sending data every frame causes memory leaks, also I don’t really use unreliable remotes, the only one I have is the SetLookAngles which is meant for MaximumADHD’s Realism

1 Like

The use case is extreme optimization.


image
This is Roblox, sending a number and a string, 200 times a frame.


image

This is ByteNet’s serialization, using a uint8. It’s not even a fair comparison, ByteNet is sending outright way smaller data because it gives you way more control.

19 Likes

version 0.1.2

Fixes

  • Fixed not all data types being accessible
  • Fixed absolute references being used instead of relative references, thanks auto-import…

version 0.1.3 (Oops)

Fixes

  • Fixed not all data types having types

Hi, im interested in using your module because of the unreliable remotes. Could you maybe tell me how this is superior to BridgeNet2 or FastNet2? My usecase would be lots of remotes every frame for replication (CFrame related). And is this game-ready?

2 Likes

I’d say this is weird since this is made by the creator of BridgeNet2

No, Buffers are a beta feature and are not a released thing [this module uses buffers]

image

1 Like

@ffrostfall Great library, love the implementation; some of the best net optimisations i’ve seen for rblx
Do you have any ETA for a roblox-ts NPM package for this, would love to use it in a project of mine, but i dont want to ditch rbx-ts.
An NPM package would be heavenly

So instead of working on the BridgeNet2 update (assuming)… he been cooking this. Interesting.

6 Likes

Can we send table with this module?

How does it compare against Bridgenet2 though?

What are you trying to send in a table that you can’t send after looking at the example?

Uhm what I mean is in the example

local myPacket = ByteNet.definePacket({
    textField = ByteNet.dataTypes.string,
})

dataTypes must be defined. But let’s say I want it to be anything? How to do it?

local data = { Type: 'abc', Value: 'bcd' }
Packets.abc.send(data)

But also can be

local data = { Type: 'bcd', Value: 123 }
Packets.abc.send(data)

You’re not doing it correctly. You need to use :send not .send
Also, you’re not even defining the packets correctly. Look at the examples given: