KittehOrg / Spectastic

MIT License
0 stars 0 forks source link

Safe Spawning #1

Open meyerzinn opened 8 years ago

meyerzinn commented 8 years ago

So we all know people are going to be a*** and place blocks where someone spectates. Therefore, I propose the following algorithm for determining a "safe spawn":

safe(pos) = (a) no lava or harmful liquid above or below the position without a separating block. (b) no blocks that could suffocate or trap the player (spider webs?) (c) a player could AFK there safely (without drowning).

  1. Get the block where the player came from. If it's safe, go there. Otherwise, continue.
  2. Calculate the next element of the golden spiral, based on the original position. Check all blocks in that element for safety. If at any point a block is safe, escape the algorithm.
  3. If there is no safe block in the spiral, go back to 2.
  4. If after a configurable amount of steps no safe location was found, teleport to the top of wherever their original location was (if it's safe as well) or to spawn or another configurable strategy.

This has the benefit of returning them as close to their original location as possible while progressively broadening the search.

mbax commented 8 years ago

Now having more free time to talk about this.

So, store player's location along with the game mode when spectating.

As for defining safe: What if lava is making its way down? :3

meyerzinn commented 8 years ago

That’s why you check for lava above/below for, say, 10 blocks? But “safe” is a hard definition, what do you think of the concept of spiraling to find the closest possible location?

On Mar 15, 2016, at 11:23 AM, Matt Baxter notifications@github.com wrote:

Now having more free time to talk about this.

So, store player's location along with the game mode when spectating.

As for defining safe: What if lava is making its way down? :3

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/KittehOrg/Spectastic/issues/1#issuecomment-196905974 https://github.com/KittehOrg/Spectastic/issues/1#issuecomment-196905974

mbax commented 8 years ago

Spiraling sounds fun, but predictable. For fun I'd like to change direction of spiraling ^_^

meyerzinn commented 8 years ago

It’s the golden spiral… you could start it in any direction ^^.

On Mar 15, 2016, at 12:31 PM, Matt Baxter notifications@github.com wrote:

Spiraling sounds fun, but predictable. For fun I'd like to change direction of spiraling ^_^

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/KittehOrg/Spectastic/issues/1#issuecomment-196938312

mbax commented 8 years ago

Pfffffft

ryantheleach commented 8 years ago

Make the safe area slightly larger, teleport the player to the position they are going to spawn in, still in spectator mode, Limit their movement to that safe area, and let them exit it either by clicking or interacting or something?