miwarnec / uMMORPG

4 stars 0 forks source link

NetworkZones/Mirror Problems #1

Closed astromediaonly closed 5 years ago

astromediaonly commented 5 years ago

Versions (please complete the following information)

Describe the bug There are multiple problems im/was experiencing:

1) There was issue causing probably this error after going to second map using NetworkZones: NullReferenceException: Object reference not set to an instance of an object at Mirror.NetworkServer.InternalListen (System.String ipAddress, Int32 serverPort, Int32 maxConnections) [0x00000] in :0 at Mirror.NetworkServer.Listen (Int32 serverPort, Int32 maxConnections) [0x00000] in :0 at Mirror.NetworkManager.StartServer () [0x00000] in :0 at NetworkZone.Awake () [0x00000] in :0 It started happening after i manualy downloaded Mirror on top of latest versions of uMMORPG and NetworkZones. This was sorted out after i copied Mirror from latest uMMORPG install tho - there is/was probably some bug in Mirror not packed yet to latest install of uMMORPG.

2) I had some issues with dissapearing player after some time mostly on nostarting map (seemed random)

3) There were some issues displacing objects with networkidentity without any obvious reason on client only it seemed (on host it was ok) ... this was probably resolved after removing and readding network zones but im not sure why nor whot caused it so im afraid it could reappear

4) There were some other exceptions/server crashes in Mirror i was experiencing on nonstarting map also but i cant currently find out details ... i will extend this topic after getting more info.

To Reproduce Steps to reproduce the behavior, please explain every single click that is needed: I have not yet found out, im curently investigating.

System (please complete the following information):

Additional context ...

astromediaonly commented 5 years ago

Update to point 4) One of errors which were appearing after some changes is this type: OnDeserialize failed for: object=Bandit component=Monster sceneId=3 length=4. Possible Reasons:

System.IO.EndOfStreamException: Failed to read past end of stream. at System.IO.BinaryReader.FillBuffer (Int32 numBytes) [0x0005b] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/BinaryReader.cs:119 at System.IO.BinaryReader.ReadString () [0x00059] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/BinaryReader.cs:486 at Mirror.NetworkReader.ReadString () [0x00000] in :0 at Entity.OnDeserialize (Mirror.NetworkReader reader, Boolean initialState) [0x00000] in :0 at Monster.OnDeserialize (Mirror.NetworkReader reader, Boolean initialState) [0x00000] in :0 at Mirror.NetworkIdentity.OnDeserializeSafely (Mirror.NetworkBehaviour comp, Mirror.NetworkReader reader, Boolean initialState) [0x00000] in :0 UnityEngine.Debug:LogError(Object) Mirror.NetworkIdentity:OnDeserializeSafely(NetworkBehaviour, NetworkReader, Boolean) Mirror.NetworkIdentity:OnDeserializeAllSafely(NetworkBehaviour[], NetworkReader, Boolean) Mirror.NetworkIdentity:OnUpdateVars(NetworkReader, Boolean) Mirror.ClientScene:ApplySpawnPayload(NetworkIdentity, Vector3, Byte[], NetworkInstanceId, GameObject) Mirror.ClientScene:OnSpawnSceneObject(NetworkMessage) Mirror.NetworkConnection:HandleBytes(Byte[]) Mirror.NetworkConnection:TransportReceive(Byte[]) Mirror.NetworkClient:Update() Mirror.NetworkClient:UpdateClients() Mirror.NetworkIdentity:UNetStaticUpdate() Mirror.NetworkManager:LateUpdate()

Seems like its realy easy to break it for me this way but i didnt figured yet what is wrong. There is probably something not properly handled so error will end up there? Last time it happened after copying map from fresh project into my project and updating references to networkzone scripts (everything else seemed in place) ... and i have replaced starting map of my project with this one ... could be some id missmatch cause this?

astromediaonly commented 5 years ago

So some issues were probably caused by adding dontdestroyonload object with networkidentity into project and Mirror seems to have problem with that (atleast thats what Paul sayed to me ... seems to be true from my test) ... not all of them tho .. i will add another comment if i will find out more.

astromediaonly commented 5 years ago

I will look into it no more and most of the problems were resolved somehow so im closing it. Conclusion is - its so easy to break stuff in uMMORPG and really hard to debug why :)