-
Notifications
You must be signed in to change notification settings - Fork 41
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
Refactor the packet generator #2070
Merged
lmoureaux
merged 39 commits into
longturn:master
from
lmoureaux:refactor/generate-packets
Dec 10, 2023
Merged
Refactor the packet generator #2070
lmoureaux
merged 39 commits into
longturn:master
from
lmoureaux:refactor/generate-packets
Dec 10, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remove the -v option since it wasn't really doing anything useful.
Using ccache works better to avoid recompiling everything.
C++ doesn't need them
* Use f-strings everywhere, removing usage of % self.__dict * Remove "struct" where possible (C++ification) * Use += where possible * Move comments to docstrings * A few more trivial simplifications
* escaped strings * native int vector handling
Simplifies generate_packets as well
jwrober
approved these changes
Dec 4, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a big PR. The python code you changed was ancient syntax. I'm kinda surprised it took till v3.12 to throw errors. Good job on this refactor.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I went "a bit" overboard while fixing #2062 and ended up rewriting half of the file. The result is still far from perfect, but the pylint score went up to 8.5/10 (from 1.5/10 initially). So I would say it's about one order of magnitude more maintainable.
The parts I reorganized are mostly related to parsing the input file and writing the output. The core business logic behind the code generation is mostly unchanged. The main exceptions are large-scale replacements of obsolete syntax (
%
-based string formatting,x += 1
instead ofx = x + 1
, etc).I also removed unused functions and parameters in
dataio_raw.h/cpp
. I encountered them while trying to go even deeper with the refactoring (which I won't do just yet).I tested this PR on the client side by connecting to a game and doing some basic moves. I didn't spawn a server, but everything is quite symmetric so I'm optimistic.
I can this huge thing if you prefer, really just wanted to push it somewhere so I won't forget it.
Closes #2062.