• Advertisement
  • entries
    64
  • comments
    178
  • views
    110440

Musing about swimming...

Sign in to follow this  

1162 views

In gnoblins I use a dynamic water system, that is, some areas are flooded, you can flood or drain them. The question is now, how do your minions
or other creatures react to water ? This is no trivial game design decision and here are my musing and thoughts about this issue.

First off, what options do you have when you detect that a creature is in water ?
1. You can kill it immediatly.
Well, that would be little bit too harsh, wouldn't it ?

2. It would float helpless on the water, swinging wildly its arms and die after a certain time from exhaustion.
Thought you could try to drain the area, it would be very harsh too. There's no option to help your minion if you can't reach the lever to drain the area and it would be a too easy way to kill of invading enemies.

3. The creature can swim around, but will not be able to do any other actions like fighting or operating a lever.
Hmmm... sounds better, thought you can't operate with your environment or fight off any danger.

4. The creature can swim around and do most actions and still is able to fight to some degree.
Well, we are approaching a game design zone where swimming is more or less just a visual effect and don't have such a strong impact on the game play. So, what would be a good solution ?

After some musing I choose to continue with 3. Creatures can swim, but will not be able to interact with its environment while swimming.

Done ? No, we need to check the game mechanism in more detail. Here are some questions:
1. Can a creature reach a goal by swimming through a pool of water or does it always try to avoid water ?
The option to avoid water sounds easy, but what would happen if one of your creatures is trapped on a island ? You have no option to help it.

2. What is the behavior of a creature, if it is suddenly in water ?
It should try to reach dry ground, shouldn't it ? But this could interference with commanding your minion to reach a certain point:
entering water..eehh..water..leaving..ahh I need to reach my goal..entering water...eeehhh water...

3. Should it be allowed to have a goal in water ?
This would result, that a minion would try to reach an area to execute an action, which can't be executed because it is under water. A movement
command on the other hand would be valid. But what happen, when you start your movement at the time where the goal is not under water, but
at the time when you reach your goal, it is suddenly flooded ?

4. Should doors work in water ?
It is already hard to detect if a door is actually in water, there are floodgates, so on one side there's water, on the other side none. Not being
able to interact with your environment could be deadly for your creatures, especially if you are not able to operate doors. Do we need a special rule for doors ?

5. What about flying creatures ?
Hmmm.. flying creatures can ignore water, can't they ? What about interacting with the environment ? They should be able to fight swimming creatures, but can the interact with objects under water ?

6. Is water a safe haven from enemies ?
Ok, most creatures can't fight when swimming. So, just command your minions to enter water to avoid some strong enemies ? This would be too easy. Water must be dangerous if you linger too long in it, so we need to drain your power during swimming resulting in exhaustion after some time.

Hmmm..I need some ruleset for the behavior of creatures and water. This ruleset should answer all the questions from above in a satisfying way.
Here's my first attempt:
Rule 1: A none-flying creature will not fight when it is currently in water.
Rule 2: All other commands and tasks, which are planned by a creature do not depend on the creature being currently in water.
Rule 3: Planing does ignore goals being in water (exception: flying creatures targeting swimming creatures).
Rule 4: Planing adds a penalty to ways leading through water, but it does not completely avoid water.
Rule 5: Doors can be opened by a creature being in water.
Rule 6: Creatures can't interact with any other object in water.
Rule 7: When idleing/roaming a creature try to reach dry ground.
Rule 8: When in water a creature will exhaust much faster.

Eventually I need to think about how to implement all this rules.
Impl 1: The engine needs to sample the water level at a given position.
Impl 2: The pathfinding system needs to consider the water level at each waypoint.
Impl 3: A parameter to modify the way costs.
Impl 4: Each creature needs a swimming animation.
Impl 5: No automatic swimming detection in the animation system, the game logic should add an animation overlay when the creatures body is deep enough in water.
Impl 6: Creatures in water needs to exhaust much faster.
Impl 7: Lax animation boundaries to avoid animation flipping all the time at the water threshold (eg. enter swimming animation when water is 1m deep, exit animation when water is less then 80cm deep).
Impl 8: Sound overloading, we don't want to hear any footstep sounds when swimming.
Impl 9: Target planing, check if a target is in water at the time of planing to avoid unnessary decisions.
Impl 10: A in_water state at the entity to quickly check it in game logic.
Impl 11: When executing an action, abort it once the creature detects, that it is in water.
Impl 12: Physics: no change in the physics part, the entities will still be grounded. This way I will avoid trouble with doors etc.
Impl 13: Rendering, add a visual flag to indicate, that the rendered object is floating at the water surface (Performance bonus, only rendered objects needs a detailed evaluation of the surface)

Sounds solid, enough to start a first implementation. Coding time biggrin.pngbiggrin.pngbiggrin.png
Sign in to follow this  


3 Comments


Recommended Comments

It sounds like your creatures are not under the player's direct control. Almost sounds like a Dwarf Fortress or Dungeon Keeper type of control. If that's the case I had some ideas.

 

