BigMacintosh / Parking

Year 3 Games Project
MIT License
6 stars 0 forks source link

An attempt to move a despawned player causes a KeyNotFoundException #226

Open ChrisGora opened 4 years ago

ChrisGora commented 4 years ago
Round 1 ended. 
Eliminated Players: 2 
Next num players 2. 
Continuing the game... 
Server: Destroyed player 2 due to disconnect (via elimination). 

KeyNotFoundException: The given key was not present in the dictionary.
  at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x0001e] in <c79628fadf574d3a8feae0871fad28ef>:0 
  at Game.Entity.World.MovePlayer (System.Int32 playerID, Game.Entity.PlayerPosition playerPosition) [0x00006] in <10a9877c3a124d70a99c1d723d0d632c>:0 
  at Network.Events.ClientLocationUpdateEvent.UpdateLocation (Game.Entity.World world, System.Int32 playerID) [0x00008] in <10a9877c3a124d70a99c1d723d0d632c>:0 
  at Network.Server.Handle (Network.Events.ClientLocationUpdateEvent ev, Unity.Networking.Transport.NetworkConnection srcConnection) [0x0000e] in <10a9877c3a124d70a99c1d723d0d632c>:0 
  at Network.Events.ClientLocationUpdateEvent.Handle (Network.Server server, Unity.Networking.Transport.NetworkConnection connection) [0x00000] in <10a9877c3a124d70a99c1d723d0d632c>:0 
  at Network.Server.HandleEvent (Unity.Networking.Transport.NetworkConnection connection, Unity.Networking.Transport.NetworkEndPoint endpoint, Network.EventType eventType, Unity.Networking.Transport.DataStreamReader reader, Unity.Networking.Transport.DataStreamReader+Context& readerContext) [0x0006e] in <10a9877c3a124d70a99c1d723d0d632c>:0 
  at Network.Server.HandleNetworkEvents () [0x0018d] in <10a9877c3a124d70a99c1d723d0d632c>:0 
  at Game.Main.ServerGameLoop.Update () [0x00000] in <10a9877c3a124d70a99c1d723d0d632c>:0 
  at Game.Main.Game.Update () [0x000e4] in <10a9877c3a124d70a99c1d723d0d632c>:0 
RileyEv commented 4 years ago

Oh I think me and jack may have found this. The error depends on who actually disconnects. If its what I'm thinking of its to do with sending on fixed update a packet that was prepared in update and part way through that update the player is removed from the world