altv-issues
altv-issues copied to clipboard
Unreliable events
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
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.
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 thenplayer.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?
Added in upcoming dev