Have the choice of whether a create enters the water to achieve it's goal vary from creature to creature. Some creatures can be petrified of water (instantly cancelling any order given to it that would lead to water) while others give it no mind at all (will go right in!) This may add to a creatures over all personality, and maybe even the drama for the player ("please open that door! Come on! WHAT DO YOU MEAN YOU DON'T LIKE WATER?!")

 

You mention flying creatures aren't effected by water... but what if they're in an enclosed space (like DF or DK)? Couldn't the water reach the ceiling? If it does, wouldn't the flying creature need to be effected by it?

 

Why limit the underwater actions to just doors? If the creature can open a door, can't they pull a lever or press a switch as well?

 

Maybe the creatures can even "rescue" other panicking creatures. If you have the petrified creature, who is suddenly engulfed in water, maybe he panics and flails. On the shore, a "brave" creature (who is otherwise idle) may see his panicked comrade and decide to save him.

 

I don't know how feasible any of that is with your system, but just some thoughts that came to mind.

Share this comment


Link to comment

Sounds great, and offers more opportunity for gameplay.

 

You could have enemies that are more water-friendly, that can *walk* under the water just as easily as they can walk on land. Some kind of mer-goblin (mermaid-goblin). They can then attack enemies trying to stay afloat by dragging them down under the water and drowning them. And, you won't need separate swimming animations for them! :P

 

You could also have powerful fire-elemental enemies (and weaker will-o-wisp enemies) that do instantly die when they get flooded, making flooding an area a potentially good strategy against some types of enemies, but not others. Again, no separate swimming animation for these units.

 

And you can have a balrog-like creature that has fiery aspects to it, that when it gets flooded, it gets weakened, and stays weakened after being un-flooded, until enough time has past that it re-bursts into flames. This provides a way to basically use the environment to majorly debuff a powerful enemy for a short period of time.

Some enemies like this, that are larger enemies, when flooded they could just duck down and huddle on the ground, weighted down by their bulk, and basically just freeze all actions, until the water recedes, saving animation work. (stone golems or similar, if you have them, could also just "sink" in a crouched huddle, and not move until the water recedes)

 

Does flooding a room put out your torches? Does that have any game-play related or grue-related effects? Are there ways we (players) can use darkness to benefit us in some circumstances, and are there ways for the enemy to benefit from the darkness in other circumstances? Environments are double-edged swords, knowing no ally.

 

To simplify the doors being under water, you could make it so that a door flooded on one side and not-flooded on the other cannot be opened except by explicit user action (because it'd flood additional rooms).

 

A door flooded on both sides should be automatically opened, and cannot be closed except by explicit user action (if the player wants to intentionally drain a nearby room).

Share this comment


Link to comment

Thx, great ideas you both got here :-)

 

 

Almost sounds like a Dwarf Fortress or Dungeon Keeper type of control. If that's the case I had some ideas.

Yes,it is a mix of both.

 

 

Why limit the underwater actions to just doors? If the creature can open a door, can't they pull a lever or press a switch as well?

This would at least leave some option (find the lever in the murky water to drain the water).

 

 

Some kind of mer-goblin (mermaid-goblin). They can then attack enemies trying to stay afloat by dragging them down under the water and drowning them. And, you won't need separate swimming animations for them! tongue.png

Hmm... I already thought about some fish like creature only living in water. At least this creature would be very similar to flying creature, that is they keep the attack ability and could even do more stuff, thought the would be under water.

 

 

You could also have powerful fire-elemental enemies (and weaker will-o-wisp enemies) that do instantly die when they get flooded, making flooding an area a potentially good strategy against some types of enemies, but not others. Again, no separate swimming animation for these units.

I will try to give a creature a "in water" effect, which depends on the creature. This way I could attach a dot to a fire-elemental, a slow to a normal creature and maybe even a haste and attack bonus to a water creature.

 

 

Does flooding a room put out your torches? Does that have any game-play related or grue-related effects? Are there ways we (players) can use darkness to benefit us in some circumstances, and are there ways for the enemy to benefit from the darkness in other circumstances? Environments are double-edged swords, knowing no ally.

You have a fog of war, you can more or less only see what your minions see, but each torch you place removes the fog of war for this tile. When an invading force enters your dungeon,it is vital to see what and how many enemies approaches. In this sense a flood which turns off or even destroys torches would have a nasty side-effect.

One issue is, that the flood-system is updated continously and you can have several thousand objects in a dungeon, so, checking if a torch is in-water or not could stress the performance... I need to think about the option, nevertheless, a nice idea.

 

 

To simplify the doors being under water, you could make it so that a door flooded on one side and not-flooded on the other cannot be opened except by explicit user action (because it'd flood additional rooms).

 

A door flooded on both sides should be automatically opened, and cannot be closed except by explicit user action (if the player wants to intentionally drain a nearby room).

Doors work currently automatically (if a minion approaches, it opens). Doors are an important defense feature and each door will let water through(slow it down), but there are although floodgates which prevents the water flow. Maybe floodgate should only be opened/closed manually and I keep doors the way they are (automatically opening)

 

Nevertheless, great ideas. I will implement the first interation and present the result here,thought I will need some time.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement