D10 combat

Bronteboghopper
16 Jul 2016, 02:59

I am looking to write a game with a combat system similar to WOD. Each person will roll a number of D10s in attack (depending on how tough they are) each 8, 9, 10 is a success (tens get a reroll).

The heroes defence is deducted from the attackers dice pool. So if you have an attack of 5 and a defence of one your final attack will consist of 4 dice being rolled.

Each villain will attack after a set time has passed (say 5 seconds). The hero will also attack after a set time as well.
If a hero tries to flee before the end of combat there will be an attack of opportunity from the enemy.


XanMag
16 Jul 2016, 03:42

Whew. Before you start writing a game with this kind of combat system, I suggest, and hope, that you have a high level of comfort with coding or using the Quest GUI. This is pretty complex stuff. Before someone jumps on here and spends a considerable amount of time offering advice or solutions for this, it would be a great comfort to know that you have some experience with Quest/coding. If there is any level of doubt with this, I would suggest starting VERY small with some test games. Create one room and one villain, create your code, and test it. Start small.

There is at least one combat library out there (I believe it is authored by The Pixie), but I do not think it is geared toward what you are trying to implement. If the community knows that you have a high level of experience with coding/Quest, then I'm sure they will offer great help. If you do not have that level of experience, I fear that they would waste their time responding.

I only say that because I am a code noob but have been using Quest for a couple years. I have not attempted a combat system yet (essentially because I am not good enough myself), but I am trying to implement a VERY simple one with my most recent WIP. What you are attempting is pretty advanced stuff. Just a warning.

BUT, if you are comfortable climbing this mountain, I'm sure help is on the way, but please let us (them) know your level of experience/comfortability using Quest and your experience with code.

I'd help, but I am in no position to suggest anything useful! lol

Good luck!

XanMag


hegemonkhan
16 Jul 2016, 07:24

I'm not familiar with WOD, but going from your post, if I understand it...

also, using actual clock-time is messy (especially via online play), so you might want to use the internal turns (which is basically any clicking on hyperlinks/buttons/etc and/or entering typed-in input while playing the game) instead.

quest already nicely has a built-in dice rolling Function:

http://docs.textadventures.co.uk/quest/functions/corelibrary/diceroll.html


HK Edit: found what WoD is, hehe: https://en.wikipedia.org/wiki/World_of_Darkness (excerpt seen below)

