-
Notifications
You must be signed in to change notification settings - Fork 0
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
NITWORK/SERVER-NETWORK: Fix wrong implementation of tick and receiveClientEnemyDeath #117
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7e00f94
NITWORK/SERVER-NETWORK: Fix wrong implementation of tick and
romainpanno 46c54ce
FORMAT-AUTO: automatic format on pull request #117
github-actions[bot] 254bda6
NITWORK: Fix codeRabbit requests
romainpanno 055323d
FORMAT-AUTO: automatic format on pull request #117
github-actions[bot] 67082d7
NITWORK: Fix tick_per_second into 128 not 256
romainpanno f42dc95
NITWORK: Fix codeRabbit requests
romainpanno a0b5348
FORMAT-AUTO: automatic format on pull request #117
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
The
TICK
constant has been introduced, calculated based onTICKS_PER_SECOND
. However, the current calculation seems incorrect as it dividesONE_SECOND
by the square ofTICKS_PER_SECOND
. This would result in a much smaller value than expected. The correct calculation should beONE_SECOND / TICKS_PER_SECOND
.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.
@coderabbitai its because one second is in milliseconds, and ticks per second is 128 so i need to convert it in miliseconds by doing * 1000 is it correct ?
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.
@romainpanno You're correct that
ONE_SECOND
is defined as 1000, representing one second in milliseconds. However, the current calculation forTICK
is still incorrect.The purpose of
TICK
is to represent the duration of one tick in milliseconds. IfTICKS_PER_SECOND
is 128, then there are 128 ticks in one second. Therefore, the duration of one tick should beONE_SECOND / TICKS_PER_SECOND
, which gives the number of milliseconds per tick.The current calculation
ONE_SECOND / (TICKS_PER_SECOND * ONE_SECOND)
is equivalent to1 / TICKS_PER_SECOND
, which would give a very small value in seconds, not milliseconds.So, the correct calculation should indeed be
ONE_SECOND / TICKS_PER_SECOND
. This will give the duration of one tick in milliseconds, which seems to be what you're aiming for. Here's the corrected line:This will ensure that
TICK
correctly represents the duration of one tick in milliseconds.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.
oh ok
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.
@romainpanno Great! If you have any more questions or need further clarification, feel free to ask. Happy coding!