suriyun-production / mmorpg-kit-docs

This is document for MMORPG KIT project (https://www.assetstore.unity3d.com/#!/content/110188?aid=1100lGeN)
https://suriyun-production.github.io/mmorpg-kit-docs
49 stars 10 forks source link

LAN - Warp coordinate not working for non host #2582

Closed sawcisson closed 1 month ago

sawcisson commented 1 month ago

Player who are not host don't spawn on the spawn position of the map inside the instance for some reason. They spawn else where and fall through ground

Reproduce :

Host a lan game Go into a warp to another map NON host player get teleported to wrong coordinate

Eniotnacram commented 1 month ago

Hello,

Hosting the server (host) on the same machine ur playing right? Do you have DNS/RDNS setup ? If you do, i had the same problem in MMO, you need to modify ur windows host file and add "DNS name":localhost

sawcisson commented 1 month ago

The host and client are on different machines through steam. I just had some people who managed to make it work but they had huge delay in loading so my supposition now is that maybe some client load faster than server and don't have anything telling them to update coordinates.

insthync commented 1 month ago

Fixed: https://youtu.be/6_JB_vYzVpo

sawcisson commented 1 month ago

Could you please tell me how you fixed it and where should I update my file ?

insthync commented 1 month ago

In LanRpaNetworkManager.cs

Add

        private readonly HashSet<string> _teleportingPlayerCharacterIds = new HashSet<string>();

Screenshot_24

In function SpawnPlayerCharacter, find !CurrentMapInfo.Id.Equals(playerCharacterData.CurrentMapName) Add || _teleportingPlayerCharacterIds.Contains(playerCharacterData.Id) condition, and remove character ID from _teleportingPlayerCharacterIds later

Screenshot_25

In function WarpCharacter add character ID to _teleportingPlayerCharacterIds before proceeding to warp

Screenshot_26