Article: Foundations of a Successful RTS

Foundations of a Successful RTS
[Tom Cadwell, 1999]

In this interesting article, Tom analyzes some aspects that RTS games should be considered when designing a RTS game.

Principles of RTS Balance:
  1. As a general rule, if race A builds up a unit mix and attcks race B, there should exist a cost/effective counter for B that is available around the same time and requires slightly less time to build. Also, versatile units should be less powerful compared to specialist units.
  2. Balane should take the form between unit mixes, not individual units. This is to avoid the "just build a large number of the same unit" problem.
  3. Consider maximum firepower conentration. Many super long range units is bad.
  4. As the range of the unit increases, the firepower should be reduced. This is unrealistic, but balances the game.
  5. Map lag. Don't allow units, especially early units, to cross the map too quickly.
  6. Combat formulae and the various values units have need to be very flexible to be able to fix balance if problems are discovered later on.
  7. Every attack should have a risk. There should always be some opportunity for you opponent to counter your attack and destroy your resources cos effectively.
  8. Endgame driving forces must be in place. Attrition is the way to go. Bigger isn't necesarily better. Avoid getting to the point of players having to control hundreds of units. Also, static defenses need a way of being cracked so a player who suffers from attrition will be unable to continue.
  9. The more a unit can move, the less powerful it should be, but some units that break this rule can be in the game to avoid map specific imbalances.

Design principles

  1. If it isn't fun, it should't be in a game. Avoid tedious tasks. Avoid lots of administative stuff unless your game is designed around them. And always avoid AI that acts stupid, this will 100% of the time annoy the player.
  2. Gameplay over realism. The game needs to "make sense" but that doesn't mean hyper realistic mechanics. If you need to sacrifice one or the other, sacrifice realism.
  3. The aspects of a game that appeal the most to the hardcore gamer should tend to be in the hidden features (hotkeys not visible on the screen, combat bonuses for cover, etc). Don't try to make the game "complex" by cluttering the screen with buttons.
  4. Sound effects and visual effects are extremely useful and don't affect play balance. Use them extensively.
  5. Straegic wealth should always be sought after. This is accomplished by complex unit interactions or simple but elegant resource system. Chess is a great example of simple but elegant game.
  6. Give units a "purijavascript:void(0)ty of purpose". Consider what do race X needs to flesh out its combat abilities in a unique way and come up with units that fit that feel. Also avoid giving units more than one purpose and having more than one unit per race that does the same.
  7. Never let a unit become obsolete. This confuses players and leads to more imbalances.

To read the complete article, go to StrategyGamingOnline.

Tom Cadwell, 1999. Foundations of a Successful RTS. Obtained in Jul 19th, 2011 from Strategy Gaming Online: http://www.strategy-gaming.com/editorials/sucessful_rts.shtml


Article: Using Potential Fields in a Real Time Strategy Game

Using Potential Fields in a Real-Time Strategy Game Scenario
[Johan Hagelback, 2009]
In this article/tutorial Johan explores a potential field based approach to real-time planning and navigation.

Potential fields are similar to influence maps in the fact that they are both constructed by placing numerical values on a grid map. The difference is that influence maps use player units/buildings to set the numerical values and potential fields place the numerical value in areas of interest.

An example of an influence map.

After the potenial map spreads through the map (fading its values to zero), a moving unit can easily reach it's destination by simply moving to its current more attractive adjacent tile. The idea is to use attractive fields in the destinations and repelling fields in the obsacles. This will create a potential map that will guide the unit through the terrain.

This can also have other applications, for example, when a unit ends its "attack phase" and enters a "reload phase", it can create repellant fields to flee if the enemy unit comes closer. Another application can be for long ranged units. If they place a small repellant field to enemy units to create a "ring" for the optimum firing range.

An example of a potenial field with obstacle repellant fields.

One of the advantages of using potential fields is the ability to handle dynamic game worlds. Agents only need to see one step ahead to move. They don't need to know the full path to their destination, eliminating the risk of obsolete paths due to changes in the game world. Also, it can easily create complex behaviors by just modifying the fields, for example, several unis will surround an enemy while being at shooting range and avoiding other friendly units who are also attacking the same enemy.

