Monday, 14 March 2011

The pit problem

A pit in two-dimensional game can produce unwanted logic problems. It's lower than ground level so there should be support for third dimension. But sometimes there isn't and that's the problem in Kaduria. Let's say you push a boulder in the pit. That's easy. What happens if there is something in the pit already, like another boulder or a monster? They don't fit in the same pit, but there is no way to put the boulder on top of anything, because there isn't support for third dimension.

I guess it's time to add that support. I really tried to go with only two dimensions, but it's impossible with the level of complexity Kaduria has.


  1. Why not just allow multiple objects per tile, storing them in some sort of ordered list for each tile, so that the item at the top of list is at the top of the pile, second item is underneath that one, etc?

    Far, far, far simpler than implementing 3D.

  2. It's already possible to have more than one object per tile. That's not the problem. It's the movement in 3D space, collision tests and stuff like that. Maybe it's easiest to create some kind of physics rules to avoid handling a lot of special cases. However it's going to change things.

  3. Treat the boulder, statues, and other large, pit-covering "items" as a special class of monsters. Set up pits so that, if a monster is in it, it is held immobile until it climbs out (if it can).

    In your monster collision code, allow monsters (and the player), to step over other monsters if they are on a pit tile.

    The trouble with this is you create a situation where two monsters are on the same tile, and you have to decide whether to provide support for allowing the top monster to attack the bottom monster or vice versa. A potential solution to this, is allowing the player to step "over" the pit/monster, onto the other side, and only allow ranged combat between them (since bump-attack melee causes the jump).

    Unless you plan to have lots of boulder-covering-pits scenarios, it might be a good idea to skip this special functionality.

    Best of luck!

    Ebyan "Nolithius" Alvarez-Buylla