-
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
Refactor ticks #1288
Merged
Merged
Refactor ticks #1288
Conversation
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
… profiling results)
Appears to work fine for me, including the next PR that builds on this one. |
gmriggs
approved these changes
Jan 21, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This has several major changes:
Long ago, all ticking and heartbeats were done via ActionQueues. We would enqueue this work using the DelayManager. We migrated away from that system to the system we currently have because for some, the delayed heartbeats via actionqueues was a difficult concept to understand.
The problem we now realize is that the o(n) of the new ticking system adds considerable overhead, as pointed out by gmriggs.
Another thing we did a while back was move an ActionQueue onto each WorldObject. This was to guarantee thread safety for a given world object. No matter where the WorldObject went, the work traveled with it.
Now, there are 3 main actors:
Now, when we say "travels with the player", what we mean is, the work stays attached to the player and is executed on whatever LandblockGroup thread the player currently resides.
When work is enqueued onto a WorldObject, the WorldObject relays that work to its local Landblock.
This is a very safe way of doing things and still allows us the flexibility of LandblockGroups because we can make the following assumptions:
Reminder, LandblockGroups are a concept that we haven't developed yet, but are putting the framework in place for.
Additional changes in this PR add some complexity in favor of performance to Landblock. Now we cache additions/removals to allow us to iterate over the main object list without having to clone it first.