crazy2be / buildblast

Build a base, shoot intruders
MIT License
5 stars 1 forks source link

Mining too many blocks can render the server permanently defunct #186

Open crazy2be opened 8 years ago

crazy2be commented 8 years ago

How to reproduce:

  1. Mine a lot of blocks (but don't pick up the mini blocks that are dropped)
  2. Get kicked from the server (too much lag from all the block updates?)
  3. Observe that neither you, nor anyone else, can actually join the server anymore.

This seems to be caused by poor prioritization of messages. These mini blocks don't really matter very much, the game should be able to just incrementally load them. However, with the current client<->server sync model, this is difficult, so we just try and send entity-create messages for all of the dropped blocks in the world, and end up filling our send buffer.

Instead, the server should have a doohickey for each client which keeps track of state in the world, and the state that it's client sees, and when they are out of sync it tries to synchronize them, but does it intelligently. So changes nearby the player are synced first, other players are more important than block updates, etc.