Defining mathematical unit balance metrics

Discussion in 'Balance Discussions' started by godde, February 6, 2014.

  1. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
    I have updated the database to version 61250.

    I removed geometric mean of DPS, range and speed since I don't think it is that useful. Feel free to suggest an alternative.

    I have generated unit match-up tables for all units. It is not that useful for units without weapons.

    Example:
    http://people.dsv.su.se/~akbj7812/pa-db/unitmatchup/tank_light_laser.html

    'Costeffectiveness' is 'Strength per 1 metal' cost with overkill factored in.
    'Contraeffectiveness' is the other units 'Strength per 1 metal cost' with overkill factored in.
    'Costeffectiveness ratio' is simply 'Costeffectiveness' divided by 'Contraeffectiveness'. It it should be an accurate description of how well the unit does for cost in a situation where Lanchesters' square law applies. Note however that for Lanchesters' square law to apply in PA, you have to assume that all units are in range of each other and that the units focus fire down each enemy unit one at a time.

    If I understand Lanchesters' square law correctly, β would be (DPS * Health*OverkillfactorAgainstUnitA) for unit B while α is (DPS * Health*OverkillfactorAgainstUnitB) for unit A.
    dA/dt = -βB
    dB/dt = -αA



    'Effective DPS' is the units DPS against a specific unit with overkill factored in.
    'Effective DPS' is the other units DPS with overkill factored in.

    'Overkill given' is basically the overkill factor and shows how much of the DPS that will be wasted at a minimum. Currently I only take the highest alpha damage from 1 weapon into account so it should be accurate for units that have 1 weapon or several weapons that do the same damage.
    I don't account for multi-hitting which a weapon with splash damage does if enemy units stand close enough to eachother.
    So for example. If a unit does 100 damage per shot and fires at a unit with 10 health, 90% of the DPS will be wasted.
    Last edited: February 20, 2014
    shootall and Clopse like this.
  2. Quitch

    Quitch Post Master General

    Messages:
    5,885
    Likes Received:
    6,045
    I believe this is precisely what Blizzard do to get balance started, then use humans to tweak it.
  3. bmb

    bmb Well-Known Member

    Messages:
    1,497
    Likes Received:
    219
    Health, DPS, range etc are all hard numbers and easy to compare. The difficulty is in determining how much range is worth how much metal compared to hp or dps or other obscure stats. Not to mention the value of these properties stacking.

    I've experimented with similar systems in supcom and at a high level it pretty much works. It's the special cases where it breaks down. What I did was use a "complexity multiplier". So that for example for the same stats the value of a static defense would be better than a mobile unit by some factor. You still need to just guess at the values for these multipliers but it does reduce the values you do have to tweak and just feel your way around to just a few.
    Last edited: February 20, 2014
  4. stuart98

    stuart98 Post Master General

    Messages:
    6,009
    Likes Received:
    3,888
    Your table is broken. Try putting it on the web instead of on your router. If we can see what's on your router, that would only be because we hacked into it.
  5. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
  6. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
    Updated the database to 61450.

    New metrics:

    "Outranging time". This is for how long, in seconds, a unit can kite or outrange an enemy before the other unit reaches them.
    Positive values means that the unit for the match-up table have longer range but slower speed. "inf" means that the unit can kite the other unit forever as it have the same or faster speed and longer range.
    Negative values means that the unit from the row have longer range but slower speed. "-inf" means that the other unit in the row can kite the unit for the match-up table forever.
    0 means that both units have the same range.

    "units lost on approach". This is how many units that is lost on the approach when trying to get in range of the kiting unit. Positive value means that the unit for the match-up table kills that many units on the approach.
    Negative value means that the unit in the row kills that many units of the match-up table.
    I'm a little torn about how to handle alpha damage.
    If you look at the match-up table for the Leveler, it kills 3 Slammers when driving away from incoming Slammers. It takes 4 seconds for the Slammers to close the distance. The Leveler kills 1 Slammer with the first volley, dealing 500 damage. After 2 seconds it fires again for 500 damage but after 4 seconds both the Leveler fire and the Slammers fire. Although in a real game, the Slammers are very unlikely to enter the range of the Leveler at the same time so it might still be pretty accurate.
    shootall likes this.
  7. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
    Well a the choice of "complexity multiplier" seems arbitrary although I guess if you know why you chose a specific value, you also know the limitations of it.

    Could you give an example?
  8. bmb

    bmb Well-Known Member

    Messages:
    1,497
    Likes Received:
    219
    I just did, a case was defense has better value than mobile units. I believe the basic set I came up with was defense > factory > units > eco > engie.
  9. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
    Well. Defense are usually better because they have more DPS for cost, more health for cost and longer range than mainline battle units.
    Those are pretty "hard" numbers.
  10. bmb

    bmb Well-Known Member

    Messages:
    1,497
    Likes Received:
    219
    Hold up! I found some of my old notes. This was abandoned WIP when I realized no amount of modding would save supcom the way I wanted to.

    Code:
    buildrate = 3 mass per second
    hpratio = 5 hp per second
    complexityratio: 0.5 econ, 2 def, 1.5 factory, 0.25 engie, 1.0 other
    
    cost / buildrate * hpratio * complexityratio = hp
    hp / complexityratio / hpratio * buildrate = cost
    
    Some of this stuff is just to try and standardize how quickly HP/mass can be put into the world. I'm not sure that's in itself a good idea but it was an experiment.

    The reason for using HP is that it is the only metric that does not depend on all the others.
  11. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
    Updated "Factories" and "Builders" tables to be sorted on "Total Infrastructure cost per 1 metal output(with basic energy plants)".

    Example:
    http://people.dsv.su.se/~akbj7812/pa-db/table/builders.html

    I want that the webpage user should be able to sort the tables in any displayed stat.
    I'm not sure how to do that and if it would be appropriate to have an actual database in SQL and run scripts to sort the tables compared to just generating hundreds of different static HTML-pages.
    shootall likes this.
  12. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
    I have calculated the optimal efficiency for units produced by assisted factories.

    Code:
    def get_assistedcost(unit, factory, costof1energy):
        factoryefficiency = get_infracost(unit, factory, costof1energy)
        fabefficiency = getbuildefficiency(mostefficientfabber, costof1energy)
        if factoryefficiency <= fabefficiency:
            return factoryefficiency
         
        rolloff = getrolloff(factory)
     
        if rolloff == 0:            #infinite fabbers is the most efficient assisters
            return fabefficiency
         
        fab = mostefficientfabber
        cost = factory.build_cost + fab.build_cost
        buildoutput = factory.tool_consumption.metal+fab.tool_consumption.metal
        buildTime = (unit.build_cost / buildoutput)
        idle = buildTime / (buildTime + rolloff)
        energyDrain = factory.tool_consumption.energy + fab.tool_consumption.energy
        totalCost = (energyDrain * idle * costof1energy ) + cost
        assistedvalue = totalCost / (buildoutput*idle)
        latestvalue = factoryefficiency
        while(assistedvalue < latestvalue):
            latestvalue = assistedvalue
            cost += fab.build_cost
            buildoutput += fab.tool_consumption.metal
            buildTime = (unit.build_cost / buildoutput)
            idle = buildTime / (buildTime + rolloff)
            energyDrain += fab.tool_consumption.energy
            totalCost = (energyDrain * idle * costof1energy ) + cost
            assistedvalue = totalCost / (buildoutput*idle)
        return latestvalue
    Example:http://people.dsv.su.se/~akbj7812/pa-db/table/air.html

    Right now Vehicle, Bot and Ship fabbers are equally efficient although Vehicle factories are the most efficient factories so arguably Vehicle fabbers are the best fabbers currently.
    I use the most efficient fabber as a base for assisting.

    It is interesting to see how much more air units benefit from assisting compared to other units. It is mostly due to that air factories are relatively expensive for their metal output, drains more energy and only have a roll-off time of 2 seconds.

    Also added "Build range" to "Builders" table, "AoE"/splash radius to "Defenses" table and some other stats.
    Last edited: February 27, 2014
    shootall likes this.
  13. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
    Updated to version 62186.

    I gotta say that the database really helped me analyze the game balance before the tournament. I only played like 3-4 games of Gamma against real players before I played the tournament.
    Although I did some mistakes which are of interest from a balance metric perspective.
    I played 2 games against Clopse before the tourney.
    In the first game he spammed Doxes and teched to advanced bots and supported his Doxes with Gil-E.
    Leveler had the best "Strength per 1 metal" of all mobile ground units so assumed it would do well. I also looked at the match-up table for the Leveler and it seemed to do pretty well against Doxes having a" Costeffectiveness ratio" of 1.26. However since it fires 2 shots in a volley and Doxes with formations are quite spread out, the Leveler are very likely only to hit with one shot, halving the "Costeffectiveness ratio" to 0.63.
    That actually seems to leave the Leveler with an interesting role. It is not that effective against Dox spam but it is very good against Slammers and Ants while a mix of Levelers and Shellers can compete with Slammers and Gil-Es'.

    The reduced cost of the Defenses basically meant that you could spam defense and tech to t2 to make advanced mexes without worrying to much about early map control and I did that quite successfully throughout the tournament.

    Since the Single Laser Turret got the same "Costeffectiveness ratio" against Doxes as Laser Turrets I assumed that Single Laser Turrets would be as effective as Laser Turrets.

    However in game 3 against DrunkenReaper he chose to go for initial Dox spam followed by t2 air. I went for an eco build with t2 air first.
    I faced quite a bit of attrition against his Dox rushes and my Single Laser Turrets didn't do as well as I thought they would.
    It seems as Laser Turrets don't lead their target and Single Laser Turrets are very likely to miss strafing Doxes. However the 2 barreled Laser turrets have have a spread on their fire so they will hit moving Doxes much more reliably. In the later games I made Laser Turrets instead of Single Laser Turrets.
    I panicked a bit as DrunkenReaper ceased map control and my gunships got countered by his Peregrines so I felt like I had to deal a decisive blow and went for a nuke. I tried to cut defenses to get out the nuke as fast as possible and DrunkenReaper managed to destroy my nuke with a few bombers when my nuke where about 95% done.
    I scouted him seeing he were making a nuke and I considered going for anti-nuke or for a counter-snipe with bombers. I thought I were behind in eco so that I would not be able to finish the anti-nuke in time and my bomber snipe failed and he nuked me.
    Seeing the stats after the game I were ahead in metal the whole game and had much more energy than him so I were actually ahead economically which meant that I could have devoted more resources towards defense to protect my nuke or made an anti-nuke after he sniped my nuke.
    Last edited: March 3, 2014
  14. ohnimus

    ohnimus New Member

    Messages:
    23
    Likes Received:
    3
    when ur going to work more on this approach i would advise only to use and to base on data that is available to you - like the endgame statistics
    my approach is different ( think botttom-up ) - take the costs of an unit and calculate the hp, firepower
  15. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
    I don't see why I would use endgame statistics. Unit stats/specifications are available to me and can be analysed by mathematical balance metrics. Basing analysis on ingame performance is another separate statistical approach.
  16. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
    It seems all damage values should be cut by half. Like it says Single Laser Turrets does 90 damage but it takes 2 shots to kill 1 Dox which have 80 HP.
    It says a nuke does 22000 damage but the Commander can survive 1 nuke even though it only got 12500 HP.

    Funny how long it took me to realize this. It doesn't really change the cost "Strength per 1 metal" relationships because if all units do half the damage it applies equally to all units. It does affect Overkill which in turn affects the match-up tables quite a lot. It also affects "Time to Kill" and therefore also "Outranging time" and "Units lost on approach" in my match-up tables.

    Does anyone know where I can find this damage modifier in the PA files?
  17. stormingkiwi

    stormingkiwi Post Master General

    Messages:
    3,266
    Likes Received:
    1,355
    Addressing this stuff, finally moved it where it belonged.

    1) Vanilla values - I assume everything is equal. I.e. metal output per second is constant, build efficiency is the same or very similar.

    Technically no. M/t is Metal differentiated with respect to time. Going into kinematics for a moment.

    Distance = Velocity * time, correct?
    Velocity is distance differentiated with respect to time. I.e. Dx/dt.
    360 km = 60 km per hour * 6 hours.
    You can't cancel 6 and 1, because they aren't the same number.

    If you did so, you end up with the nonsense statement that 360 = 60.

    I guess technically it is 360km = 60*(km/h) * 6(h). So yes, you can cancel h. But you still have the coefficient in front of h that you multiply.

    Oh we do exactly the same maths then. M/t is Metal output second. I got massively confused when you started saying stuff about assisting and so on - because assisting decreased time, but the other player would be spending more on air to keep up.

    I thought I had implied that somewhere. Sorry.

    Well the infrastructure requirements are different for Peregrines and Hummingbirds. http://people.dsv.su.se/~akbj7812/pa-db/table/air.html
    That's true. You realise I don't use my values to analyse the game like you do though right? I kind of just set up a perpetual midgame scenario.

    Rather than being used to try and figure out the optimal build, I use my values to think about what is happening in the midgame and normalise the result as much as possible - that's the Ceteris paribus.

    Essentially I think "Hmm... What would happen if Player A realised that Player B had was just about to finish his t2 air factory?"

    I make an additional assumption. I assume that a rush is a valid strategy. I.e. the player who is purely tech booming without defense will lose to the rush, and so they are somehow able to keep the other player's plans under control. Thus T2 occurs in a situation where both players have placed an equal amount on reaching t2. Otherwise you're comparing too many variables.
  18. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
    Well I guess we mostly agree then.


    My goal is to be able to analyze the game from any state even though that might not be feasible.
  19. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
    Updated to version 62857. I haven't noticed any balance changes from the previous version.

    I have divided all damage values with 2 because I think that it is how works ingame. One unit match-up that is affected is the Dox versus Laser Turret and Single Laser Turret. Previously the Laser Turret were listed as doing 160 damage in each shoot. Now it is listed as doing 80 damage per shot which is exactly the health of the Dox while the Single Laser Turret does 45 damage which means that Single Laser Turret takes 2 shots to kill a Dox compared to 1 shot when I thought that the Single Laser Turret did 90 damage.
    This means that Laser Turrets are about twice as effective for cost against Doxes compared to Single Laser Turrets.

    I have added "Target Layers" to weapons. I'm probably gonna use those for the match-up tables to show that some units can't attack each other.
  20. godde

    godde Well-Known Member

    Messages:
    1,425
    Likes Received:
    499
    Updated to version 63475. I haven't noticed any balance changes from the previous version.

    Instead of dividing all damage values with 2, I only use splash damage if it is present which seems to be accurate. Feel free to report if this seems to be wrong.

    Some other good news is that I've gotten cleared for writing my bachelor thesis with Planetary Annihilation as an example. I hope to be able to use the database website as artefact in my thesis but I'm not sure exactly how much the thesis will revolve around Planetary Annihilation or just describe balancing in general.

    I have also found a really good read on the subject: https://digital.lib.washington.edu/...7/Jaffe_washington_0250E_11528.pdf?sequence=1

    Although this article doesn't really home in on RTS balance so if you have more specific RTS balance articles, feel free to provide links to those.
    Last edited: April 2, 2014
    Quitch likes this.

Share This Page