Version 1.5 of Gnilbert's Combat mechanic/flow revamp downloadable DEMO.

By on September 19, 2010 9:46:45 PM from Elemental Forums Elemental Forums

Gnilbert

Join Date 03/2003
+36

You can download version 1.5 of this file HERE.
UPDATE: I've included XML definitions for the units in the download. Feel free to add/remove units and change their settings. You may want to make a backup of the XML file first - the app itself is... unforgiving with unexpected inputs.

You can download this file HERE.

    This is a result of earlier posts I made around combat mechanics and flow. I originally described how I think the statistics might change HERE and HERE, and then went on to describe how the combat flow should change HERE. There are parts of the demo below that will be better understood if you've read the earlier posts, especially around things like "splash."

    After working on my demo app for a few days, I've refined my original ideas about the combat mechanics, and I'd like to share those along with the demo itself. But first up, the disclaimers:
*** DISCLAIMERS ***
I. You must have .Net 3.5 installed. You can download it from microsoft, or through your automatic updates.
II. This is not a fully functional game demo. It is intended to demonstrate a concept only. As such:
   i. The "starting armies" for each side are not balanced against each other.
   ii. I've left out Mana costs for now, so channeler spells are... potent.
   iii. I didn't enable unit/ability/effect creation/editing in the UI, though all those exist in the "engine"
   iv. There are no fancy graphics
   v. There is no computer opponent - you play both sides.
   vi. Unless you check the "automate" checkbox, you need to actually "pick" the reaction, even if there's only one available.
   vii. THERE WILL BE BUGS.

Finally, THIS IS THE FIRST VERSION. I'll probably post a few updates to clean things up and turn on the editors once I put some serialization in, but I'm not intending to actually support this as a real product.

As always, I'll gladly share my model, code, etc. with Stardock.

PREAMBLE
    Originally, I had taken the same route as a lot of other posters and proposed "Attack, Defense, Damage and Armor." It seems obvious, right? The problem is, where do you put things like "spellcasting," "counterspelling," "you're great with a bow but terrible in melee," "+5 fire damage" and "weakness to lightning?" In new statistics, of course. But I don't like that. I like things to be simple (you may not believe that if you continue reading). I wanted something that will cover everything from magic to melee to your singing skill, with as little hard-coded fuss as possible. To help with this, let's talk about "tags."

TAGS
    In D&D, they're "types," and in Magic, they're "keywords." Essentially, they're adjectives that you stick on weapons, units, spells, abilities, effects, ability bonuses or just about anything else. So that might give me a Fireball spell that I've tagged "spell" and "fire." I might have a unit of skeletons that I've tagged "undead."
    The important part here is: These aren't predefined. There is a core set that I'm using, but you can really put any word as a tag (a multi-word tag just looks messy, but I allow them).

A GENERALIZED FOUR STAT MODEL
    To make the system as flexible as possible, I now have the following four core statistics (apart from health, mana, unit size, etc):

OFFENSE: this is a measure of how effectively you "connect" with offensive abilities.
DEFENSE: this is how effectively you prevent other's from connecting with offensive abilities.
POWER: this determines the maximum effect (like damage) from your abilities that "hit" the target.
RESIST: this determines the maximum "POWER" you can ignore from an offensive ability that "hits" you.

    Notice how it still pretty much sounds like Attack, Defense, etc? That's because, on the surface, it still is. But here's where it gets more interesting (aka complicated): Everything that gives you a bonus to one of your four abilities (weapons, armor, spells, training, etc) has tags that describe when it comes into play. For example, the archers here have +2 Offense when they're using "melee" abilities, and +5 when they're using "ranged" abilities. They have +2 to their Power when they're using abilities tagged "physical" AND "melee" (but not abilities tagged only one of those).
    The power here is just incredible. You can flexibly define things like "-5 Resist: fire | life" to create a penalty to resisting effects tagged "fire" or "life" - which is perfect for the undead. These bonuses can be described as Additive or Percentages - you sum the additive ones first, then apply the summed percentage bonus (or penalty) at the end.
    Additionally, this gives us casting/counterspelling. Casting is +X Offense: spell, Counterspelling is +X Defense: spell. Magical damage? +X Power: magic. Magical shielding? +X Resist: magic. What if you're particularly adept at counterspelling water spells? +X Defense: spell & water. What if you're particularly damaging with fire magic? +X Power: magic & fire. What if it's only the "buff" spells? +X Power: magic & buff.

    As an aside, in my model, the "requirements" on a tag are kept in conjunctive normal form, and negation of a tag is allowed with !tag or ~tag, so things like: +X Defense: (fire | earth | air | water) & ~magic are perfectly legal to describe "a bonus to avoid getting hit with non-magical, elemental abilities." For the current demo, I've avoided including abilities that are that complicated, but I hope you can imagine the wild possibilities that a system like this opens for modders!

