andybalaam / rabbit-escape

Android and PC game inspired by Lemmings and Pingus
http://artificialworlds.net/rabbit-escape
GNU General Public License v2.0
75 stars 42 forks source link

RFC: Hydrodynamics #298

Closed tttppp closed 8 years ago

tttppp commented 8 years ago

This isn't Minecraft, but maybe it could get a little closer...

This is a discussion of water, how it affects rabbits and how it interacts with its surroundings.

I propose four water related states:

  1. Springs - water is generated by these.
  2. Water fall - This is a square through which water is falling.
  3. River - This is water about half a square deep, which is non-fatal to rabbits.
  4. Pool - This is water a whole square deep and is fatal to normal rabbits (introduction of snorkels may change things).

Water will follow a path according to the following rules:

  1. A space with a water fall, spring or river above it becomes a water fall.
  2. A water fall with ground or pool under it becomes a river.
  3. A space with ground or pool under it and river next to it becomes a river.
  4. A horizontal row of rivers squares bounded at both ends by walls/ramps becomes a horizontal row of pool squares.
  5. A pool or river without ground under it becomes a water fall (e.g. could be caused by bashing).
  6. A pool with water fall next to it becomes a river.
  7. A horizontal collection of river tiles without a water fall or spring above them dries up (I think this rule in particular needs some thinking about).

Only solid blocks and ramps affect water - bridges have no impact.

Water movement/changes could either be at some speed, or instantaneous. I'm not sure how I feel about this.

colonelfazackerley commented 8 years ago

This simple level triggers the problem too

:solution.1=3
r

The rabbit is out of bounds, so the world.waterTable.getItemsAt( rabbit.x, yCoordinate ) call is too, I think.

andybalaam commented 8 years ago

World record for smallest valid test case?

tttppp commented 8 years ago

When I looked at it I thought the Lookup table handled out of bounds for me by allowing a border of one space all the way around. I think the rabbit gets to be two spaces out of bounds, which I didn't think was possible. Anyway, thanks for the test case.

tttppp commented 8 years ago

Of course, rabbits fall two spaces per step.

tttppp commented 8 years ago

We need to decide whether bridges should block water flow or not. In the original pull request (tttppp/Water) bridges have no impact on water. I've just created a branch (tttppp/BridgesStopFlow) where water is blocked by bridges. If bridges are made out of "EARTH" then logically I think they should stop water, but other than that I don't have a good reason either way.

Once we pick the interaction we are probably stuck with it, as redirected water breaks some of the solutions to water levels I've created so far. Some of the levels work either way, so I think we should consider which is best for puzzletunities.

colonelfazackerley commented 8 years ago

maybe let water go through bridges.

anything else will complicate the graphics. would the WaterRegion know if the water in the bridge cell was above or below the bridge?

tttppp commented 8 years ago

At the moment a WaterRegion just knows which directions it is (potentially) connected in. It doesnt know anythong about its neighbours, so a space surrounded by square blocks thinks it is connected in all four directions. Due to the blocks in existence at the moment, that information is enough to work out the exact shape of the WaterRegion. A WaterRegion that is only 'connected' upwards looks like a right angled triangle with its hypotenuse at the top of the cell.

We could come up with a better interface of necessary, which would allow us to deal with new blocks.

andybalaam commented 8 years ago

Allowing water through bridges sounds simpler and makes sense physically (because there must be a space for the rabbits to get past. I am worried that bridges blocking water is better puzzle wise but am leaning towards simplicity, since this is already more complex than anything else in the game.

tttppp commented 8 years ago

Ok, thanks all for your thoughts. It sounds like bridges letting water through is the best option. If we later want some way for rabbits to block water then I suggest we create a new token so rabbits build blocks (or ramps?)

colonelfazackerley commented 8 years ago

Building blocks sounds like a good idea.

ramps are necessary, but complicated.

andybalaam commented 8 years ago

Further support for water flowing through bridges:

( P  )
 (  )
  ()  j
#######

If I got the phone ascii right, this rabbit will drown which seems pretty unfair.

andybalaam commented 8 years ago

That is supposed to be a jug, which the rabbit can freely walk into, and then drown.

andybalaam commented 8 years ago

Closing this because it's too massive and takes me minutes to scroll through on my phone. (And because I merged @tttppp 's pull request). Feel free to open new issues for further discussions.

Snapshot 0.8.0.7 is here: http://artificialworlds.net/rabbit-escape/snapshots/

tttppp commented 8 years ago

This sounds like more proof that bridges aren't actually made of EARTH.

I'm closing this epic thread, and suggest that if there are any remaining issues then they are turned into new tickets. Obviously the water graphics already has a ticket.

BenjaminBalaam commented 8 years ago

I think bridges aren't very solid I mean there quite thin and slopes are quite thick aren't they