Changes to the battle system?

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
meadwarrior
Journeyman
Posts: 91
Joined: Sat Dec 01, 2018 1:02 am

Changes to the battle system?

Post by meadwarrior »

Hello!

The last area I'd like to play around with before my mini-release is the battle system.
I'd like to ask if these changes to the battle system are possible and what the best way to approach them would be.
A few of them I've seen discussed in the forum already, but maybe some new developments happened in the last years.

:arrow: 1) Instead of choosing an attack method, pressing the action button immidiately executes an attack
Basically Eye of the Beholder-style combat. The underlying attack method would probably be the same for all weapons, so they only attack with their standard attack power, modified by strength.

:arrow: 2) Attack FX
After pressing the action button, I'd like an attack graphic (or animation) to be displayed in the viewport, depending on the weapon category used.
Imagine something called gfx.sword_swoosh or gfx.mace_whoomp ;)

:arrow: 3) Hit Pose/FX and damage display on monsters
After the monster got hit, it'd be great if it went into a brief 'ouch' pose, with the damage numbers displayed on top of it (not above the action buttons).

:arrow: 4) Windup pose before monsters attack
An indication before the monster's attack would be great (to enable players to evade better), preferably with a custom duration.

:arrow: 5) And lastly, a highter hit chance when attacking
I'd like to modify the attack in a way that almost never misses, or at least very seldomly. So far, I have maxed out luck, but I still feel like I miss quite often.

I have a few more, but these are the most important ones.
Thanks a lot!
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Changes to the battle system?

Post by Sophia »

meadwarrior wrote: Mon Jan 07, 2019 6:11 pm1) Instead of choosing an attack method, pressing the action button immidiately executes an attack
This is actually more difficult than it seems because DSB is somewhat hardcoded to do things the DM way. Popping up the attack methods allocates an internal array of attack method information that is then used when you actually click one of the methods. So, this would require some modifications to the core engine to actually be doable.
meadwarrior wrote: Mon Jan 07, 2019 6:11 pm2) Attack FX
You could probably add these fairly easily by applying a condition to the party when the attack is completed, and having that condition show the animation in the viewport. For 0.73 I'll add a h_weapon_attack to base/hooks.lua to make this easier.
meadwarrior wrote: Mon Jan 07, 2019 6:11 pm3) Hit Pose/FX and damage display on monsters
This isn't currently doable. It would require modifications to the C code that renders monsters, as I really can't see any way to do this in pure Lua that wouldn't be an atrocious mess.
meadwarrior wrote: Mon Jan 07, 2019 6:11 pm4) Windup pose before monsters attack
Monsters attack when they receive a M_ATTACK_MELEE or M_ATTACK_RANGED message. You can change what they do when they attack by rewriting these message handlers. However, I'm pretty sure a bunch of other code also relies on things working the way they do now, so some other code in base/monster.lua and base/monster_ai.lua would have to be rewritten. In short, it's doable, but it won't be easy.
meadwarrior wrote: Mon Jan 07, 2019 6:11 pm5) And lastly, a highter hit chance when attacking
You can brute force this by writing your own h_hit_calculation hook that modifies the hit calculation directly. For 0.73, I'll also add a bonus_attack property that can be assigned to the weapon arch and/or to the attack method, which will grant a hit bonus.
User avatar
meadwarrior
Journeyman
Posts: 91
Joined: Sat Dec 01, 2018 1:02 am

Re: Changes to the battle system?

Post by meadwarrior »

Thanks for your answers, Sophia! Now I have a better overview over what's doable and what I better leave like it is for now ;)
I'm looking forward to the new changes in 0.73, thanks for adding them!

:arrow: 1) When you say modifications to the core engine, you mean that it won't be possible by changing stuff in the .lua files in the base folder, right?

:arrow: 3) As for the damage numbers: Is there a way to move the damage graphic (the blue explosion that contains the damage numbers) to the middle of the viewport? I think when I tried it, it was quasi contained to the choose_method area, but I might have done something wrong.

:arrow: 4) If I displayed a whole attack animation instead of an attack pose, would the damage to our heroes be allocated at the end or at the beginning of the animation?
My thought: If the hurting happened at the end of the animation, I could achieve the windup effect nevertheless (provided the damage would actually check if the heroes are in front of the monster).
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Changes to the battle system?

Post by Sophia »

