Reduce server load from zombie monitoring - #1
Draft
Ravenger2709 wants to merge 1 commit into
Draft
Conversation
This file contains hidden or 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
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.
What this changes
We have been running ExileZ on a live Esseker server and found that zombie cleanup was one of the recurring server-side hotspots as the zombie count increased. This PR carries the useful part of that production work back to the current ExileZ-Mod structure.
The zombie monitor now processes a bounded batch on each pass instead of scanning every living zombie in one frame. It keeps a cursor between passes, so all zombies are still covered while the work is spread over time. Player lookups are also cached for one second and shared by the monitor, location validation, harassment and horde tasks. This avoids repeatedly building the same
allPlayerslist and replaces broadnearEntitiesplayer searches with distance checks against that small cache.The two separate protection-device searches were combined into one
nearestObjectsquery. Normal logging remains quiet; batch statistics are emitted only whenEZM_Debugis enabled.Two settings control the scheduler:
EZM_MonitorInterval: delay between monitor batches, 5 seconds by default.EZM_MonitorBatchSize: maximum zombies checked in one batch, 50 by default.Zombie spawning, side assignment and group setup are intentionally unchanged. During production testing we found those parts are sensitive to Ryan Zombies AI behaviour, so this PR stays focused on server-side scheduling and lookup cost.
Database cleanup
The included database examples previously created and updated
account.zedkills. They now consistently useaccount.zombie_kills, matching theaddAccountZombieKillquery used in our deployed Exile schema. The migration usesADD COLUMN IF NOT EXISTS, making it safe to run again on an already updated database.Existing installations that already store data in
zedkillsshould copy that historical value intozombie_killsbefore dropping or retiring the old column.Validation
git diff --check.exilez_moddirectory was successfully packed into a PBO with PBO Manager.Because this repository is a newer rework than the version deployed on that server, this is opened as a draft for an additional in-game check against the current upstream build.