The main drawback from this approach would be the fact that it would need to be carefully programmed as to require an efficient amount of resources. Although the author solved this issue, it's definetely not something trivial.

For more information, including common problems and solutions, hit the link.
Hagelbäck, Johan, 2009. Using Potential Fields in a Real Time Strategy Game Scenario. Obtained in July 28th, 2011 from AiGameDev.com : http://aigamedev.com/open/tutorials/potential-fields/

Paper: Map-Adaptive Artificial Intelligence for Video Games

Map-Adaptive Artificial Intelligence for Video Games
[Laurens van der Blom, 2007]

The author of this paper explains how to implement an AI opponent in a RTS game that takes into account the properties of the map it is placed in. For example, the AI makes decisions based on the amount of resources nerby, the location of cliffs and/or narrow passages, and the overall strategy of the opponent (if the opponent is playing offensively or defensively).

To achieve this, a ID3 Decision Tree was used in combination with fuzzy logic to allow the AI to find the best course of action depending on the current state of the game.

The game in which the AI was tested was a moderately complex RTS so the following set of rules were used:

  1. Construct metal extractors at near metal resources.
  2. Construct metal extractors at far away metal resources.
  3. Place offensive units at relatively narrow roads.
  4. Place offensive units at own base.
  5. Place artillery on cliffs.
  6. Protect operational metal extractors.
  7. Protect artillery on cliffs.

The AI was tested against a computer controlled opponent and a human opponent in five different types of maps designed to test specific attributes like amount of resources or presence of narrow paths. In most of their tests, the AI performed as they expected but when placed against a human player it lost most of the games (even if it also performed as expected).

What I liked about this approach is that the AI actually varies the strategy if the enemy is near or not and if the enemy is attacking or not and it's relatively easy to distinguish what actions are being performed by it. And while this approach works, the AI had a hard time beating human players. That may be caused because, as the author states in the article, the decision tree needed more specific cases. Maybe the use of a nerual network could remedy this issue, but it could make the implementation a little more complicated or even change it completely.

Read article, complete with experiments and results here.

Van der Blom, Laurens, 2007. Map-Adaptive Artificial Intelligence for Video Games. Obtained in July 21st, 2011. http://www.unimaas.nl/games/files/bsc/Blom_BSc-paper.pdf

RTS example project in Unity

I just stumbled across a public project in Unity that can be extremely helpful when trying to make a RTS style game in this game engine.

The project's last official update(1.1) was on august 2009, but the community has been adding little bits of stuff and posting small updates on their own (a quick search through the post's replies is enough to find all the different updates). Someone even created a SVN for the project and someone created google docs for documentation. (Open source projects with a great community are amazing!)

This project is free for personal and commercial use which is great and it always helps not having to write everything from scratch.

The project can be found here.

An example of the project running (version 1.1) can be played here.

Paper: Random Map Generation for Strategy Games

Random Map Generation for Strategy Games
[Shawn Shoemaker, 2004]

This paper explains how to generate a random map for a RTS game using clumps.
One of the most important aspects to consider when creating random maps for these games is the balance. Every player must have a balanced amount of terrain near them and a balanced amount of resources.
This can be achieved with clumps which are pieces of land that iteratively grow untill the map is filled. Initially, the map contains an empty grid with a tile for every player. This initial tiles are equally separated from each other.
Then, each tile grows iteratively by one tile, creating a clump of land untill the maximum growth size is reached or there are not enough tiles to expand again.
This leaves us with a map grid of zones for each player with roughly the same space. After each player's space has been determined, terrain height details will be generated, trying to give each clump a balanced configuration. Finally, resources can be placed inside each of the clumps, ensuring that each player can obtain the same amount of resources in one way or another.
This technique is useful as a general map creation algorithm, for either simple or complicated maps for different types of games.
A more detailed explanation of the algorithm and some examples can be found in the book AI Game Programming Wisdom 2.

Shoemaker, Shawn (2004). Random Map Generation for Strategy Games. In Steve
Rabin (Ed.) AI Game Programming Wisdom 2. United States, Charles River Media

