Packet - Networking library

Isn’t that just called compression

1 Like

I know this is off topic, but why are you prefixing every variable with an _? To my knowledge you only do that for private table members, or for when you wanna define something without shadowing something else that’s already defined

It’s for this, I define other variables such as services normally while leaving out the rest

1 Like

I dunno, the standard for roblox is that you use camel case for normal/temporary variables, I’ve just never seen it that’s all :V

I fixed that and yet the packet still refuses to send anything to the client, I genuinely don’t know what’s the cause anymore.

maybe we don’t have access or any documentation that I’m aware of that explains what is happening under the hood but we could assume its compression but we don’t know how it works or what type of compression it is

This is a bit off topic but I am pretty sure I saw Float16 for this, in what cases would you want to use float16, wouldn’t it be too imprecise for anything, or am I just stupid.

Oh, yes it was mentioned by WheretIB on the buffer announcement post :+1:

IIRC it internally uses zstd compression.
You can force the compression on a buffer with HttpService:JSONEncode(buffer) and that would give you a base64 encoded result of the compressed buffer.

2 Likes

Noticed an issue with the Signed number format, if the value is negative and then you add the 0.5 the buffer will automatically round it up which can lead to an offset of about +1.

Not a huge deal but for some people who send in directional values that stack on top of eachother it can add up fast

1 Like

nice thanks for sharing I did not read the anoucments of buffers so was not aware

2 Likes

that’s intended behaviour because the value is floored when its converted from a float to a Integer

math.floor(10.5) = 10

math.floor(-10.5) = -10

it really depends on your usecase feel free to use any type you like its not mandatory to use the smallest type but its there if anyone needs it

1 Like

When adding to a minus the value goes down though -10 + 0.5 is -9.5 which is floored to -9 isn’t it?

yes so adding 0.5 would be like adding 1 because it gets floored

and subtracting 0.5 from a positive number would be like subtracting 1

I don’t think your understanding my point

When a negative number is passed into the function say -9 it adds to make it -8.5 as you are adding then floors it to be -8 whereas if that was a positive number then that would be 9.5 then floored to 9. It creates a difference between the values

If you pass in a vector 2 s16 of 0,-2 it would come out as 0,-1

local Packet = require(ReplicatedStorage.Packet)
local Something = Packet("Something", {[Packet.String] = Packet.Vector3F24})

How would you do something like this? This example code won’t work.

Can anyone tell me what this error means???

I’ve been getting a few errors like this regarding the Packet Module.
I’ve also gotten “Attempt to index nil with ResponseParameters”

And i do not think i’ve done anything wrong

image
It comes from this line 329 inside the module

oh OK I get it now your talking about the vector types where we use signed types OK I’ll fix that in next update

1 Like
local Packet = require(ReplicatedStorage.Packet)
local Something = Packet("Something", Packet.Any)

but this is not as efficient as pre defining the keys as now the module will also need to send the key