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

Show time remaining for other players' turns in multiplayer and some other features #108

Merged
merged 7 commits into from
May 25, 2024

Conversation

StenAL
Copy link

@StenAL StenAL commented May 23, 2024

This PR contains the following fixes/features:

  • The remaining time for another player to shoot is now shown in multiplayer games.
    image
  • Single player Championship games now work, previously they started the track fetching code was not implemented.
  • Username validation now fires after the text field is updated. This means single-character usernames can be used, previously they couldn't because they were failing validation.
  • Client username can be set through a CLI flag to make testing faster and easier
  • Client CLI argument parsing can now be tested better because it does not call System.exit anymore
  • Building the server with no changes is a few seconds faster. Previously all sources were recompiled every time because the Database class was fully commented out.

This also includes some deobfuscation work in preparation of making the Try Again Now button work when a client is disconnected from the server.

StenAL added 3 commits May 23, 2024 08:55
These classes are unique to the context and adding the verbosity of
"Game" does not clarify anything so the prefix can be removed.
keyPressed fires before the text field is updated whereas keyReleased
fires after it. The previous approach meant that using a
single-character username was not possible because the validation saw an
empty field. Now it is possible.
All the code to run the timer was in place, it just needed an extra
if-statement to avoid trying to shoot when the timer ran out on another
player's turn.
@PhilippvK
Copy link
Owner

@StenAL Could you please check the failing unit test?

This makes automating set-up for testing a bit easier as it skips the
need to input a username.

To test for username vailidity, I reused the logic from
TrackTestLoginPanel and moved the validation logic into a separate
class.

This also removes the System.exit calls from Launcher.call; those code
paths were impossible to test since the whole Java instance was getting
terminated. By returning an integer instead, we can check the return
codes in tests.
@StenAL
Copy link
Author

StenAL commented May 23, 2024

I fixed the test now, I had accidentally written assertNotEquals instead of assertEquals in one of my new tests. I squashed the fix into the Add CLI flag to set username commit.

Copy link
Owner

@PhilippvK PhilippvK left a comment

Choose a reason for hiding this comment

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

Looks good! Probably waiting for 24h to merge this in case @pehala has comments on this.

@PhilippvK PhilippvK self-assigned this May 23, 2024
StenAL added 3 commits May 24, 2024 22:29
When this was fully commented, Maven was recompiling the entire source
every time it was run because the file was invalid.
See https://stackoverflow.com/questions/17944108/maven-compiler-plugin-always-detecting-a-set-of-sources-as-stale

Since the class is unused, it can be deleted. This speeds up the
iteration cycle of server development by a few seconds.
The fixes championship games in single player.
This is in preparation of making the "Try Again Now" button on the
canvas work.
@PhilippvK PhilippvK merged commit dc2b5b3 into PhilippvK:master May 25, 2024
1 check passed
@StenAL StenAL mentioned this pull request May 31, 2024
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