Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Channel: UnreliableSequenced #28

Open
cakeslice opened this issue Sep 24, 2020 · 2 comments
Open

New Channel: UnreliableSequenced #28

cakeslice opened this issue Sep 24, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@cakeslice
Copy link

cakeslice commented Sep 24, 2020

Is your feature request related to a problem? Please describe.
The problem with UnreliableOrdered is that it drops older messages even if the game didn't read the pending ones yet. This is a waste of information that is useful to the game and unnecessary packet loss.

Describe the solution you'd like
The solution is to implement a UnreliableSequenced channel that keeps older messages and sorts them until the game/MLAPI performs a read on them. After the read, older packets are dropped.

Additional context
A good example of this in practice is this post from the Lead Networking Programmer of Epic Games where they had to implement this in Fortnite to fix the packet loss problem:
https://www.reddit.com/r/FortNiteBR/comments/awagpo/packet_reordering_technical_post/

@cakeslice cakeslice added the enhancement New feature or request label Sep 24, 2020
@TwoTenPvP
Copy link
Member

This actually requires quite a bit of changes into Ruffles since Channels are usually not aware of any reads.

This addition will probably have an impact scaling aswell

@cakeslice
Copy link
Author

cakeslice commented Sep 25, 2020

Even if it has an impact scaling, it would be optional (a new channel) and still useful for some games/apps that don't require large scaling.

I'm trying to implement it and I was able to discard only the packets older than the last polling time by storing the current _incomingLowestAckedSequence in another variable inside the Channel whenever I poll (I used UnreliableOrdered as a starting point).

Right now the only thing left is to do is sort them right before polling or to keep sorting as they are inserted into the ConcurrentCircularQueue.

Do you think it's possible or a good idea to add a Sort() method in the ConcurrentCircularQueue based on the sequence number?

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants