Jump to content

[patch] Map::PlayerRelocation performance

Guest AuntieMangos

Recommended Posts

* What features does the patch add?

With this patch the amount of visibility update/recalc calls per player is limited to once per 500ms. This brings down cpu usage, since the visibility calculation is quite cpu-hungry in highly crowded zones.

EDIT: this patch does not affect players seeing each other move around, since the move packet sending is done directly after receiving in WorldSession::HandleMovementOpcodes(). it just skips some cpu-instensive code parts that are executed on move (there may be more room for optimisation tho)

* Additional remarks

A player moving straight forward sends heartbeat packets every 500 ms. so why not limit update calls to this interval also if a player is turning, jumping, etc. ?

This patch is experimental! It was tested and seems not to have any side-effects. However, it should be tested by some more people before anything is done with it.

It should scale well with Ambal's grid object search patch.

* For which repository revision was the patch created?


* Who has been writing this patch?


--> patch: http://github.com/fgenesis/mangos/commit/d08d80f56d55bf44fd3962a3d0612ff6f9caf911 <--

If there is any interest i can update this patch to use a max. update time that can be set in conf and is not hardcoded to 500 ms.

EDIT: whoops, forgot to mention: this patch has to be applied by hand (only 3 blocks shouldnt be too bad anway), because of the anticheat stuff in player.h/cpp directly above the change... next patch will be clean one on paste2.

Link to comment
Share on other sites

  • 39 years later...


mangos rev: 8371 +SD2 +a LOT of custom stuff

uptime: 1d 2h 40m (avg.: 0d 6h 19m) right now. max 300 testers online, and anyways there is no crash possibility in this patch.

about ram usage: this patch adds 4 bytes additional ram for every logged in player (8kb ram for 2000 players). nothing basically :P

EDIT: okay, will update the patch tomorrow to use conf values.

Link to comment
Share on other sites

Well, nice catch but I and SilverIce already did some more complicated and faster patch on getmangos.ru :)

post it here...? i dont understand russian, checked mangos.ru, found the topic and used online translator to get some idea about it, but whatever... as long as your/SilverIce's patch isnt ready, this one can be used.

i got -30% load with 280 testers on, this is at least something for now. cant wait to see the "real" patch btw ;)

Link to comment
Share on other sites

I believe that the visibility update interval on official is pretty slow because if you move really fast into an area, mobs don't show up right away. I've had it where i showed up somewhere and was being attacked before I could even see what was around me (I have a good comp and internet connection, it wasn't lag and it's happened multiple times.) Slowing down the update interval seems like the way to go to me. Also, as i stated in the grid speedup thread, as you move away you can see mobs for up to about 300 yards and i think it mostly has to do with update time because if you move to about 200 yards and wait, the mobs will disappear after ~2-3 seconds.

Link to comment
Share on other sites

that's most likely true. There's also certain mobs flagged as always visible (with max vis settings), the main one coming to mind is the Fel Reaver. You can see it from anywhere in Hellfire Peninsula

You can? I don't remember this.

I know some mobs have different visibility settings than other mobs. For example, you can see Hakkar from most of Zul'Gurub.

Link to comment
Share on other sites

If I understand correctly, you want to stop Update*Visibility when the player is not actually moving, and you add a timer in order to update only after the interval the client usually sends packet when moving straight forward.

then modifying Player::SetPosition to check if x,y,z changed seems a better solution to me . you could pass an arg to tell if Update*Visibility are needed (if x,y,z changed) and force this flag to true in Unit::SetVisibility and i think in Traveller<Player>::Relocation too.

or you can check before and after player->Relocate() in Map::PlayerRelocation()

then you wouldn't need neither extra var in player* nor getMSTime() and you would have better speed / accuracy.

Link to comment
Share on other sites

This topic is now closed to further replies.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use