You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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!
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.
The text was updated successfully, but these errors were encountered: