computer based unit balancing

Discussion of all aspects of multiplayer development: unit balancing, map development, server development, and so forth.

Moderator: Forum Moderators

Post Reply
User avatar
norbert
Posts: 368
Joined: June 14th, 2009, 6:57 pm
Location: The Netherlands

computer based unit balancing

Post by norbert »

What follows are some ideas I had about computer based unit balancing, which is something that may or may not have been discussed before. Either way, theoretically it should be possible for a computer program to tell if a unit is properly balanced by parsing its properties and applying a complicated set of rules to them that was generated by (is derived from) parsing all units in the six factions of the Default era. This would not balance factions; just units. I'm very well aware that computer based unit balancing may be practically impossible and has many drawbacks. But I had fun philosophizing about it and it could be a cool project to work on. Here's a bit more about what I have in mind.

Let's assume that the Elvish Archer and the Heavy Infantryman, which are two very different unit types, are perfectly balanced. If the rule set is applied to their properties, the outcome for both would be 0. This is because some of the units' properties are drawbacks and some are advantages. Examples for those units: the Heavy Infantryman is slow but it has a good melee attack, the Elvish Archer's HP is low but it has a good defense on forest ground. Even very small things, like -10% arcane resistance for the Elvish Archer should be taken into account. Exponential curves should be used, or at least -50% arcane should not be parsed as (just) 5x the drawback of -10% arcane. Each advantage and drawback should have points related to them; these make up the rule set.

Resistances, max HP, movement, terrain defense, terrain movement points, melee and ranged damage and attacks (strikes), weapon specials (like drains, magical), abilities (like leadership, feeding), cost, and so on: all these things should have defaults and if they are higher or lower or (non)available points should be added or subtracted. The XP to level should be used to determine how much (percentage) further levels of the unit should be taken into account. If a unit needs 1 XP to level with a default exp. mod., its level 2 (and higher) versions are more relevant than when a unit needs 50 XP to level. Yes, all levels of the unit should be used in the calculation. Even though "cures, heals +8" and "firststrike" will both add points, the former probably more than the latter.

Bottom line: it should not matter which unit is being parsed, if the complicated set of rules is correct, the outcome will always be 0. If the higher levels of an Elvish Shaman make up 60% of the points (19% Elvish Druid + 19% Elvish Sorceress + 10% Elvish Shyde + 8% Elvish Enchantress + 4% Elvish Sylph) and add up to +24, then the points for the Elvish Shaman will need to be -36: +4 (1 less cost than 16) +25 (for "heals +4") -3 (1 less movement than 6) +7 (3 less XP than 35) -7 (4 less HP than 30) -2 (-10% arcane) +20 ("slows" on ranged) +0 (terrain stats average) -40 (2-3 less ranged than average) -40 (2-3 less melee than average). Of course all that was just an example and a computer program would be able to determine way better why humans think certain properties make units similar. This would be a very cool Summer of Code project to work on. We believe the Elvish Archer and the Heavy Infantryman are balanced properly... a computer program should be able to tell us exactly why they are.
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: computer based unit balancing

Post by Ken_Oh »

I've been waiting for someone to bring up a topic like this again.

For Wesband, I've started the very incredibly stupid task of doing this. It, however, was never meant for real balance sake, but rather for a few purposes.

They all have to do with the fact that no NPC unit in Wesband will ever truly match its unit type. Instead, a Fencer, for example, has a saber, no armor, some "evade" skill, the skirmisher skill, skill with light blade and various other upgrades. So, the purposes are thus:

-How much would a unit cost if recruited (as a single unit) by the players (in a tavern, for example)?
-If X unit is given Y item, would it hurt or benefit it? Let's say that a piece of armor giving resistances would prevent a Fencer from being a skirmisher. Of course that's a disadvantage, but at some point, with enough resistance, it would mathematically be better for the unit.
-When a unit levels up, how should it choose its upgrades? This is similar to the above.
-When faced with a bunch of Skeletons, should a unit put away its sword for a club? Also similar to the above.

So, yeah, here's what I have.
http://dl.dropbox.com/u/776904/wesnoth/npc_value.cfg
http://dl.dropbox.com/u/776904/wesnoth/ ... _utils.cfg

It's horribly crude and subject to constant change, but it has surprised me from time to time. I took out a bunch of non-mainline abilities and specials in the upload for this thread. Note that the gold amount takes upkeep in account (I was shooting for about 15 turns, so while a Peasant might be around 8 gold, a Thug is going to be closer to 30). The higher power units explode in value (last I checked a Lich was valued at 1800).

I could say more, but I'll just leave whoever to point and laugh now.
User avatar
pauxlo
Posts: 1047
Joined: September 19th, 2006, 8:54 pm

Re: computer based unit balancing

Post by pauxlo »

The problem with the approach of "balancing units" is really that the usefulness (or unusefulness) of certain properties depends on many other factors: On which terrain are they played, against which other units/factions, with which allies.

For example, playing 19 elven archers agains 17 HI (so same sum price) may be overpowering the archers or the HI, depending on the terrain (and even map size: on a big map the archers simply can run away and then gang up on single HIs, on a little map (of mostly plain with some villages) the HIs may form a line, going over the map and wiping out every archer by hitting him repeatedly with two HI (with a bit of shuffling out damaged ones)).

The negative arcane resistance of the archer only comes to play if their enemy has any arcane dealing units (of Mainline units this would be White Mage, Paladin, Ghost, Elvish Lord, Elvish Sorceress or Mermaid priestess + upgrades – Adepts would not count, as they have a better cold attack to be used instead).
The negative fire resistance of the HI only comes to play if their enemy has any fire dealing units, and so on.

A unit with the berserker special would be much more worth in a faction which also has a slowing unit than in the Knalgan faction.

So, all your formula could do is to say "this unit when used with all other units in its faction is balanced against the other default factions on the default maps", but we already knew this :-)
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Re: computer based unit balancing

Post by Sapient »

The feasibility of using algorithms for unit balancing has been discussed several times in the past. I think the most extensive discussion was this thread in the Ideas forum.

Ken_oh is talking about balancing certain key attributes for a specific scenario, which is, although related, really a very different problem.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: computer based unit balancing

Post by Ken_Oh »

Well, I'm currently only finding a general usefulness. The plan for the future is to let the event take inputs according to the environment.
Post Reply