The new World of Darkness rules are much more streamlined than the previous system. One 10-sided die is rolled for any 'dot' possessed in Attributes and Skills, and 1 success is achieved for every die showing a result of 8 or higher. The "10-again" rule has been added, in that a 10 indicates a re-roll, and the 10 still counts as a success (this rule was present in the original WoD only for Traits ranked at least 4 out of the usual maximum of 5, and then only for a "Specialty" or particular sub-field of the Trait's application). If another 10 is rolled, this step is repeated until anything but a 10 is rolled. 'Exceptional Successes' are indicated by having 5 or more successes on the action and can be regulated by the Storyteller. 'Dramatic Failures' are now only possible on "Chance" die rolls: When a dice pool is reduced by penalties to 0 or less, a single Chance die is rolled. If a 10 is rolled, it is a success (and, as mentioned above, is re-rolled). If the result is less than 10 but not 1, then it is a 'Simple Failure'. On a Chance die, if the roll is a 1, then it is a 'Dramatic Failure', which is usually worse than a Simple Failure of the action and is regulated by the Storyteller (although examples of Dramatic Failures in certain situations are occasionally given).

The game also features a much more simplified combat system. In the old system, each attack made during a combat scene could easily involve 4 separate rolls and, in many cases, required more due to supernatural abilities possessed by the characters. Combat scenes involving large numbers of combatants could take a very long time to resolve.

The new system requires only 1 roll which is adjusted by the defensive abilities of the character being attacked and represents both the success and failure of the attack, as well as the damage inflicted (indicated by number of successes).


using the 'new (simplified) rule system'... though this too is a bit unclear (grr!), as I'm not quite sure of everything that you need from just your post's contents, here's an example:

(also, this does NOT implement/include when the attacker and defender attacks, nor deals with if they flee/run away/escape or not)

<object name="player">
  <attr name="attack_integer_attribute" type="int">10</attr>
  <attr name="defense_integer_attribute" type="int">5</attr>
</object>

<object name="orc">
  <attr name="attack_integer_attribute" type="int">8</attr>
  <attr name="defense_integer_attribute" type="int">4</attr>
</object>

<object name="dragon">
  <attr name="attack_integer_attribute" type="int">11</attr>
  <attr name="defense_integer_attribute" type="int">6</attr>
</object>

// where-ever (whatever scripting/inside of whatever Element) you want to use to activate the Function:
combat_function (player, orc) // the 'player' attacks the 'orc'
combat_function (orc, player) // the 'orc' attacks the 'player'
combat_function (player, dragon) // the 'player' attacks the 'dragon'
combat_function (dragon, player) // the 'dragon' attacks the 'player'

// your Function (what it does):
<function name="combat_function" parameters="attacker_object_parameter,defender_object_parameter">
  success_integer_variable = 0
  failure_integer_variable = 0
  damage_integer_variable = 0
  number_of_dice_rolled_integer_variable = attacker_object_parameter.attack_integer_attribute - defender_object_parameter.defense_integer_attribute
  if (number_of_dice_rolled_integer_variable < 1) {
    msg (attacker_object_parameter.name + "'s attack failed to penetrate " + defender_object_parameter.name + "'s defense.")
  } else {
    while (number_of_dice_rolled_integer_variable > 0) {
      roll_result_integer_variable = DiceRoll ("1d10")
      if (roll_result_integer_variable = 10) {
        success_integer_variable = success_integer_variable + 1
      } else if (roll_result_integer_variable > 7) {
        success_integer_variable = success_integer_variable + 1
        damage_integer_variable = damage_integer_variable + roll_result_integer_variable // this is your accumulated (sum'ed up total) damage // if you need the individual damage for each roll, let me know
        number_of_dice_rolled_integer_variable = number_of_dice_rolled_integer_variable - 1
      } else {
        failure_integer_variable = failure_integer_variable + 1
        number_of_dice_rolled_integer_variable = number_of_dice_rolled_integer_variable - 1
      }
    }
    // whatever scripting you want to do with your 'success_integer_variable', 'failure_integer_variable', and/or 'damage_integer_variable', goes here.
  }
</function>

The Pixie
16 Jul 2016, 07:45

My combat library is here:
http://textadventures.co.uk/forum/samples/topic/4886/rpg-style-combat-library

It is worth looking at so you get an idea of how much coding will be required, if nothing else. I used a D&D style D20 system, but a WoD could be implemented as readily. The exact mechanics do not impact on the code that heavily, what makes it big is allowing for all the possibilities. There is a trade-off between variety in monsters and options for the player against size of the code. I tried to keep mine simple, but still flexible enough to keep it interesting. When I did write a game, I added to the library even more!

Having timed events will make it more complicated and difficult to test as well. And as HK said, there are issues with it, so upload your game regularly to test it online too. I did consider doing that myself, and this thread might help a little bit.
http://textadventures.co.uk/forum/samples/topic/4577/handling-cool-down


The Pixie
16 Jul 2016, 07:47

I realise we are all being negative here. Combat can be done, but it will take time, and I guess that is true of all IF.


hegemonkhan
16 Jul 2016, 08:00

to concur with Pixie's post, some additional comments of my mine:

unless you're doing the most simpliest of combat design, you're going to be, working with / using, some complex coding logic, as combat is not simple to implement. So, if you're completely new to coding, and/or especially with the logic involved, it will be difficult for you, and will take us (well me anyways - whereas Pixie's much better at teaching/explaining/walkthrough'ing this stuff than I am) some time, to teach and explain the stuff, as we try to help you with it.

This can all be done within the GUI~Editor (if you know that well, but not coding), but it'll still be difficult if you don't understand basic coding/game-making logic, regardless of whether you use the GUI~Editor, or try to do the coding directly.

If you can generally understand/follow my code above (in my previous post), then you should be okay with already understanding the code/game-making logic required, again regardless of whether you use the GUI~Editor or try to do direct coding. I haven't ever played any dice games myself, but I think that they seem to be similiar and thus helpful with/in developing such coding/game-making logic, as you somwhat do so with the rules and/or formulas/equations that you craft for such dice games.


Bronteboghopper
17 Jul 2016, 04:28

I have very little experience and am just trying to scope it out.

Timing (in real time) can be scrapped. Turns wise can be implemented.

I guess what it would boil down to would be a an attack dice pool of D10s (set for each character) with the pool reduced by your opponents defence. Any successes cause one hit point of damage each.

So your character would start with an attack pool of 4 (maybe). And a defence of 1.
Other characters would have set varying damage. You take it in turns to attack each other.

Would that be easier. There would be three stats for each character. Attack defence and health


Bronteboghopper
17 Jul 2016, 04:29

I have very little experience and am just trying to scope it out.

Timing (in real time) can be scrapped. Turns wise can be implemented.

I guess what it would boil down to would be a an attack dice pool of D10s (set for each character) with the pool reduced by your opponents defence. Any successes cause one hit point of damage each.

So your character would start with an attack pool of 4 (maybe). And a defence of 1.
Other characters would have set varying damage. You take it in turns to attack each other.

Would that be easier. There would be three stats for each character. Attack defence and health


hegemonkhan
17 Jul 2016, 05:00
<object name="player">
  <attr name="attack_integer_attribute" type="int">10</attr>
  <attr name="defense_integer_attribute" type="int">5</attr>
  <attr name="current_health_integer_attribute" type="int">50</attr>
  <attr name="dead_boolean_attribute" type="boolean">false</attr>
</object>

<object name="orc">
  <attr name="attack_integer_attribute" type="int">8</attr>
  <attr name="defense_integer_attribute" type="int">4</attr>
  <attr name="current_health_integer_attribute" type="int">25</attr>
  <attr name="dead_boolean_attribute" type="boolean">false</attr>
</object>

<object name="dragon">
  <attr name="attack_integer_attribute" type="int">11</attr>
  <attr name="defense_integer_attribute" type="int">6</attr>
  <attr name="current_health_integer_attribute" type="int">99</attr>
  <attr name="dead_boolean_attribute" type="boolean">false</attr>
</object>

// where-ever (whatever scripting/inside of whatever Element) you want to use to activate the Function:
combat_function (player, orc) // the 'player' attacks the 'orc'
combat_function (orc, player) // the 'orc' attacks the 'player'
combat_function (player, dragon) // the 'player' attacks the 'dragon'
combat_function (dragon, player) // the 'dragon' attacks the 'player'
combat_function (orc, dragon) // the 'orc' attacks the 'dragon'
combat_function (dragon, orc) // the 'dragon' attacks the 'orc'

// your Function (what it does):
<function name="combat_function" parameters="attacker_object_parameter,defender_object_parameter"><![CDATA[
  if (not attacker_object_parameter.dead_boolean_attribute and not defender_object_parameter.dead_boolean_attribute) {
    success_integer_variable = 0
    number_of_dice_rolled_integer_variable = attacker_object_parameter.attack_integer_attribute - defender_object_parameter.defense_integer_attribute
    if (number_of_dice_rolled_integer_variable < 1) {
      msg (attacker_object_parameter.name + "'s attack failed to penetrate " + defender_object_parameter.name + "'s defense.")
    } else {
      while (number_of_dice_rolled_integer_variable > 0) {
        roll_result_integer_variable = DiceRoll ("1d10")
        if (roll_result_integer_variable = 10) {
          success_integer_variable = success_integer_variable + 1
        } else if (roll_result_integer_variable > 7) {
          success_integer_variable = success_integer_variable + 1
          number_of_dice_rolled_integer_variable = number_of_dice_rolled_integer_variable - 1
        } else {
          number_of_dice_rolled_integer_variable = number_of_dice_rolled_integer_variable - 1
        }
      }
      defender_object_parameter.current_health_integer_attribute = defender_object_parameter.current_health_integer_attribute - success_integer_variable
      msg (attacker.object_parameter.name + " attacks " + defender_object_parameter.name + " for " + success_integer_variable + " damage, leaving it with only " + defender_object_parameter.current_health_attribute + " life left.")
      if (defender_object_parameter.current_health_integer_attribute <= 0) {
        if (defender_object_parameter = game.pov) {
          msg ("You were killed by " + attacker_object_parameter + ".")
          msg ("GAME OVER")
          finish
        } else {
          defender_object_parameter.dead_boolean_attribute = true
          msg (defender_object_parameter.name + " is killed by " + attacker_object_parameter + ".")
        }
      }
    }
  } else if (attacker_object_parameter.dead_boolean_attribute) {
    msg (attacker_object_parameter.name + " is dead, silly.")
  } else if (defender_object_parameter.dead_boolean_attribute) {
    msg (defender_object_parameter.name + " is dead, silly.")
  } else {
    msg (attacker_object_parameter.name + " and " + defender_object_parameter.name + " are both dead, silly.")
  }
]]></function>

Bronteboghopper
18 Jul 2016, 03:58

Awesome thanks