This repository was archived by the owner on Oct 14, 2025. It is now read-only.
feat(engine): entitylist count performance for scalebyplayercount fn#979
Merged
Pazaz merged 3 commits into2004Scape:mainfrom Nov 4, 2024
Merged
Conversation
Pazaz
added a commit
that referenced
this pull request
Nov 11, 2024
## Content Changes ### Features * #973 * #985 ### Fixes * #966 * #969 * #971 * #981 * Smithing daggers level-up typo * Item spawns update ## Engine Changes ### Features * #972 * #979 * #986 ### Fixes * #975 * #977 * #978 - movement bug * #983 * #987 * Don't send UNSET_MAP_FLAG when standing still * Soundscape song crash * Authentic Loc category config code * Authentic Obj tradeable config code * InvType safety in player save
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
scaleByPlayerCountwas created which calls intogetTotalPlayersto get the current number of players in theWorld. The waygetTotalPlayersis implemented is by manually counting the slots every time:which the
[Symbol.iterator]is a loop itself:Since
scaleByPlayerCountfn inWorldis used byremoveNpcandremoveObj, it is performing a double loop every time an npc or obj is removed from the world.Refactor the
countfn as so:::addobj2 64adds an obj to every tile in a 64x64 square area, effectively adding and then removing 4096 objs.The screenshots below are before & after when the 4096 objs despawn and shows the time taken.
Before:
After:
I also added some extra info into the world cycle messages & refactored some other bits of code to simplify them.