Showing posts with label RTS. Show all posts
Showing posts with label RTS. Show all posts

Friday, April 18, 2008

Focus-Fire Stage 1: Whadda We Shoot?

As you may recall in Paper-Rock-Scissors, I made all the units attack all opponents simultameously. There's a big reason for this: the strategy of choosing which unit to attack is a major strategy in and of itself.

The Battle of Trafalgar was a naval battle between the French and the British during the Napoleonic Wars. It's significant because the British won the battle, even though the French had superior numbers. The clever British commander Admiral Lord Nelson decided to divide his fleet into two flanking forces and focus on sinking one ship instead of wounding several. This was contrary to conventional naval warfare. As a result, his ships were able to down French ships at a much quicker rate, which caused the French fleet's firepower to decrease exponentially while the British suffered only linear loses. Because of this unusual outcome, the Battle of Trafalgar is often used as a case-study for mathematical modeling military encounters.

Today, most gamers already know this strategy--if you "focus fire" your attacks on a single unit, you can decimate your opponents at an exponential rate. I wanted to incorporate this into Paper-Rock-Sciscors, but I still had the problem of which unit to attack. Should pure teams focus on attacking the units they are strongest against (agressive) or should they focus on the units that are strongest against them? Should the minorities in hybrid teams attack the same target as the majority, or should they play to their own optimal target? I didn't want to compound the experiments, so I made everyone attack everything. But now, I'm going to analyze those questions independantly.

The Game:
To simplify, let's define the RTS game to only have 2 classes--let's say, Fire and Ice. Each unit has equal effective against itself. However, Fire is twice as effective against Ice, and Ice is twice as effective against Fire. Two teams will face off, each with a combination of Fire and Ice that equals 9 total. The game will be: what is the most effective target solution for each of the nine units? Does this change as a function of team makeup, or is the best strategy universal?

Saturday, March 1, 2008

Paper-Rock-Scissors 2: The Cost of Immunity

So, last time I created a mock RTS game with three basic units and posed some questions about which compositions of units would be most effective and least effective. I've run some simulations since then based off the following rules:


  1. All units will start a battle with 1.00 "health".

  2. Attacks will be turn-based.

  3. Each turn, every unit that started the round with positive health will deal X/100 damage to every enemy unit with positive health. X is the respective combat effectiveness against that particular unit.

  4. All attacks will affect all living unit opponents simultaneously (although the exact damage to each individual opponent will vary based on effectiveness). In terms of gaming jargon, this could be considered "Area of Effect" attacks. This is to remove the complication of sequencing from the simulations.

  5. If a unit receives a enough damage in a particular round to reduce its health from positive to non-positive, it will still attack during that round. This is to remove the complication of "first strike" from the simulations.

  6. Once all a team's units have their health reduced to non-positive values, it will be unable to attack and deemed the losing team.

  7. Once the opposing team loses, the winning team will be evaluated based on the sum of the health of all its surviving units.

  8. If both teams lose the final members on the same round, the match is deemed a draw. By definition, all "mirror matches" (when two teams of identical compositions face off) will be draws.

For a team of 9 and these 3 basic units, there are 55 permutations for teams. To further simplify things, I only considered 10 teams: the "pure" teams (9 of the same unit), "combo" teams (6 of one unit and 3 of another), and a "hybrid" team (exactly 3 of each unit). That reduces the number of permutations to 10, and it provides an evenly distributed subset. Here are the results of those 10 teams fighting against each other in a table format with the total wins tallied on the right. I also took note of what I considered "decisive wins", where the winning team retained at least 20% of its units' net health (1.80). I think this is a better graphical representation of these results, though:




There's a few things to note about the results of this model. First off, the hybrid team is extremely effective--it received 7 wins, 3 draws, and 0 losses. However, it's also worth noting that each win by an extremely small margin--it only received 1 decisive win, and that was against the pure melee build (all 3 flyers were unscathed). In other words, its a very low-risk/low-gain team. Second, melee-based teams perform very poorly in general. Unlike the other classes which are at a tactical disadvantage fighting respective their weakness, melee is totally ineffective against its weakness of flying units. Even a single flying unit will ultimately destroy any number of melee units. Third, the teams built around ranged and flying units are extremely effective--they have a winning record, they have a large number of decisive wins, and the give up a low number of decisive wins to their opponents.

In retrospect, I think I made an error of judgement when I considered my combat effectiveness table to be zero-sum. Rather than adding the offensive and subtracting the defensive numbers, I think I should have averaged the fraction of offense divided by defense. In other words: melee would have a total effectivenesses of 1/1, 2/1, and 0/1; ranged would have a total effectivenesses of 1/2, 1/1, and 2/1; flying would have a total effectivenesses 1/0, 1/2, and 2/2. Obviously, these numbers will never be totally balanced because X/0 will always be infinite. I think though that if the effectiveness of melee against ranged was increased and/or the effectiveness of flyers against melee was decreased, the results would be a lot more diverse rather than having some teams blatantly more powerful than others.

In published RTS games, immunities such as melee vs flyer are very common. However, units that possess immunities are usually compromised so that melee units are not at a distinct disadvantage--e.g., the flying units will be more difficult to produce or they will have limited use in combat.

Friday, February 15, 2008

Paper-Rock-Scissors: Balancing in RTS Games

Some of my favorite games are Real-Time Strategy (RTS) games such as StarCraft, Command & Conquer, and Sacrifice. One of the reasons is because RTSs give players the opportunity to "outsmart" their opponents--particular strategies have strengths and weaknesses against others, and if one player can adapt quicker than his opponent, it gives him a definite advantage.

For example, consider the following. Let's say there's a game with three basic types of units: melee, ranged, and flying. The flying units are immune to all melee attacks, but they are weakly armored so they aren't effective against ranged attacks. The ranged units deal additional damage to the flyers, but they also take additional damage from melee attacks. And of course, the melee units have an advantage against ranged but totally ineffective against flying units. In other words, its a basic Paper-Rock-Scissors hierachy.

Let's try to quantify this system in terms of relative effectiveness. For instance, let's say a single melee fighter will have an effectiveness of 1.0 when fighting another melee unit, 2.0 when fighting against a ranged unit, and 0.0 when fighting against a flying unit. That means that one melee unit will be able to defeat a ranged unit in the same amount of time it would take two ranged units and double the time it would take a single ranged unit. No amount of time or additional melee units will be able to overcome a flying unit.



Combat Effectiveness
Unit vs Melee vs Ranged vs Flying
Melee +1/-1 +2/-1 +0/-1
Ranged +1/-2 +1/-1 +2/-1
Flying +1/-0 +1/-2 +2/-2


In this table, the positive number represents the offensive effectiveness and the negative number represents the defensive effectiveness (i.e, how effective the opposing unit's offense is). I chose these particular numbers to try to make each unit's total effectiveness zero-sum. But the question is, are these particular numbers good ones? The goal is to make all units uniformally balanced. Otherwise, certain strategies will be inherently more successful and players will be encouraged to use the strengths of these strategies rather than trying to adapt to his opponents' specific weaknesses.

So the question is, if someone where to create a team of 9 units and play an opponent's unknown team of 9 units, what would his best lineup be? Is there a dominant team that is much more successful than the others? Are there some lineups that are distinctly weak? If so, what could be done to this effectiveness table to make the results more diverse? I've already simulated a lot of possible scenarios, but I'll keep the results saved for my next post.