Skip to content

Refactor client game code#138

Merged
PhilippvK merged 12 commits intoPhilippvK:masterfrom
nuhakala:refactor_client_game
Jan 24, 2026
Merged

Refactor client game code#138
PhilippvK merged 12 commits intoPhilippvK:masterfrom
nuhakala:refactor_client_game

Conversation

@nuhakala
Copy link

This PR does a major refactor to client side game code. Goal is to make code more readable and maintainable, not to change any existing behavior. I have done a fair amount of testing and have not noticed any changes. However, at least when I tried to simplify getFriction, it resulted in different behavior and I reverted the change. If you experience any changes, please let me know and I will fix it.

Sorry for huge PR, I considered about splitting it into two but was not sure if that would achieve anything. Following the changes is little complicated due to renaming variables and moving code around, so thought that it might be simplest to just put everything into one PR, especially when the track parsing was removed completely from client. If you want, I will break this into multiple PRs.

Features:

  • Creates own class for map and tile and moves the related code from gamecanvas and gamebackgroundcanvas to these classes.
  • Deobfuscates (almost) every variable in gamecanvas
  • Deobfuscates many variables in hackedshot
  • Refactors the client to use track classes from shared library
  • Deletes code related to ads in track/map context. Removing it should not affect anything, and I was encouraged to remove it because I saw some ad code removals in commit history.
  • Removes some dead code and simplifies few if-clauses.

Other notes:

  • Creating gamestate class is little questionable at this point. I created it because I thought that I could refactor the shot-specific functionality to its own class similarly to hackedshot, but that is not so simple so did not do it.
  • In my opinion the gamecanvas still holds at least classes Game, Shot, and some kind of interface for rendering graphics.

Advances issue #69

@nuhakala nuhakala changed the title Refactor client game Refactor client game code Dec 21, 2025
@nuhakala
Copy link
Author

@StenAL @pehala you maybe want to also review

Copy link

@StenAL StenAL left a comment

Choose a reason for hiding this comment

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

Looks mostly good and the changes are really nice since it untangles a lot of the complexity in the codebase!

One issue I have is that some commits fail the build. This makes bisecting issues difficult in the future since this project uses merge commits which preserves your commit history.

It would be great if you could fix that, either by squashing commits or by rebasing and fixing them one-by-one. For reference, I used git rebase upstream/master -x "mvn clean && mvn install" to test whether each commit passes the build.

@nuhakala nuhakala force-pushed the refactor_client_game branch from 6508786 to 31f20e2 Compare January 14, 2026 19:50
@nuhakala
Copy link
Author

@StenAL Thanks for the review and sorry for the slow response. I did git rebase upstream/master -x "mvn clean && mvn install" and fixed the issues. I also addressed the other problems, please take a look.

In addition, I reworded the commit messages to better align other commit messages in the history.

Copy link

@StenAL StenAL left a comment

Choose a reason for hiding this comment

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

Looks really good, thanks for this!

This is great work since it's deobfuscating the most complex part of the whole application. Everything looks way more understandable and decoupled than before.

@PhilippvK PhilippvK merged commit 17f7023 into PhilippvK:master Jan 24, 2026
2 checks passed
@PhilippvK
Copy link
Owner

Thank you for the awesome contribution. I really appreciate the efforts.

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