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

Fix cursor smoothing for 3 and more players #230

Merged
merged 3 commits into from
Sep 1, 2023
Merged

Conversation

polycone
Copy link
Member

Also an event dispatcher is introduced (will be extensively used later).

@polycone polycone requested a review from zuev93 August 31, 2023 15:36
@polycone polycone linked an issue Aug 31, 2023 that may be closed by this pull request
@polycone polycone changed the title Fix cursor smoothing for 3+ players Fix cursor smoothing for 3 and more players Aug 31, 2023
@@ -76,7 +76,7 @@ ExecutionLevelManager levelManager
// TODO: Cursor update may be ignored if MouseMoved isn't triggered after the rate period.
// TODO: Will be changed later (probably with current / last sent positions check).
InterfaceToolEvents.MouseMoved += position => throttle10Hz.Run<UpdateCursorPosition>(
() => client.Send(new UpdateCursorPosition(client.Player, position))
() => client.Send(new UpdateCursorPosition(new UpdateCursorPositionEvent(client.Player, position)))
Copy link
Member

Choose a reason for hiding this comment

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

I would avoid doing any kind of logic in subscriptions like here (getting client.Player and creating event wrapper).
Perhaps even passing a client.Player is redundant and might be calculated automatically upon command recieve.

Copy link
Member Author

Choose a reason for hiding this comment

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

For the player identity, kinda yeah, but we don't have sender tracking in the server relay, I could implement it, but is it really necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't get what's concerning in making events or using some logic in subs, could you elaborate pls?🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't get what's concerning in making events or using some logic in subs, could you elaborate pls?🤔

Turned out it will be changed, but I still have this question.

@polycone polycone merged commit 7e8b4fc into main Sep 1, 2023
@polycone polycone deleted the fix/cursor-smoothing branch September 1, 2023 20:21
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.

Cursor smoothing is broken for 3 and more players
2 participants