meadwarrior wrote: Mon Jan 07, 2019 9:53 pmWhen you say modifications to the core engine, you mean that it won't be possible by changing stuff in the .lua files in the base folder, right?
Right. After thinking about it, it might be sort of doable with a hack to sys_render_attack_method where you immediately 'click' (i.e., send a SYSTEM message) as soon as the menu comes up, but that's really an ugly hack, to be honest.
meadwarrior wrote: Mon Jan 07, 2019 9:53 pmAs for the damage numbers: Is there a way to move the damage graphic (the blue explosion that contains the damage numbers) to the middle of the viewport? I think when I tried it, it was quasi contained to the choose_method area, but I might have done something wrong.
Yeah, that won't work. You'd need to create a new bitmap and place it over the viewport, and probably keep its state up to date with global variables. Then you rapidly start getting into the "atrocious mess" I mentioned. :mrgreen:
meadwarrior wrote: Mon Jan 07, 2019 9:53 pmIf I displayed a whole attack animation instead of an attack pose, would the damage to our heroes be allocated at the end or at the beginning of the animation?
My thought: If the hurting happened at the end of the animation, I could achieve the windup effect nevertheless (provided the damage would actually check if the heroes are in front of the monster).
Unfortunately the damage is allocated at the beginning of the animation.
User avatar
meadwarrior
Journeyman
Posts: 91
Joined: Sat Dec 01, 2018 1:02 am

Re: Changes to the battle system?

Post by meadwarrior »

Sophia wrote: Mon Jan 07, 2019 11:06 pm Right. After thinking about it, it might be sort of doable with a hack to sys_render_attack_method where you immediately 'click' (i.e., send a SYSTEM message) as soon as the menu comes up, but that's really an ugly hack, to be honest.
If I'm honest, I'd still like to try it. I like the immidiate response a lot (and in my DM experience, it's virtually always better to use the hardest hitting attacks anyway, so it's not a big problem to loose the choices).
Sophia wrote: Mon Jan 07, 2019 11:06 pm Yeah, that won't work. You'd need to create a new bitmap and place it over the viewport, and probably keep its state up to date with global variables. Then you rapidly start getting into the "atrocious mess" I mentioned. :mrgreen:
I have the feeling that all my code will be an atrocious mess anyway :mrgreen: I'll try it!
Maybe it would be enough to just have a blood splatter FX or something when the hit connects, and then vary it's size depending on the damage (and keep the damage number info in the choose_method area)...
Sophia wrote: Mon Jan 07, 2019 11:06 pm Unfortunately the damage is allocated at the beginning of the animation.
Dang :wink:
How about making the monster do two attacks quickly after each other, where the first one does no damage at all/has a 0% chance to hit and contains the windup pose concealed as attack pose?
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Changes to the battle system?

Post by Sophia »

meadwarrior wrote: Mon Jan 07, 2019 11:48 pmin my DM experience, it's virtually always better to use the hardest hitting attacks anyway, so it's not a big problem to loose the choices
I came up with a new approach and it worked well. In DSB 0.73, you'll be able to set the one_click_method arch property to true on a weapon, and it will automatically invoke the first attack method if you click the weapon. If you'd rather use a different method, you can set default = true on one of your attack methods and it will automatically use that one. Setting default = true on an unarmed attack method will also work, and will be the only way to have one-click unarmed attacks since there is no weapon arch.
meadwarrior wrote: Mon Jan 07, 2019 11:48 pm I have the feeling that all my code will be an atrocious mess anyway :mrgreen: I'll try it!
Maybe it would be enough to just have a blood splatter FX or something when the hit connects, and then vary it's size depending on the damage (and keep the damage number info in the choose_method area)
Ok, so you'll need to add a new entry to the gui_info table and then write a sys_render_other function to handle it. (As well as whatever other custom UI graphics you have, if any) Beyond that I don't have any experience doing this sort of thing in DSB, so, you'll just have to try stuff... :mrgreen:
meadwarrior wrote: Mon Jan 07, 2019 11:48 pmHow about making the monster do two attacks quickly after each other, where the first one does no damage at all/has a 0% chance to hit and contains the windup pose concealed as attack pose?
Monsters don't really have attack methods and varying their attacks like that is actually more difficult than the original problem! So, that approach is probably out too. I really can't think of a "simple" way to do it.
User avatar
meadwarrior
Journeyman
Posts: 91
Joined: Sat Dec 01, 2018 1:02 am

Re: Changes to the battle system?

Post by meadwarrior »

Sophia wrote: Tue Jan 08, 2019 1:44 am I came up with a new approach and it worked well. In DSB 0.73, you'll be able to set the one_click_method arch property to true on a weapon, and it will automatically invoke the first attack method if you click the weapon.
Wow, awesome! Thank you very much. I'm looking forward to it! :mrgreen:
Sophia wrote: Tue Jan 08, 2019 1:44 am Ok, so you'll need to add a new entry to the gui_info table and then write a sys_render_other function to handle it. (As well as whatever other custom UI graphics you have, if any) Beyond that I don't have any experience doing this sort of thing in DSB, so, you'll just have to try stuff... :mrgreen:
Will do! Let's see what I can come up with, if anything at all :mrgreen:
Sophia wrote: Tue Jan 08, 2019 1:44 am Monsters don't really have attack methods and varying their attacks like that is actually more difficult than the original problem! So, that approach is probably out too. I really can't think of a "simple" way to do it.
Well, then I guess this was it for the monster attack indication poses ;)
Doesn't matter, it's mostly just a cosmetical addition.

Thanks!
Post Reply