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

Updated remote error handling #90

Merged
merged 7 commits into from
Mar 11, 2024
Merged

Updated remote error handling #90

merged 7 commits into from
Mar 11, 2024

Conversation

Cari1111
Copy link
Collaborator

@Cari1111 Cari1111 commented Feb 28, 2024

Problem

@PacoSchatz and I noticed that the remote error handling that was introduced with a dummy handling function in #82 is not practical for debugging. The problem was that a disconnected player can cause remote errors, but they are not really that important because the player already disconnected, and everything is handled. But for connected players, the remote errors are important for debugging.

Changes

This problem is trying to be solved here, by making sure that there are less remote errors and sorting the errors by connected and disconnected players.

Action validation on client side

It is now checked that every action that is being sent is a list of floats. This makes sure that the client does not send something that would cause a remote error. But the actual action validation still happens on the server side.

Knowing which player is connected

Every player has now a variable is_connected. I'm not sure if that is the best solution. It would also be possible to do this with the connected player list in the player manager, but I thought this would be more complicated. But I am open for other suggestions here.

Sending commands

Commands (e.g. to notify start, end, ...) are now only sent if the player is actually connected. This also reduces the number or remote errors.

Handling remote errors

The remote errors are now handled by the Server by the method on_remote_error(). There are different error messages created for connected and disconnected players.

Copy link
Collaborator

@PacoSchatz PacoSchatz left a comment

Choose a reason for hiding this comment

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

Thanks for your work. I tested it and it works as intended. That improves what errors are shown

Maybe we can consider printing every detail on errors with connected players, as these are the errors we are actually "interested in" most of the time. I marked it below

comprl/server/__main__.py Outdated Show resolved Hide resolved
@Raining-Cloud
Copy link
Collaborator

Uhm I generally think its confusing that we have a connected flag in every player...
I don't see why there even is a state in which a non connected player causes problems and if there is such state this is an bug we should address and not just shortcust with this flag

@Cari1111
Copy link
Collaborator Author

Cari1111 commented Feb 29, 2024

@Raining-Cloud

Uhm I generally think its confusing that we have a connected flag in every player... I don't see why there even is a state in which a non connected player causes problems and if there is such state this is an bug we should address and not just shortcust with this flag

It is also used to make sure that we are not trying to send something to a disconnected player (which would cause an error). For that we need to know if a player is connected or not (or the game would have to know, but I think that would be even more confusing). Like I wrote, I'm not sure if this is the best way to know if the player is connected. Are you suggesting using the connected_players list in the Player Manager?

@Cari1111 Cari1111 requested a review from PacoSchatz March 9, 2024 10:14
Copy link
Collaborator

@PacoSchatz PacoSchatz left a comment

Choose a reason for hiding this comment

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

Thanks for your work. it works now as intended.

@Cari1111 Cari1111 merged commit 9a82836 into main Mar 11, 2024
4 checks passed
@Cari1111 Cari1111 deleted the carina/error-handling branch March 11, 2024 10:38
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.

3 participants