Article: Decision Making Levels in RTS Games

Decision Making Levels in RTS Games
[Muhamad Hesham, 2010]

In this short blog post, Muhamad divides the actions in RTS games in three different levels:
  1. High level strategic decisions
  2. Intermediate level tactical decisions
  3. Low level micromanagement decisions.
The high level strategy resembles the general of a real army. The actions include building a base, training units, attacking enemis, etc. The perception at this level is based on the information from the lower levels.

Medium level actions resemble a commander that groups units into fighting elements and control them in a large war sense.

Finally the low level actions are most commonly known as actions like moving units or using a unit's special ability.

This is how players make decisions while playing RTS games and AI creation can be made to resemble this behavior. Each level should not care on how the lower levels will carry on a specific task, for example, in the high level, a decision has been made to attack the enemy, so the message arrives at the medium level. Here, it is decided which troops will move and where and finally the low level will be in charge of finding the best path and maintaining a strong formation within the group of units.

The author concludes that medium-level AI is the most complex of all and is usually lacking in most games because of this. The amount of feedback information that is needed and complex plans that need to be made make this level AI worth considering.

Read the full article here.

Hesham, Muhamed (2010). Decision Making Levels in RTS Games. Obrained in July 10th, 2011 from Adaptive AI Engine for RTS: www.rtsairesearch.wordpress.com/2010/10/27/paper-read-an-integrated-agent-for-real-time-strategy-games/

Unity: SimplePath


SimplePath is a set of scripts for Unity that allows fast pathfinding for any type of terrain. It supports deployment to Web, PC, Mac, iPhone, and Android. These scripts cost $60 usd and can be bought from the Unity Asset Store.

SimplePath's web page.

Paper: Can a Realistic Artificial Intelligence be created for a Real-Time Strategy Game?

Can a Realistic Artificial Intelligence be created for a Real-Time Strategy Game?
[Dane Anderson, 2008]

In this paper, the author explains how is it possible to create a realistic AI for a RTS game. To make this task easier, the AI should be divided in two important categories:
  • Tactics: Combat and path-finding.
  • Strategy: Sub-goal identification, engaging the enemy, learning and economy management.
This involves individual units fighting with each other. This section boils down to choosing the correct weapon for each unit to use in specific situations. This is further simplified if the unit only has one weapon available.

This involves units, individually or as a group, finding the shortest path between two points. The author quickly states that the A* algorithm is a popular choice for RTS games but it suffers from two important flaws. The first one is the amount of resources needed to calculate the path for all the units. This can be solved with flock algorithms, from which Simple Swarms (SS) was chosen for its efficiency and easy control. The second one is unreallistic movement when obstacles are present. This can be solved by calculating the path before moving (the amount of resources needed are balanced with the use of SS).

Sub-Goal Identification
This involves the use of scouts to acquire information about the player to create sub-goals that will help the AI to win the game. For example, if the scout detects that the player has created an archer, the AI can deduce what buildings the player has built and adjust the units that will be created next.

Engaging the Enemy
This involves how the AI will use the units at its disposal. The author explains that most of the time, the AI sends the units unintelligently, making it easier for the player to kill them. Influence Maps can prevent this behavior because the enemy formations can be easily determined and the AI can make a better decision on how to move its units.

This involves the AI adjusting its strategy over time. This is intended to mimic the players own behavior, as they also adjust their strategies over time.

Economy Management
This involves the AI managing units, constructions and resources. The use of a resource chart will help the AI determine what units to build or what buildings to construct based on its current sub-goal.

The author concludes that the use of this architecture for the creation of the AI can achieve a better sense of realism for the player, because both players are given the same information and the competition becomes fair (no need to use 'cheating' techniques, often used in game AI).

Read the paper here

Anderson, Dane (2008). Can a Realistic Artificial Intelligence be created for a Real-Time Strategy Game? Obtained in July 10th, 2011 from Scribd.com http://es.scribd.com/doc/2546855/Can-a-Realistic-Artificial-Intelligence-Be-Created-for-a-RealTime-Strategy-Game