#Packet - Networking Library

1 messages · Page 3 of 1

meager jackal
#

idk if im being stupid but is there a way I can sync a dictionary with an unknown amount of keys/values?

for example {a = 0, b = 0, c = 0, abc = 3}. the key name would always be a string, and the value would always be a number, but the k/v pairs would be unknown (e.g. one time it may be {a=0}, another time it may be {b=0,c=0}, etc) & therefore i'd be unable to type each one out

rain rock
#

you can just do Packet.Any

#

that's it

meager jackal
#

alr

#

ty

thick atlas
# meager jackal alr

Try to avoiddoing that, the Any type uses a lot of bytes, i think it tries to adapt to the provided type but idk, make sure to measure the size of the packets that come through

silent spire
thick atlas
rain rock
#

@thick atlas meant to tag you

#

Packet.Any is usually 1 byte longer for basic data types

silent spire
rain rock
silent spire
#

especially nested

rain rock
#

yup

silent spire
rain rock
#

cuz you need to encode the structure itself

#

not just the type information

#

so it takes more information

silent spire
rain rock
#

we should try that honestly rn

rain rock
#

Im not sure what algo does it use to encode tables

#

YOOOO

#

@silent spire

silent spire
#

works?

rain rock
#

overflowed

#

probably recursion

#

it doesn't support cyclic

#

I mean sending cyclic tables is a bad idea anyways

#

but yeah as expected it doesn't support it

#

so I think what it does is encode each key and value pair together. It start a key and a value a value can be another table and so on

rain rock
#

I think it goes like this

#

[Key][Value]

#

[Type][Value][Type][Value]

#

literally

silent spire
rain rock
#

[TableStartType][Type][Value][Type][Value]...[TableEndType]

#

so you can start a new table by inserting the type 28

#

yeah guessed it

#

it's actually pretty efficient

#

it only uses 1 extra byte per table start command

#

so every nesting is 1 extra byte

silent spire
#

not that bad tbh

rain rock
#

should I write a ser des library based on packets?

#

like it's going to just have serialize and deserialize no writing to packets

#

and will work with whatever scheme you input

#

cuz I had this issue in RemoteTable-Light where I need to embed Packet itself fully even tho I only use ser/des

silent spire
rain rock
silent spire
#

sera

#

serde

#

squash

#

tho you need to have like a Packet.Any option right

rain rock
#

sera doesn't have any

#

let me see other ones

thick atlas
mint laurel
silent spire
mint laurel
#

I gate keep

#

(I’m not home)

silent spire
mint laurel
#

I think I had to like rip it out of a library on GitHub

silent spire
#
mint laurel
#

O peak

silent spire
#

it needs a schema tho

mint laurel
#

Yeah

#

It’s nice

#

pre define and plan your data

#

like packet

silent spire
mint laurel
#

I hope it’s good

#

cause I use it in my work

frozen oyster
#

@gaunt field

gaunt field
past mist
#

@ruby crypt can you add native unreliable remotes support without the wrapper

silent spire
#

and the wrapper isnt that complicated

#

#questions message

rain rock
#

@ruby crypt can you add a check for redeclaring packets and make some error messages more clear

#

If a different packet with same name is redeclared it should error imo

silent spire
#

agreed

ruby crypt
#

But maybe V2 should just use the module method

#

Without names

rain rock
#

it makes no sense to define something twice

ruby crypt
# rain rock no Im saying error when something is redefined

Let's say you have 2 scripts

-- script A
local p = Packet("name", Packet.String)
-- script B
local p = Packet("name", Packet.String)

This won't error but both will point to the same packet and only the script that runs first will build the packet

rain rock
#

Idk if you have a way to do that

ruby crypt
#

Maybe but in the future if I remove name and force you to define all packets in a module then the problem goes away

rain rock
ruby crypt
rain rock
#

after duplicating a packet

#

and the namespace ends up being same as the other one

#

and now I have a packet firing that I didn't intend to

ruby crypt
#

K

past mist
rain rock
#

it's just a wrapper

#

packet runs same

#

wait nvm

#

batching unreliable is a bad idea

#

💀

#

imagine losing a packet

#

the entire point of unreliable is to get information across with least amount of header

past mist
ruby crypt
#

Right unreliable events are better not batched and sent with the smallest amount of data possible

past mist
ruby crypt
#

Only if the buffer it shorter then expected then it will ignore the event

past mist
ruby crypt
#

Think of it like a long array of numbers

#

6,8,4,9,5,9,5,8,2,...

#

6 8 4 might be a vector3 or it might be 3 numbers or it might be a color3

#

Or maybe 6,8 is a vector2

#

The server loops through the numbers building the types it expects

past mist
#

ah okay

#

thank yuo

ruby crypt
#

But the server will still build the correct type from the numbers

past mist
#

how does it know hwat to build tho

#

oh

#

fromi the constructor

#

definition

#

mb

dapper axle
#

anyone know some big games that use packet

sand fern
#

id actually wait before making any big reworks, luau team is heavily discussing the new Classes RFC

weary halo
#

^ I doubt that matters, if it comes to release then it should be easy to make the change

#
  • what happened to metatable OOP? Did we forget it exist?
gloomy summit
#

ask the engineers

weary halo
#

We got const in luau, so it's kinda inevitable we will get class in too

sand fern
#

and shared self types also turned out to be brittle

rain rock
#

it's struct

#

I mean *records

sand fern
#

i dont really agree

#

it really depends in which context you think structs are better

#

structs are only really good if its supposed to be immutable and value-like

long remnant
#

what causes this warn to happen?

  17:49:16.975  [Net] Response thread not found for packet: SpawnVehicle discarding response: 0  -  Client - net:374

is it like unable to find the thread to resume?

ruby crypt
#

do you have waits inside the event?

long remnant
#

the waits wasnt hte issue i had a mismatch going on with the request and response

#

thanks for responding tho

#

it fixed

hot steeple
#

What are the max values that "CFrameF24U8" can take?

tribal terrace
hot steeple
#

o ok ok

hot steeple
#

is it possible to make an unreliable packet? (nvm found what i was looking for)