crazy2be / buildblast

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

Players shouldn't fall through BLOCK_NIL #143

Open crazy2be opened 10 years ago

crazy2be commented 10 years ago

Right now, if you are on a crappy internet connection, and the game can't load chunks fast enough, you will fall through them. This is because BLOCK_NIL is not treated as solid by the physics system. Howover, we can't just treat it solid, because:

If we treat it as solid, then when you spawn, you will start to fly upwards as the game searches for air.

If we treat it as not solid, then when you spawn, you will start to fall downwards, and when you move faster than chunks can load, you will be able to "fall off the edge" until the chunks are generated/loaded.

So we need another category. Like a semi-solid, a liquid sort of. If you are IN BLOCK_NIL, then you shouldn't fall, rise, (or even be able to move?). If you are outside of BLOCK_NIL, trying to move in, then you should be able to.

crazy2be commented 10 years ago

Worth noting- this causes problem not only with unloaded chunks client-side, but also server side- I tried to implement falling damage at one point in the past, but couldn't do so properly because of this bug. (In particular, when players first spawned, they would get falling damage because the chunks weren't generated yet, so they would be simulated as falling for several frames).

kieve commented 10 years ago

You suggested solution feels like a hack. I think we need to do more work in the "stages" of our game. Loading, game start, spawning, ending the game, and some phase between games. We can solve this bug as we build the game modes, as it fits nicely into that workflow.

crazy2be commented 10 years ago

Hmm... Maybe that's true. I guess if we had a "loading" stage where physics simulations aren't done, and then treated BLOCK_NIL as solid in all other situations, that would also fix the bug mentioned here. I guess that's probably something we want to move toward anyway. But... that solution does probably require more code upfront. Hmm...