Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Need Help Creating Equation to Define Combat Rating  (Read 1529 times)

Roses

  • Bay Watcher
    • View Profile
Need Help Creating Equation to Define Combat Rating
« on: October 26, 2014, 12:06:03 am »

So I hate to start a new thread just for this, but I think it it something that is important enough to discuss by itself.

The Goal: I am creating a script that will allow you to send your own dwarves on scouting/raiding missions in fortress mode. There will obviously be some randomness involved, but a group of adamantine clad, legenedary warriors should be able to do much better on a raid then a group of naked peasants.

The Issue: We need some sort of formula to calculate a units combat/scouting "rating" (for lack of a better word). Off the top of my head, the things that are important are, health of the unit, skills and attributes, types of items worn, and materials of items worn.

The Question: What should the actual formula for calculating these things be? How should each aspect add/subtract/multiply/divide into eachother to give a reasonable estimating of a units abilities.

An Example:
Code: [Select]
(H) Health is a number (0-1) where perfectly healthy is 1, and missing limbs/nerve damage/breathing trouble/anything else decreases the number
(S) Skill is an accumulation of all the military skills valid for a unit (i.e. if they are using an Axe and a Shield make sure to count the AXE and SHIELD skill)
(A) Attributes is a sum of all attributes, each with a different weighting
Items is broken down into weapons and armor;
 (I_W) Weapons takes the ATTACKS of the equipped weapon and takes the average "damage" a weapon can do
 (I_A) Armor takes the ARMOR_LEVEL, COVERAGE, and anything else of the equipped armor and computes a score
(M) Materials take the various YIELD/COMPRESS/SHEAR factors and computes a material value

combat_rating = H*(S+A+M*(I_W+I_A))
Now obviously there is a lot that needs to be fleshed out there, and it may be necessary to factor in interaction abilities and the like so that spell casters aren't left in the dust.

What I am hoping from the community is some serious, math oriented feedback about how best to calculate a units combat rating. In reality these ratings should be able to be used to predict arena fights to at least some extent (i.e. a unit with a combat rating of 1000 should almost always beat a unit with combat rating 100). Without this, any sort of scouting/raiding script will be practically useless, so please, leave as much feed back as you can! This is a project that is going to take the input of many many people.
Logged

TheDorf

  • Bay Watcher
    • View Profile
Re: Need Help Creating Equation to Define Combat Rating
« Reply #1 on: October 26, 2014, 07:41:30 am »

I believe UristDaVinci has reverse engineered the combat formulas of DF, couldn't those simply be used? Instead of using targeted attacks, it could simply calculate the average armor of the enemy and calculate a "defense roll" based on that. Toughness could be used to calculate "hit points". 1 hit point per 500 points of toughness, rounded down. Once a creature runs out of hitpoints, a "major" bodypart is targeted and dealt "lethal" damage.

Let's say a dwarf party is ambushed by a goblin party.

Since the dwarves were ambushed, the goblins get to attack first. All the goblins make an "attack roll", and get assigned a target randomly. Each attack that is aimed at a dwarf must be countered by a "dodge roll". Each failed dodge roll is followed up by a "defense roll" based on their average armor. If they fail both the dodge and defense rolls, they take damage. If a unit takes damage, they could make a willpower roll to determine whether they lose their next attack turn or not. If a unit is reduced to 0 health, a major bodypart is chosen at random and destroyed, preferrably in a manner determined by the attacker's weapon.

Once all defense rolls have been made, the defenders that are still alive who didn't fail their willpower rolls get to attack.

Now, interactions should also be accounted for, but I have no idea exactly how to go about this. At any rate, I think simulating fights like this would probably be easier to balance than simply writing a formula for the mission.
Logged
I love this community. Somebody asks "hay guise how do i tame shark", and then everybody is like "why don't we fling sharks at things with complex mechanical devices?".

Roses

  • Bay Watcher
    • View Profile
Re: Need Help Creating Equation to Define Combat Rating
« Reply #2 on: October 26, 2014, 07:10:46 pm »

Good call, I forgot all about Urist DaVinci's work. I started to look it over, but I also sent him a private message to gather his opinion on the subject. The attack/defense roll idea is interesting. That might be a better way to handle it.

EDIT: This is his thread concerning combat in the 0.34.11 version. Several equations in the 7th and 9th posts. I will try and convert those into reasonable rating equations.
« Last Edit: October 27, 2014, 10:43:07 am by Roses »
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Need Help Creating Equation to Define Combat Rating
« Reply #3 on: October 28, 2014, 01:56:12 am »

0.40 is a a total combat overhaul, mind, so things like agility aren't quite as important anymore.

I have a scouter in the DBZ mod, but it's mostly just for fun and not used for anything serious. Super Saiyan transformations are determined by flatly adding all combat-related attributes together (divided by the saiyan average) and allowing them the transformation once it gets past a certain threshold and they get to crying over something.

Roses

  • Bay Watcher
    • View Profile
Re: Need Help Creating Equation to Define Combat Rating
« Reply #4 on: October 28, 2014, 08:42:31 am »

Yes, I have been going through more of Urist Da Vinci's stuff and came across the 0.40 thread talking about how a lot has changed, which means I can't really use the previous equations (well I can, but it may not line up with the game). Hopefully DaVinci is still around and can offer some of his own insight/oppinion, otherwise I will just create a rudimentary equation and modify it empirically through extensive arena testing.
Logged

Urist Da Vinci

  • Bay Watcher
  • [NATURAL_SKILL: ENGINEER:4]
    • View Profile
Re: Need Help Creating Equation to Define Combat Rating
« Reply #5 on: October 28, 2014, 08:27:18 pm »

Yes, I have been going through more of Urist Da Vinci's stuff and came across the 0.40 thread talking about how a lot has changed, which means I can't really use the previous equations (well I can, but it may not line up with the game). Hopefully DaVinci is still around and can offer some of his own insight/oppinion, otherwise I will just create a rudimentary equation and modify it empirically through extensive arena testing.

You can mostly use the old equations, except as mentioned in the thread: http://www.bay12forums.com/smf/index.php?topic=142372.0
I just updated the combat calculator there with where I left it off. Take a look at the equations in the lua script. I read the forums on occasion, but am not as active at the moment.

The game calculates the wrestling ability of creatures based on size/100 + strength/100, IIRC. Size usually dominates. The lesson is that if you are not careful, the equation will end up with extreme results.


... In reality these ratings should be able to be used to predict arena fights to at least some extent (i.e. a unit with a combat rating of 1000 should almost always beat a unit with combat rating 100). ...

It would be interesting to know how Toady coded worldgen battles.

Roses

  • Bay Watcher
    • View Profile
Re: Need Help Creating Equation to Define Combat Rating
« Reply #6 on: October 29, 2014, 09:57:56 am »

That looks like a very helpful script for what I am trying to do. I will definitely take a look at it and see what I can divine.
Logged