-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Allow monsters to have different climb/swim/dig speeds #80849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Oh wow, this is a pretty nifty addition! I personally would love to see a system akin to the PC, with Speed and general Movement also apply to monsters (I find it infuriating how a creature can do 4 attacks in a row at lightning speeds, despite one only wanting to translate how fast they can move), but to have consideration for different movement styles is a really nice addition, if not the first step towards the former. |
Definitely out of scope for this PR, but I agree in general. I didnt find how PC implements it though. |
calc_climb_cost use mod
define max_obstacle_penalty
The core functionality should be ready. Just have to double check some things and write docs/tests. |
Add forced movement to calc non climbers cannot climb ladders (TFLAG_DIFFICULT_Z)
Summary
Infrastructure "Allow monsters to have different climb/swim/dig speeds"
Purpose of change
WIP, Feedback very welcome
closes #80846 , closes #80673
previously monster movement calculation would just return hardcoded values, which ignored many possible modifiers. Not happy with my original fix (#80673), I decided to rework how special movements get calculated, by allowing monsters to have movement-skills in those special movement types.
Describe the solution
Make a new optional JSON field for movement skills (every entry is also optional):
Where having some value allows the monster to do the action and the value itself would say how fast it can do the action.
with the general formula
or the less readable, but equivilent
movecost = (movecost_from + movecost_to)*25;
where
movecost_from
andmovecost_to
would be tile-movecost if its not climbable/dig-able/swim-able and calculated from the "move_skills" if it can traverse and has the respectivemove_skills
(or for backwards-compatibility the flag) set.The skills get translated into multipliers as what percentage of some
max_obstacle_penalty
should be applied.mod = max_obstacle_penalty - skillvalue * max_obstacle_penalty / 10
(10 is the max skill).that mod (usually) gets multiplied by the relevant terrain-/furn-cost.
That will drastically change balance, as previously terrain-/furn-cost did not
TODO:
Example:
Misc. changes:
DIFFICULT_Z
. Previously the flag didn't get checked for by monsters. (boars could climb ladders??)DIFFICULT_Z
climbing scales with climbmodDescribe alternatives you've considered
Instead of multiplying movecost by the skill-mod, add a flat penalty. But intuitively cost should scale more with difficulty.
Testing
TODO
Additional context
calc_movecost generally only expects valid movements, throwing debugmessages if its not. When thats the case it needs to be filtered out in the pathfinding (if the obstruction is permantend) or
move_to
(if the obstruction is not permanent) function.Cataclysm-DDA/src/monmove.cpp
Lines 1888 to 1890 in 93e97e5
calls
monster::calc_climb_cost
when the monster climbs and target tile has no floor, butcalc_climb_cost
then only returns a valid number if the monster flies or there is a floor, so its only usefull for fliers:Cataclysm-DDA/src/monmove.cpp
Lines 1589 to 1603 in 93e97e5