sebastian-heinz / Arrowgene.DragonsDogmaOnline

Server for Dragons Dogma Online
GNU Affero General Public License v3.0
166 stars 51 forks source link

Feature: Better lobby syncing. #469

Closed RyanYappert closed 2 months ago

RyanYappert commented 2 months ago

Implements better tracking for the existing lobby context packets to hopefully address the invisible people in hub areas like WDT.

The client seemingly keeps track of various player contexts keyed to their CharacterId, updating and occasionally discarding them based on game actions and packets from the server. Without the correct context, characters will not be displayed in shared areas; I'm assuming the client simply disregards any data it doesn't have a context entry for. Of course, because the client is dumb and insane, it often chooses to discard or spuriously update contexts such that they need to regularly be resent. This would be fine, except context packets are relatively large and must be sent to potentially everybody in WDT, and they must all send one back in return.

HubManager attempts to mimic some of the client's internal logic about these context packets such that they have to be sent as rarely as possible. This is done by both keeping track of all clients in shared zones, as well as each Character object keeping track of the contexts that have been provided it in Character.LastSeenLobby.

Addresses the following issues:

[!WARNING] This may be too packet heavy for good performance. Clients regularly entering and leaving WDT can cause a lot of contexts needing to be refreshed. To mitigate need for a rollback, a feature flag has been implemented. See GameLogicSetting.NaiveLobbyContextHandling to turn this feature on. It is off by default, in which case the previous behavior is used.

Checklist: