altv-issues icon indicating copy to clipboard operation
altv-issues copied to clipboard

Unreliable events

Open deluvas1911 opened this issue 3 years ago • 2 comments

Description of the problem

Related to this discord convo.

There are some use cases (e.g. updating a objects position with a low interval or basically every self-synced low-interval case) where reliable events aren't needed at all, because the low interval would resent it in a reasonable timespan anyway. Having an option where the client wouldn't have to acknowledge that he received the data could safe some network traffic.

Example:

server

alt.setInterval(() => {
   alt.emitAllClients("SyncTime", currentTime);
}, 3000);

client

// Here I wouldn't care if 3s of the time sync get missing
alt.on("SyncTime", (currentTime) => {
   // set time with natives
});

Desired solution for the problem

Listener could stay the same, but it could be sent as player.emitUnreliable(eventName, args[]) & alt.emitServerUnreliable(eventName, args[])

Alternatives you considered

Additional context

Version

dev/13.0-dev10

deluvas1911 avatar Aug 18 '22 09:08 deluvas1911

This would be really helpful for example as @deluvas1911 said to update objects/peds positions or to update some things on screen which isnt that important if packet drop happens. If this gets implemented Im worried if I send event player.emitUnreliable("updateSomething", 1) and then player.emitUnreliable("updateSomething", 2) second event will execute first before first event which can result in ghosting/lagging (if updating object/ped positions) or wrong info on screen (if updating smth on webview/client). Anyway if that could happen would be really helpful to use on something not that intensive.

LightSrc avatar Aug 18 '22 10:08 LightSrc

This would be really helpful for example as @deluvas1911 said to update objects/peds positions or to update some things on screen which isnt that important if packet drop happens. If this gets implemented Im worried if I send event player.emitUnreliable("updateSomething", 1) and then player.emitUnreliable("updateSomething", 2) second event will execute first before first event which can result in ghosting/lagging (if updating object/ped positions) or wrong info on screen (if updating smth on webview/client). Anyway if that could happen would be really helpful to use on something not that intensive.

But isn't no guarantee whether the event arrives at all or the order of events, the point of unreliable events?

LeonMrBonnie avatar Aug 18 '22 13:08 LeonMrBonnie

Added in upcoming dev

C0kkie avatar Mar 19 '23 20:03 C0kkie