Introducing UnreliableRemoteEvents

Presumably you are calculating LookVector.Z from X and Y since it is a unit vector but this won’t work without also sending the sign of Z, a better way is to use a spherical coordinate system, calculate the polar and azimuthal angles for a given unit vector and send those instead which will also give you better maximum precision.

In Lua it should look something like this:

local function unitVector3ToAngles(v3 : Vector3) : (number, number)
	local theta = math.acos(v3.Y)
	local XZLength = (v3.X^2 + v3.Z^2)^0.5 
	local phi = XZLength < 0.00001 and 0 or (v3.Z < 0 and -1 or 1) * math.acos(v3.X / XZLength)
	return theta, phi
end

local function unitVector3FromAngles(theta : number, phi : number) : Vector3
	return Vector3.new(math.sin(theta) * math.cos(phi), math.cos(theta), math.sin(theta) * math.sin(phi))
end

With theta being a number between 0 and math.pi and phi being a number between -math.pi and math.pi

2 Likes

I dont understand the use cases for this event. If the event can be dropped, then it cannot be used for any critical aspect of gameplay, such as rendering bullet traces and/or hit detection events.

While it could be used for sounds and effects, gun sounds, vehicle sounds, etc are all incredibly important in the sound design of any shooter or driving game, so dropping events will cause confusion and make sound unreliable for gameplay.

Maybe at some point, however, we can have some sort of unreliable remote system that instead of manually sending events, sends events automatically to update values as modified by client/server for client-server communication of information like engine pitch, ammo counts, health / hit points, so on.

Just a note, roblox supports ternary operators. Should replace uses of condition and value or alternative with if condition then value else alternative. Cooperates better with type hints / Luau, and makes full use of short circuit eval

Just because you don’t understand the use cases, it doesn’t mean they aren’t there. As they said, it is not meant for critical aspects of gameplay.

Unreliable remote events are for constant data flow and low priority information. Think a more accurate character position or effects. This is because, although unreliable, an incredibly small amount of data will be lost depending on how efficient you use it and the clients internet connection.

A gun for example – if you fire a single bullet, if the single bullet doesn’t render it’s going to look awful and confuse the player so it’s best to use reliable remote events. If you’re firing 20 bullets per second, they’re not going to notice one trail missing, so it’s best to use unreliable events so you don’t clog up the reliable remote queue.

3 Likes

Just for clarification, there is no 9 byte overhead and additional 5 byte client-to-server overhead?

Should I use this when having a uncontrol event, which is client → server, which indicates that whatever object the player is holding, will be dropped. It has 0 arguements, but I just want to make sure!

Please refer to one of my earlier responses.

If it is important for the server to know that the client wants to drop said object, you shouldn’t use unreliable remote events at all.

I was not under the impression remote events were reliable to begin with, considering I had usecases where sending a fresh spawned part as an argument in a remote event lead to the argument being nil. lol

Remote events only pass references to instances. If those instances don’t exist on the client (yet) then the references won’t point to anything for the client and it will thus be nil.

2 Likes

Maybe I am missing something but looking at the comments many people were very glad for this change. However, what exactly can UnreliableRemoteEvents do that normal ones cannot do? When would you use them? Sorry if this is a silly question, I am not a network engineer.

Your question has already been answered here.

So basically, for events that them not holding future events is more important than them getting processed. So the request is dropped instead of causing issues.

1 Like

I thought UnreliableRemoteEvent should inherit from RemoteEvent

In my game, would it boost performance to remove all RemoteEvents and replace them with Unreliable ones?

That would be very, very unwise. To understand what unreliable remote events are useful for, check out this blog post: A reliable case for unreliable packets - boyned's blog

TLDR: unreliable remote events are useful for sending frequent, trivial information such as the angles of your torso and head as you look around, because you don’t get congestion if some of the fired events aren’t received. More important information should be sent using the secure, regular remote events.

3 Likes

But you can do it to kill off your game completely to promote your new next game! So there won’t be no lingerers in your old game, just claim that “NETWORKING BROKE IN THIS GAME, JOIN THE NEW GAME FOR A FIXED VERSION” I am sure kids don’t understand what “networking” means if they hear your old game is broken but your new game is working fine then they play that. Risky but highly effective!

MY NETYWORKER BROKE!!! I BLAME ROBLOX.

I put this in my description and now I have been terminated.

so can unreliableremoteevents prevent spamming and exhausing the server?

no

mininum character limit woohoo yeah :+1:

Anybody heard of UDP? Well this is the same thing, UnreliableRemoteEvents sometimes drop signals but their only concern is to get data as fast as possible from the client to the server and vice versa. UDP does the same thing too. It may drop some packets but it’s only concern is to get data to the other side as fast as possible.
RemoteEvents are like TCP, they will not drop any packets. - Riley the IT whiz

1 Like