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

I am sending player inputs whenever the user presses a key.
If I want to replicate the player’s position to the server, I am just giving the network ownership to the client.

Yes, I am rendering the character’s head on every Frame but I am sending them to the server like in every 0.3-0.5 seconds.

I wonder if I still need to use this module

0.4.0

Added

  • Namespaces have been added.
  • Structs have been added.
  • Three new data types: Instance, unknown, and nothing. The “nothing” type is to allow for packets without any contents.
  • Added wait() to packets.

Improvements

  • Arrays are now forced to have number indexes
  • Packets are now based off closures, instead of metatables. This means you now have to use . indexxing instead of : to call methods.
  • You can now have duplicate packet contents
  • Packets now take a single value (Which can be a struct) instead of being “special”.
  • Significant optimization: Packets are now singular values that can be structs, which reduces complexity, thus increasing performance.
  • Buffers are now reused, preventing resizing from being necessary. This should result in massive performance gains.

Fixes

  • Added sendTo() to the Packet type. This fixes autocomplete.
1 Like

I just started using this networking library and it’s great, thank you for the resource. Are there any plans to introduce defining specific instance types instead of just Instance?

Also is it possible to focus on error handling in the next release? Everytime I get an error my console either gets spammed and/or the error doesn’t help me figure out what I’m doing wrong.

Edit: the error I posted above is a bug, using the float64 type causes this issue.

1 Like

0.4.1

Improvements

  • ByteNet now loops through existing players incase the package was initialized late

Fixes

  • Fixed the float64 data type

0.4.2

Fixes

  • Fixed sending unreliable events from client → server

Hi
I get the following error:


packet module:

return ByteNet.defineNamespace("messaging", function()
	return {
		NPC_ControllerPos = ByteNet.definePacket({
			-- This value field is very important!
			value = ByteNet.struct({
				id = ByteNet.uint16,	-- values from 0 to 65536-1 (more than enough for NPCs)
				pos = ByteNet.vec3,
			})
			--reliabilityType = "unreliable",
		})
	}
end)

Only errors if I call this:

ByteNetPackets.NPC_ControllerPos.sendTo({ id = self._id, pos = self._currentCFrame.Position }, v)

Also do you think you can fix the issue where the combined UnreliableRemote packets are >900B?

Thanks.

Can you show me the code where you listen to the packet?

Okay thanks, I didn’t notice that API also changed from a colon to a dot.

Doesn’t work with UnreliableRemotes though.

Are you on 0.4.2? That was a bug fixed in the latest version

Yes latest version, but I mean the issue where it puts the packets together to a single packet that is >900B large.

ByteNetPackets.NPC_ControllerPos.sendTo({ id = self._id, pos = self._currentCFrame.Position }, v)

I call this many times. From what I understand ByteNet then packages then together into one big packet to save overhead. Problem is that packet can be >900B.

I managed to get bytenet working for one of my games which shows my screen in roblox

the fps is slightly higher than warp and it doesn’t crash my client when i go in the game.
since warp relies on player amount to get more performance which crashes random clients in the game.
9 fps at 240x135


warp = 6 fps, 25 expected fps with 2 players.
native = 2 fps
bytenet = 8 - 9 fps, 40 sometimes.
anyways feel free to join if im streaming

also there are 15k strings in the rgb event which bytenet is mostly used to send colors to the client to render them. I don’t compress them.

however a nice feature you can add is to compress data in the events and decompress which would make it faster.

why don’t you just put the rgb data in a buffer and sent it? bytenet supports buffers though

I think even when you use packet profiler, ByteNet’s data size is smaller than warp since it’s automatically use buffer.

In 0.4.3 the issue I posted here still hasn’t been resolved: Packet type has invalid methods defined. · Issue #7 · ffrostflame/ByteNet · GitHub

1 Like

0.4.3

Fixes

  • Fixed i16 allocating 8 bytes instead of 2.

Improvements

  • Significant optimization to optional types
  • Array serialization is roughly ~2x as efficient
  • All data type write functions now directly reference the buffer writer. This means all allocation calls are inlined, and there are roughly ~3x less function calls.
1 Like

ByteNet on roblox-ts

The roblox-ts version is under 0.4.3-tsprev1 to ensure everything is typed properly. When I am more confident in the typings I will upload the main 0.4.3 version.

You can see the typings here.

Im probably going to need your script, and it would be better to ask in the OSS server (but beware, they dont give you good string patterns for getting URLs)

@ffrostfall any chance this will be fixed in the future?
Thanks.

How I can send an Instance?
chars

How is this compared to: Security/Performance/Features

You shouldn’t worry with security if you have proper sanity checks on the server and aren’t sending sensitive information like damage (that shouldn’t be done on the client), but from the looks of it, ENet only acts as an exploit protection and still uses normal events

1 Like