COMBAT FLOW
 1. Player 1 (the active player) starts his turn. Player 2 is the reactive player.
 2. The active player selects a unit (with moves/actions remaining) and moves it or declares an "Action" on/against a target unit.
 3. The reactive player chooses a "Reaction" from among those available (these are determined by the provoking Action, the unit that is performing it, the target, the distance to those, etc).
 4. The Action/Reaction are resolved in order of their speed (Instant, Fast, Normal, Slow) - which may be simultaneous. There is no "react to a reaction" mechanic.
 5. If the active player has no units remaining to move, the players switch roles, and we go back to 2.

* the best way to get a feel for this is to read the little Game Log I write out. It's messy, but the info you need is there.

DAMAGE/EFFECT RESOLUTION
    How is damage calculated? Oddly, I'm not telling (I'll say it uses a fun-enhanced binomial distribution method). But really, this isn't what I want the focus on right now, so you'll have to take my word that it cleverly (correctly) applies damage/armor based on the tags. Instead, I'd really like to emphasize the combat flow and the ability of the tags to succinctly describe a wide variety of combat effects.

UPDATE 1: USING THE DEMO
    Wow - how bad is it that I forgot to post details on how to actually use the darned thing? Well, here goes: When you start up the application, the battle grid is the top half of the screen and the setup controls are below. There is a player 1 (left/blue) and player 2 (right/red) who start with a few automatically selected units.
Setup
Add Units
to a player to selecting a unit from the lower left "unit list" and then pressing the "Add" button in the red or blue player's color bar.
Remove Units by left clicking a unit on the battle grid and then pressing the "Remove" button in that player's color bar.
Browse Unit abilities by selecting a unit on the battle grid or in the unit list in the lower left. Then select the unit's abilities to see a more detailed view (to the right). ACTION abilities have a blue marker, and REACTION abilities have a red marker.
Rearrange units by left clicking to select and then right clicking the tile you want to move them to. If there's another unit there, they'll swap places.
Start a game
with the "Start Game" button. You can end it at any time, add/delete units, and then start it back up again.


"Playing"
Select a unit by left clicking. Units' cards have "Action" and/or "Move" below them, indicating if this unit can still act and/or move during this turn. All troops move one square (the grid is small), but they can use their action as a move as well.
Move a unit by left clicking on an empty, adjacent tile.
Use an ability by right clicking on a potential target. If there are legal abilities for that target, a pop-up will appear.
Choose who will react. When the active player chooses an action, a red "React" button will appear under all units that can react. Pressing the react button pulls up a menu to select the ability you want to react with. Right now, if there is at least one valid reaction on one of your units, you have to select a reaction - you can't "pass." There's a checkbox that will enable auto-react when only one reaction is available.
Skip Unit. You can "clear" the move/action of a unit for this round by pressing the spacebar with that unit selected or by pressing the "Skip turn" button.
End turn You can end the current player's turn by pressing the "End Turn" button
End Game. This button takes you back to the setup controls, leaving all the units where they are on the map. You can still restart the game with your current units.

I'll undoubtedly post a slew of things I've forgotten to mention over the next day or two, but for now, I'll let you poke around with my current version.

Gnilbert

PS. As a final thought, anyone have an idea how to get Frogboy's attention in this thread?

Locked Post 25 Replies +2
Search this post
Subscription Options


Reason for Karma (Optional)
Successfully updated karma reason!
September 19, 2010 10:01:42 PM from Elemental Forums Elemental Forums

I really like it Gnilbert.

Simple enough to deal with on the scale we see in Elemental (though it would get a bit boggy with 12 units/stacks on each side) but complex enough to give combat some actual meat.

Reason for Karma (Optional)
Successfully updated karma reason!
September 19, 2010 10:53:15 PM from Elemental Forums Elemental Forums

Gnilbert, any way i could see the code for this?

Reason for Karma (Optional)
Successfully updated karma reason!
September 19, 2010 11:08:05 PM from Elemental Forums Elemental Forums

This is great, I really hope the stardock peeps see this.

 

 

Reason for Karma (Optional)
Successfully updated karma reason!
September 19, 2010 11:46:25 PM from Elemental Forums Elemental Forums

looks sweet, bump for face time

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 12:30:31 AM from Elemental Forums Elemental Forums

