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

Suggestion about changing the id system used for active spells. #2

Closed
nullTheCoder opened this issue Apr 30, 2022 · 1 comment · Fixed by #3
Closed

Suggestion about changing the id system used for active spells. #2

nullTheCoder opened this issue Apr 30, 2022 · 1 comment · Fixed by #3

Comments

@nullTheCoder
Copy link

In the code it generates an int from 0 to 9999 as the active spell id which would mean that there could only be 9999 at a time and if all of the 9999 spells were to be taken the server would just crush.

Even with let's say 9995 active spell ids taken the server might still crush or at least get performance of spell spawning severally dropped because of it trying to generate a random number which is not taken over and over again.

I would recommend changing from int id to UUID, or making the int id not random but instead increased by one every time a spell is spawned and when reaching the int limit just reset to 0.
(Even tho reaching the int limit is very unlikely unless the server is running for years without restarting (if a spell were to be cast every second it would take 68 years to run out of ids or if at the rate of 1000 spells per second, it would still take 24 days))

Thank you for reading this short suggestion.

@M0rica
Copy link
Owner

M0rica commented Apr 30, 2022

Yeah that's a good point, I don't think that there will be more than 1000 spells at the same time but who knows, I'm going to change it to the second suggestion you made. Thanks!

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 a pull request may close this issue.

2 participants