Packet - Networking library

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

this means it was not able to find the packet

this can happen because

  1. the packet was not setup on both server and client

  2. packets have different types defined on server and client

make sure you setup the packets as soon as the server starts

I am doing just that, i even printed how many times they were being made to see if i had any dupes that had different types, i made this packet twice on server and client and these are the types on all of them:

CLIENT:

image
image

SERVER:

image
image

Keep in mind that im using the PACKET.Any Type because the previous type i was using was not working, even though i was sending the correct datatype and value, i even checked multiple times using prints inside the Packet module.

(And as you can also see they are setup when the server starts, also indicated by the line number being very low)

(Another note is that, in Studio there is no error but when i go into my ROBLOX Game this error pops up)