This is a lot like a lot of the ideas in the combat thread.  Keep up the good work, G.

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 12:45:54 AM from Elemental Forums Elemental Forums

Quoting ,
PS. As a final thought, anyone have an idea how to get Frogboy's attention in this thread?

You could send a PM to Frogboy and explain a little (simple summary) of this post and link to it.  That should help.

Best regards,
Steven.

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 1:04:33 AM from Elemental Forums Elemental Forums

very interesting i have to say. definitely keeping an eye on this thread.

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 7:32:23 AM from Elemental Forums Elemental Forums

UPDATE 1: USING THE DEMO
    Wow - how bad is it that I forgot to post details on how to actually use the darned thing? Well, here goes: When you start up the application, the battle grid is the top half of the screen and the setup controls are below. There is a player 1 (left/blue) and player 2 (right/red) who start with a few automatically selected units. (I've also copied this into the original post!)

Setup
Add Units
to a player to selecting a unit from the lower left "unit list" and then pressing the "Add" button in the red or blue player's color bar.
Remove Units by left clicking a unit on the battle grid and then pressing the "Remove" button in that player's color bar.
Browse Unit abilities by selecting a unit on the battle grid or in the unit list in the lower left. Then select the unit's abilities to see a more detailed view (to the right). ACTION abilities have a blue marker, and REACTION abilities have a red marker.
Rearrange units by left clicking to select and then right clicking the tile you want to move them to. If there's another unit there, they'll swap places.
Start a game
with the "Start Game" button. You can end it at any time, add/delete units, and then start it back up again.


"Playing"
Select a unit by left clicking. Units' cards have "Action" and/or "Move" below them, indicating if this unit can still act and/or move during this turn. All troops move one square (the grid is small), but they can use their action as a move as well.
Move a unit by left clicking on an empty, adjacent tile.
Use an ability by right clicking on a potential target. If there are legal abilities for that target, a pop-up will appear.
Choose who will react. When the active player chooses an action, a red "React" button will appear under all units that can react. Pressing the react button pulls up a menu to select the ability you want to react with. Right now, if there is at least one valid reaction on one of your units, you have to select a reaction - you can't "pass." There's a checkbox that will enable auto-react when only one reaction is available.
Skip Unit. You can "clear" the move/action of a unit for this round by pressing the spacebar with that unit selected or by pressing the "Skip turn" button.
End turn You can end the current player's turn by pressing the "End Turn" button
End Game. This button takes you back to the setup controls, leaving all the units where they are on the map. You can still restart the game with your current units.

Gnilbert

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 8:45:48 AM from Elemental Forums Elemental Forums

very impressive work Gnilbert... are you a .Net developer by trade?

 

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 10:19:43 AM from Elemental Forums Elemental Forums

Very impressive!

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 10:52:30 AM from Elemental Forums Elemental Forums

Hi Gnilbert,

What you have done, so far, is truly awesome.  I have played simulations, FRP, etc, for over 30 years - I'm old, i guess, anyway, SPI (Simulations Publications, Inc.) had a wonderful series of 'pre 17th century' tac games - all integrated, that sim'd combat from hoplites to agincourt.  Might you incorporate facing, etc iontom your awesome combat sim?  Also, fog of war, and digging in (fortifiying) for units (not indivuduals)?  This would add to the mundale asopects of battle. Juts my 2 cents worth to add to your gold mine of a project!

 

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 11:37:30 AM from Elemental Forums Elemental Forums

oh snap, frogboy stamp of approval

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 11:52:27 AM from Elemental Forums Elemental Forums

Quoting Frogboy,
Very impressive!

 

Sorry if I sound rude, if it is so be aware that this is not my intention, but is there any chance something similar will be implemented or at least taken in conisideration? I ask this because, even if I'm totally unskilled in any form of coding, it seems incredibly sleek, powerful and "usable" by an AI...

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 12:03:53 PM from Elemental Forums Elemental Forums

Very nice !

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 1:09:35 PM from Elemental Forums Elemental Forums

There's two ways to look at this.

First, let me say that in Elemental: War of Magic, the game mechanics of v1.1 are pretty much the set game mechanics for the game.  The reason is that Elemental: War of Magic needs to rise or fall based on its basic design.

That said, my general reaction at this point is that after v1.1 we move to Elemental: Expansion 1 (which will be free to all Elemental players) where we can start making some changes, particularly to the combat system which is what Gnilbert's concept focuses on.

The combat system is core to a given game like this. The simplistic combat system of Elemental: War of Magic is one of the reasons why the magic system has spells that aren't that interesting. 

Thus, as we think of a new combat system for an Elemental expansion, we should be thinking about what kinds of magical spells we would want to create as well.  In other words, both need to be considered at the same time.

Then, the system has to be made in such a way that it can be exported to Python so that modders can expand and extend it as they see fit.

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 1:39:21 PM from Elemental Forums Elemental Forums

This is very good, simple and interesting model! But, imho, battle time have increased dramatically.

I think, reaction must be automatic (strongest reaction). If the reaction have some consequences (like wizards decreasing mana) - then let the player choise.

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 1:57:19 PM from Elemental Forums Elemental Forums

Quoting Frogboy,
First, let me say that in Elemental: War of Magic, the game mechanics of v1.1 are pretty much the set game mechanics for the game.
First off, WOOHOO!! Thanks for reading this! Next, yes, absolutely, I agree 100%. It would be downright reckless to revamp combat flow right now, when your main concerns are likely code/feature stabilization. If you were going to be able to take anything from what I did here in the very short term, it would likely be the one mechanic I actually didn't explain - but more on that later.|
That said, my general reaction at this point is that after v1.1 we move to Elemental: Expansion 1 (which will be free to all Elemental players) where we can start making some changes, particularly to the combat system which is what Gnilbert's concept focuses on.
For anyone wondering, this is my first intended target. I'm hoping some of my ideas can be used for the next version. If it's not possible at all in Elemental, at least the idea is out there for a future title.
...we should be thinking about what kinds of magical spells we would want to create as well.  In other words, both need to be considered at the same time.
Yes, agreed completely. To that end, let me sketch out something I haven't put in my model yet.

UnitResourcePool // These are delpletable pools of "resources" that can be spent/removed/modified during combat
  - int Name // the name of the resource pool like Health, Movement, Actions, Morale, Mana, etc.
  - int StartPercent // how close are you to the MaxValue when this pool is initialized
  - int MaxValue // the maximum capacity for this pool
  - int ChangePerCombatTurn // the amount this changes up or down each turn during combat
  - int CurrentValue // the value you have currently
  - int IsDeadWhenNonPositive // do you die when this pool is emptied?
  - bool IsPerModel // whether the MaxValue is multiplied by the squad size.

AbilityCost // A cost associated with using a particular ability
  - UnitResourcePoolName Source // the pool that you're drawing from
  - int Amount // how much of the resource you expend
  - CostDurationType Duration // details for how long you continuing paying this cost

<TieredEffect>
 <Tier>
    <AbilityCost>
     <Source>Mana</Source>
     <Amount>3</Amount>
    <AbilityCost>
    <SummonCreateEffect thing="impling" />
 <Tier>
 <Tier>
    <AbilityCost>
     <Source>Mana</Source>
     <Amount>6</Amount>
    <AbilityCost>
    <SummonCreateEffect thing="minorDemon" />
 <Tier>
 <Tier>
    <AbilityCost>
     <Source>Mana</Source>
     <Amount>15</Amount>
    <AbilityCost>
    <AbilityCost>
     <Source>Health</Source>
     <Amount>20%</Amount>
    <AbilityCost>
    <RequiredSourceTag>DarkPact</RequiredSourceTag>
    <SummonCreateEffect thing="demon" />
 <Tier>
 <Tier>
    <AbilityCost>
     <Source>Mana</Source>
     <Amount>20</Amount>
    <AbilityCost>
    <AbilityCost>
     <Source>Health</Source>
     <Amount>50%</Amount>
    <AbilityCost>
    <AbilityCost>
     <Source>Gold</Source>
     <Amount>100</Amount>
    <AbilityCost>
    <RequiredSourceTag>DarkPact</RequiredSourceTag>
    <RequiredSourceTag>Damned</RequiredSourceTag>
    <SummonCreateEffect thing="demonPrince" />
 <Tier>
</TieredEffect>

    Hopefully, that part speaks for itself. Now, back to damage for a second: I have it so that, after number of hits are determined, the source offers X power and the target has Y available Resist, so X-Y power is available to "spend" on the effect itself.  Pretend that damage effects spend the power normally as 1 power = 1 damage. But we can allow it to convert at a different rate: maybe 2, so you really only do one damage per 2 unblocked power. Or, as a better example, you might make the cost 5, and then say the spell applies -1 (some stat, not damage) per 5 unblocked power. Or, you might put the unblocked power in that TieredEffect concept above, so the unblocked power determines additional, secondary effects. How cool would that be?

 On a side note, I'm going to try and post another version tonight that'll allow you to edit the XML definitions of the objects in the demo so you can poke around more with it.

Gnilbert

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 1:59:59 PM from Elemental Forums Elemental Forums

Quoting id_est,
This is very good, simple and interesting model! But, imho, battle time have increased dramatically. I think, reaction must be automatic (strongest reaction). If the reaction have some consequences (like wizards decreasing mana) - then let the player choise.
I agree - I specifically made a point of disabling the "auto-react" option to really underscore the flow. Realistically, I'd expect both "auto select the only ability I can use on my target" and "auto-react with the only reaction possible that doesn't cost something" to be preferred. Additionally, I went out of my way to give the units a variety of actions/reactions - possibly more than you'd really want non-hero units to have.

Gnilbert

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 3:22:35 PM from Elemental Forums Elemental Forums

Quoting Frogboy,
There's two ways to look at this.

 

Thank you for your reply! That looks good to me, I never ever wanted to include such a radical change in 1.1. I truly like the idea of the comabt system being exposed to python!

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 4:51:48 PM from Elemental Forums Elemental Forums

Quoting Frogboy,

First, let me say that in Elemental: War of Magic, the game mechanics of v1.1 are pretty much the set game mechanics for the game.  The reason is that Elemental: War of Magic needs to rise or fall based on its basic design.

That said, my general reaction at this point is that after v1.1 we move to Elemental: Expansion 1 (which will be free to all Elemental players) where we can start making some changes, particularly to the combat system which is what Gnilbert's concept focuses on.

The combat system is core to a given game like this. The simplistic combat system of Elemental: War of Magic is one of the reasons why the magic system has spells that aren't that interesting.

I think that is a mistake, because with a simplistic combat and spell casting system researching different weapons, armors and spells is pointless and customizing your units with different equipment is pointless, too.

Please wait with the release until you have improved all important systems, because Elemental is currently simplistic in all areas (combat, magic, city building and diplomacy) and it would be sad if a game with such a great potential fails again, because the basic design is too simplistic.

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 5:52:56 PM from Elemental Forums Elemental Forums

yeah i totally understand what brad is trying to do by releasing the separate expansions.  because there are certain mechanics that are going to be vastly different from what we have now.  there are going to be people that like the way the game works as is.  if they want to keep playing this version they can, while everyone else can move on to expansion 2, then the pattern repeats with expansion 3.

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 7:34:35 PM from Elemental Forums Elemental Forums

I've posted an updated version that loads the units from an XML file I've included in the download. Feel free to change the file around. I will say it's not particularly forgiving of "input errors," so you probably want to copy the xml structure of existing things as closely as possible.

Gnilbert

Reason for Karma (Optional)
Successfully updated karma reason!
September 20, 2010 8:56:20 PM from Elemental Forums Elemental Forums

Nice work!

Reason for Karma (Optional)
Successfully updated karma reason!
September 21, 2010 7:23:00 AM from Elemental Forums Elemental Forums

Gnilbert, any way i could see the code for this?
Right now, the code is in such a state of flux that I'm a bit hesitant to "release" it. Well, that and the fact that there are exactly 0 comments. As I get it stabilized, I'll very likely post the code as well. In the meantime, the XML structure really reflects a lot of what's going on under the hood.
    For those who are interested, the gui is WPF. All code is in C#.
very impressive work Gnilbert... are you a .Net developer by trade?
It's weird to think of myself that way - some part of me still wants to say, "No, I'm a C++ developer," but I do almost everything in C# these days. I spend most of my time innovating algorithms/techniques for complicated/strange/NP-hard business problems, rapid-prototyping them, and then "handing them off" to one of my guys while I move on to the next thing. We joke sometimes that it's a bit like "House," but with fewer drugs.

    Again, thanks for the positive feedback! I'm a little suprised that this one didn't spark more debate, though. I was really hoping someone would at least challenge a couple of the things I did - I always think incorporating the opposing view in a lively debate is one of the best ways to refine something, both internally and externally. 

Gnilbert

Reason for Karma (Optional)
Successfully updated karma reason!
September 21, 2010 7:56:57 AM from Elemental Forums Elemental Forums

Quoting Gnilbert,


    Again, thanks for the positive feedback! I'm a little suprised that this one didn't spark more debate, though.


Debate? I could hardly devise such a system, let alone code it!!! I had a chance to test your demo, and I actually think it's even "fun" to play (realtively)!

Reason for Karma (Optional)
Successfully updated karma reason!
Stardock Forums v1.0.0.0    #101114  walnut1   Server Load Time: 00:00:00.0000313   Page Render Time: