Introducing UnreliableRemoteEvents

For now you can see the exact payload size by intentionally going over the limit.

The current exact maximum payload size is 908 bytes and a hacky way to see the size of a payload is by intentionally doing over the limit causing a warning like this:

function printPayloadSize(...)
	UnreliableRemoteEvent:FireAllClients(string.rep("i",905), ...) 
end

printPayloadSize(1,2,3)

This also tells you how many bytes each datatype costs:

  • Numbers use up 9 bytes (8 bytes of data since they are sent as FP64s and an additional byte of overhead)
  • Strings use up 1 byte per character (obviously) plus 2 bytes of overhead if the length is less than 128, 3 bytes if they are longer up to the limit you would actually be able to send through an UnreliableRemoteEvent
  • Nil uses up 1 byte
  • Booleans use up 2 bytes
  • Vector3s use up 13 bytes (3 * 4 bytes since they the individual components are sent as FP32s and an additional byte of overhead)
  • CFrames use up 14 - 20 bytes depending on the rotation (usually 20 bytes if the rotation isnā€™t aligned with the 3 axis)
  • References to instances use up 6 bytes
  • Arrays like strings create an overhead based on the length of the array, 2 if it has less that 128 elements, 3 if more

If you want to make sure you are within the limit you should be doing the data serialization and compression yourself for example using the new buffer type which gets rid of much of the overhead and gives you greater control over the size of the payload.

5 Likes

Right these numbers do line up with what is commonly understood but this is still not documented and therefore I feel as though it is hard to completely trust them and I want to rely on Roblox to provide some actual information. I do appreciate you trying to help though. Going over the limit is what I intended on doing anyways to test but nonetheless what I am looking for is a more reasonable solution in the future.

3 Likes

You didnā€™t read at all of what I said: ā€œAlso, if a packet gets lost in TCP, basically everything is frozen until that lost packet is resent.ā€ This is a huge issue that UDP solves. UDP is also faster and lighter weight than TCP because it does not require the handshake. Doing a handshake yourself with UDP is going to cost slightly more resources, yes, but you shouldnā€™t really be using this for that, this is mainly for rapid firing unimportant data.

1 Like

Finally something useful from Roblox for once. This update, and the inclusion of the buffer class, will change Roblox games forever. The performance optimisation opportunities will be another level. Even though these new features have some issues, like a buffer being able to skyrocket memory usage to over 23gb, itā€™s still great what they have done this day.

Give them a round of applause.

1 Like

Is this basically a type of RemoteEvent thatā€™s faster in a way, more spammable, and you donā€™t care about packets dropping?

1 Like

Yes, itā€™s pretty much what it says on the tin

2 Likes

Pretty cool for effect; thanks thatā€™s a great idea

1 Like

Just checked luau source; the max buffer size a buffer can have is 1073741824 bytes, thats around 1 gb, so unless you have multiple buffers its impossible to skyrocket it to 23gb.

(1 << 30 equates to 1073741824)

1 Like

uhhh im lazy to read allat can someone summrize it pls?

1 Like

where can i read the source code of roblox studio?

1 Like

Most of these have been calculated in my packet size counter module, however for some values this becomes hard. This is especially so for buffer types, that are compressed past a certain size, with an unknown limit using a library that isnā€™t available in lua (zstd). Implementing some method (maybe in HttpService?) to measure the cost would be greatly beneficial, as well as futureproof for eventually new datatypes.

2 Likes

First thing that came in mind when I saw this was UDP and TCP :person_shrugging:

Itā€™s a cool new feature though.

1 Like

Everything that changed between frames. Iā€™m currently only sending over the values that changed (compressed), but thatā€™d almost certainly go over 900 bytes for sending over the initial gameā€™s state & for things such as loading new maps

1 Like

What method do regular remotes use for this then? Iā€™m looking for regular remotes w/o the guaranteed ordering to avoid network pausing, but would still like for them to eventually be guaranteed to reach the client

1 Like

Hereā€™s a demonstrative scenario:

  • Server sends A to client
  • Client receives A, sends Ack(A)
  • Ack(A) gets lost
  • Server is sitting there tapping its foot waiting
  • Server decides A may have been lost, and sends again as A2
  • Client gets A2 again and Ack(A2)

If you fired an event saying that A was lostā€¦ that wouldnā€™t be accurate. A wasnā€™t lost, the client got it just fine the first time, it was the Ack(A) that was lost.

Normally there are some interesting techniques used to combine together the acks and messages in an optimal way that gives the best user experience. For example, if the Client above also had to send e message to the server it might send message B + Ack(A) in the same packet. Thereā€™s also decisions to make on whether to prioritize a resend over additional new sends.

Long story short, each individual message canā€™t be taken in isolation, the connection between client and server is a continuous stream and decisions on what to resend / when arenā€™t as simple as ā€œresent message X after Yā€.

3 Likes

Would it be possible to eventually add an UnorderedRemoteEvent now that BaseRemoteEvent is a thing? (asking here since I canā€™t post in feature requests)

Iā€™m assuming whatever I come up with wouldnā€™t be nearly as reliable as what roblox already has built into normal remotes, so hopefully thereā€™d be an official way to do this at some point

4 Likes

When I saw the title and the beginning of the update it sounded like a joke, but it is actually quite useful!

3 Likes

Insane update for anyone who uses client-side vfx, thanks.

2 Likes

this looks cool but i dont really know how this would be useful

2 Likes

Wow this is actually really good for effects and optimization!

2 Likes