draconisPW / PWMAngband

A free, multi-player roguelike dungeon exploration game based on Angband
35 stars 12 forks source link

monsters and water #394

Closed igroglaz closed 1 year ago

igroglaz commented 3 years ago

The last cheezy breach which left in PWMA is water. A lot of monsters can't pass water (while player can ezpe!), so it's possible to kill monsters by cheezing from another shore. It looks especially stupid when there is only 1 water tile between monster and player.

There is RF_LEVITATE flag, but we can't give it to all monsters, eg orcs, 'p'ersons etc..

There could be several solutions to avoid this cheeze:

1) add RF_CAN_SWIM flag which will work in special way, eg --- when monster swim - he spend 2 turns of energy to pass 1 tile (btw the same thing could be implemented for player) --- when monster stay inside in the water - he got malus in attack paramater (also could be + to player)

OR

2) make monsters search another way to player, not to stay stupidly near the border of water... so if monster 'see' that player can't be accessed cause of water - he tries to find another pathfinding toward player

Also maybe there are another ways to solve it, lets brainstorm

igroglaz commented 3 years ago

OR

3) give new flag RF_JUMP which gives monster possibility to jump over 1 tile of water towards player.. someking of phase door thingy.. so lets leave wide waters as it is, but at least 1 water tile monsters could pass. Ok, lets add it to new point:

OR

4) RF_PASS_ONE_WATER - flag which allow monster to swim over 1 water tile

igroglaz commented 3 years ago

btw I wonder how TomeNET solves this issue... can't remember exact way, didn't played it for 2 years. But I suppose there was some workaround as I don't remember cheezing this way

igroglaz commented 3 years ago

another way to rabalance it - make water much more dangerous than now for player.. I suppose it's the TomeNET way. make equipments rust, scrolls dissolve, make water dmg more etc/ quite good solution too.

draconisPW commented 3 years ago

There is somewhere in V code a check about damaging terrain and mobs able to cross if the damage doesn't exceed a fraction of their HP. I need to look for this and adapt for every damaging terrain.

s88100 commented 2 years ago

TomeNet uses A pathfinding algorithm (A-star) tomenet/src/common/defines-features.h _Allow monsters with AI_ASTAR r_info flag to use A pathfinding algorithm?_ #define MONSTER_ASTAR tomenet/src/server/melee2.c Purpose: Monster spells and movement Get monster moves for A* pathfinding get_moves_astar()

in V src/mon-move.c This function is responsible for deciding where the monster wants to move, and so is the core of monster "AI". get_move()

igroglaz commented 2 years ago

T solution for monster's water walking: https://github.com/igroglaz/Tangaria/commit/d856512c95f90f436b7d70e0e324649b9b32cf4f

igroglaz commented 2 years ago

Not sure should this ticket be open as it's was /rfe for T and it's implemented (a bit crude, I'll continue to polish). So for now I'm closing this; it could be reopened if needed.

draconisPW commented 2 years ago

No idea why this was closed, it was planned for 1.6.0.

draconisPW commented 2 years ago

This will be really tricky to fix because:

igroglaz commented 2 years ago

what do you think about T implementation? https://github.com/igroglaz/Tangaria/commit/d856512c95f90f436b7d70e0e324649b9b32cf4f (it might be changed a bit since that old commit, don't remember). Simple, but yet works good ;)

draconisPW commented 1 year ago

Ok looking at the code in mon-move there is only one thing to do here:

Hope it works this way.

draconisPW commented 1 year ago

Works fine except a tiny problem: when the player is faster than the monster, the monster spend multiple turns on the damaging tile and the damage is applied multiple times. In this case, the damage should be only applied once.

draconisPW commented 1 year ago

In fact, damaging terrain ticks every game turn, not every player/monster turn. For example, a monster at normal speed gets 10 energy per game turn and is able to act once it has 100 energy, meaning every 10 game turns. If that monster stands on damaging terrain, damage will be applied 10 times. Until V dev team takes a stance about this, I'll apply the damage only once per monster turn.

draconisPW commented 1 year ago

Implemented as above.