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

fix: Overhauls murder system #1419

Merged
merged 7 commits into from
Jul 16, 2023
Merged

Conversation

kamronbatman
Copy link
Contributor

@kamronbatman kamronbatman commented Jul 3, 2023

MAJOR CHANGE (API BREAKING)

Added a player murder system to facilitate reporting murders. This should make it easier to extend to create a bounty system or other related game content. Player murders will be saved in a folder called PlayerMurders.

Motivation

The motivation was two-fold, performance, and bug fixes.

First, murders are one of two systems that do a pre-world-save check on every mobile in the game to decay kills and set their expiring murders. This is taxing since it freezes the world and makes world saves take longer. Every mobile has ShortTermMurders even though it is a player concept. And next, 90%+ of players are not murderers but had an ever increasing MurderElapse time that was being tracked against GameTime. These properties were also serialized unnecessarily for all mobs.

Second, when I tried to optimize/refactor the code, it was obvious that the system has bugs.

Major API Changes

  • Created a player murder system and moved ShortTermMurders, ShortTermElapse, and LongTermElapse to the system.
  • Added convenience property PlayerMobile.ShortTermMurders.
  • Added convenience properties PlayerMobile.ShortTermMurderExpiration and PlayerMobile.LongTermMurderExpiration
  • Moved ReportMurdererGump.cs
  • Adds an EventSink.PlayerDeleted event.

Notes

The system currently does not support NPCs. To support expiring murders on NPCs I highly recommend a different architecture for large servers (500k+ mobs including players). Specifically switching from looping through all MurderContext to a time-order link list.

@kamronbatman kamronbatman force-pushed the kbatman/murder_system_overhaul branch from 6de944d to cec2eb9 Compare July 8, 2023 15:03
@kamronbatman kamronbatman force-pushed the kbatman/murder_system_overhaul branch from 6f3a8f2 to ed8261d Compare July 8, 2023 15:19
@kamronbatman kamronbatman merged commit 26f784f into main Jul 16, 2023
9 of 10 checks passed
@kamronbatman kamronbatman deleted the kbatman/murder_system_overhaul branch July 16, 2023 05:42
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 this pull request may close these issues.

None yet

1 participant