-
Notifications
You must be signed in to change notification settings - Fork 241
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
Multi-thread landblock ticking (Landblock Groups w/Thread Safety) #2303
Multi-thread landblock ticking (Landblock Groups w/Thread Safety) #2303
Conversation
This is the start of "landblock group" ticking. The idea behind the landblock groups are that each group may contain multiple landblocks that must be ticked on the same thread, but, each group itself can be ticked on independant threads. The current groups are as follows: Every outdoor landblock is in a group Every dungeon landblock is in it's own group (one per dungeon) This is not ready for public servers yet.
Log.info is the default console output and is intended for: server startup connection/disconnections admin initiated command output server shutdown Log.Debug is the appropriate level for debug-type messages that are to be logged and audited at a later date, but not output to the console.
Have been using this WIP branch on my personal server for about seven days or so and have not encountered any issues with its inclusion. Admittedly, my server isn't very heavily used; however, the with the use it has gotten, no stability issues or bugs have been experienced. |
Thank you for the feedback. The config options have now been moved to config.js, see config.js.example for the new properties. |
This is the start of "landblock group" ticking.
The idea behind the landblock groups are that each group may contain multiple landblocks that must be ticked on the same thread, but, each group itself can be ticked on independent threads.
Landblock groups describe their area using a rectangle. As landblocks are added (and removed) the rectangle that contains all the landblocks in the group is adjusted.
Landblocks are added to groups based on a minimum distance to the landblock groups rectangle.
In the event a landblock needs to be added and is within range of multiple groups, those groups will be combined into one.
Periodically, landblock groups are checked to see if they can be split. When a landblock group is split, it can result in a new group that has an overlapping rectangle to the parent group. This is not a problem because all the landblocks within each group meet the minimum distance requirements. In the event that a new landblock is added and is close to both rectangles, the groups will then be merged again.
Adding landblocks to groups is a very efficient process
Removing landblocks from groups is a very efficient process
Checking landblock groups for split potential does incur some overhead (~0.5 ms) which is why it's only done on intervals that are twice the Landblock.UnloadInterval.
Things still to do: Investigate more thread safety in the following scenarios
Creature OnDeath needs to examined.
Additional Changes we've had to made for thread safety
ToDo: