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

Retreat is broken when spam clicking commands in multiplayer games #5429

Open
Godde opened this issue Jan 1, 2025 · 4 comments
Open

Retreat is broken when spam clicking commands in multiplayer games #5429

Godde opened this issue Jan 1, 2025 · 4 comments

Comments

@Godde
Copy link

Godde commented Jan 1, 2025

Steps to reproduce:

Host multiplayer lobby so that you have a latency to the server.
Start game.
Setup retreat zone.
Set unit to retreat at 99%.
Continually spam click orders for the unit as you enter the enemy range and takes damage.
The unit becomes deselected but continues to the target destination, probably because the command reaches the server after it was deselected and ordered to retreat.

@GoogleFrog
Copy link
Contributor

The simple solution is for the unit to become immune to player commands for 500ms or so after being told to retreat. There might be edge cases though.

@Godde
Copy link
Author

Godde commented Jan 3, 2025

Yeah, that could work decently.
In 500ms seems low enough that you wont be able to react to the deselection of the unit and give it a new order before the time has passed.
I guess there would be a few rare occasions where you are about to select the unit being damaged and selects it right after it getting below the threshold and the command won't get registered because it is still within that 500ms window.

@sprunk
Copy link
Member

sprunk commented Jan 4, 2025

Two extra solutions that could be more correct but sound annoying/dangerous to implement:

  • IIRC ping is readable from synced, so the 500ms could instead be ping.
  • orders given to retreating units could be poisoned with extra metadata (cmd options bit flag) and the unit would be immune to anything without it (in particular, orders given before the unit started retreating).

@GoogleFrog
Copy link
Contributor

orders given to retreating units could be poisoned with extra metadata (cmd options bit flag) and the unit would be immune to anything without it (in particular, orders given before the unit started retreating).

How about this for an engine feature: All commands include the frame they were issued on, where the frame is whatever was local to the issuer. So if a player issues a command on frame 100 and it hits synced on frame 110, the command has an issue time of 100. Commands issued by luarules can set issue frame, in case luarules merely transforms a command from unsynced, and wants to retain the data for other purposes. But most of the time it would default to the current frame.

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

No branches or pull requests

3 participants