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

PoC: attach acks to pad messages (halve number of messages) #286

Open
wants to merge 1 commit into
base: slippi
Choose a base branch
from

Conversation

JulienBernard3383279
Copy link
Contributor

Proof of concept for removing standalone ack messages under normal operation. Acks messages are attached to pad messages and hold the "departure delay", that is, the amount of time the ack message's departure was delayed compared to when it would normally have been sent as a standalone message.
The ping calculation becomes (time of arrival of the ack - time of departure of the message - ack departure delay).

image

Attaching the acks works by mean of sending composite messages whose structure is (compositeMessageId (lengthOfNextMessage [Standard Slippi message])* )
In this PoC one pad message can hold up to 2 acks so acks can't permanently lag behind by a few frames.
Buffering 5 acks in the outgoing ack FIFO queue causes flushing all acks in a dedicated message.

This halves the number of network messages used by Slippi during a match. I don't have any improvement measures though.

@JLaferri
Copy link
Member

JLaferri commented Jun 1, 2021

Might add a potential abuse vector, will DM

@JLaferri
Copy link
Member

JLaferri commented Jul 12, 2021

Btw I think I might have asked already but this doesn't break the ping measurement right? Which is necessary to make lockstep execution work: #300

@@ -367,7 +419,7 @@ unsigned int SlippiNetplayClient::OnData(sf::Packet &packet, ENetPeer *peer)
auto sendTime = ackTimers[pIdx].Front().timeUs;
ackTimers[pIdx].Pop();

pingUs[pIdx] = Common::Timer::GetTimeUs() - sendTime;
pingUs[pIdx] = Common::Timer::GetTimeUs() - sendTime - departureDelayUs;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't, ping is just calculated as (arrival of ack - departure of pad - departure delay communicated) instead of (arrival of ack - departure of pad). It should be transparent to the rest of the world.
The ping information will be slightly older though ( < 1f ) since the required info is sent with the next pad message instead of being sent instantly.

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

Successfully merging this pull request may close these issues.

2 participants