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

Rework Experience Calculation logic #547

Merged
merged 4 commits into from
Nov 23, 2023

Conversation

dphaldes
Copy link
Contributor

@dphaldes dphaldes commented Oct 23, 2023

Description

Changes the xp calculations to remove recursive calls and use much straightforward formulae

(Closes issues indirectly by removing all stack overflow recursions)
Closes #543
Closes #313

  • My code follows the style guidelines of this project (.editorconfig, most IDEs will use this for you).
  • I have performed a self-review of my own code.
  • I have commented my code in areas it may be challenging to understand.
  • I have made corresponding changes to the documentation.
  • My changes are ready for review from a contributor.

@dphaldes
Copy link
Contributor Author

I have also tried to clean function names, but it still requires some work. Let me know if you would like me to change docs/names

@dphaldes
Copy link
Contributor Author

#363 will require an update if this PR is merged first (else the other way around)

@maxinglo
Copy link

If the fluid xp use int type can only contain about 4000 levels. maybe it's a problem?

@Rover656
Copy link
Member

Maybe it is smart to switch to long in some places, similarly to #329

@Rover656 Rover656 added Type-Bug There is a problem. Area-Backend Backend work not usually visible to players. MC-1.20.1 P-0-High High priority, crash/breaking. labels Nov 11, 2023
@dphaldes
Copy link
Contributor Author

Overflows should not happen anymore, as we don't use recursions anymore. Switching to long may not fix anything as vanilla max level is an INT

@Rover656
Copy link
Member

Stack overflows are avoided, yes however if we overflow an integer then we might find ourselves dealing with weird negatives

@dphaldes
Copy link
Contributor Author

I will change the places where we store raw experience points into longs. The levels need to stay as an integer so that it is compatible with vanilla.

Copy link
Member

@Rover656 Rover656 left a comment

Choose a reason for hiding this comment

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

This looks great, thanks a lot to both chonky and GotoFinal for working on this issue!

@Rover656 Rover656 merged commit 47eb52d into Team-EnderIO:dev/1.20.1 Nov 23, 2023
3 checks passed
@dphaldes dphaldes deleted the dev/rewrite-xp-logic branch December 15, 2024 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Backend Backend work not usually visible to players. MC-1.20.1 P-0-High High priority, crash/breaking. Type-Bug There is a problem.
Projects
None yet
4 participants