620 likes | 882 Views
RTS Presentation. by Alex Dulmovits and Luis Villegas. History. History of RTS Games. History. Precursors to RTS Utopia (1982) Direct manipulation of unit and resources for combat Turn-based Legionnaire (1982) Real-time No resource or economy/production concepts. History.
E N D
RTS Presentation by Alex Dulmovits and Luis Villegas
History History of RTS Games
History... Precursors to RTS • Utopia (1982) • Direct manipulation of unit and resources for combat • Turn-based • Legionnaire (1982) • Real-time • No resource or economy/production concepts
History... First RTS Games • Dune II (1992)
History... First RTS Games • Warcraft: Orcs & Humans (1994) • Command and Conquer • Age of Empires (1997) • Starcraft (1998)
History... Transition to 3D and Refinement • Total Annihilation (1997) • 1st RTS with 3D elements
History... Transition to 3D and Refinement • Empire Earth (2001) • Researching tech • Advancing Epochs
History... Evolution of the RTS Formula • Sins of a Solar Empire (2008) • Grand-Scale stellar empire building
History... Evolution of the RTS Formula • Achron • Time-travel elements
History... Evolution of the RTS Formula • Halo Wars • Modern RTS on a console
RTS Game Components • Civilization • Build • Unit • Resource • Research • Combat
Game Components: Civilization Manager • Highest-level manager responsible for development of the computer player's economy • Responsible for coordination between the build, unit, resource and research managers • Responsible for spending limits • Computer player expansion, upgrading and epoch advancement (EE)
Game Components: Build Manager • Responsible for placement of structures and towns • Receives requests from the unit manager for training buildings • Receives requests from the civilization manager for support buildings • All site evaluation occurs here
Game Components: Build Manager • Where buildings can and cannot be placed • RTS games restrict component placement • Red usually signifies invalid placement
Game Components: Build Manager • Take "area of effect" buildings into account • Buildings with an area of effect are placed near resources, where most units are likely to congregate
Game Components: Build Manager • Military Buildings • Nearby resources, but shouldn't interfere with area of effect buildings • Built in a ring around immediate area of resources • Other Buildings • Farms, airports, walls, docks, towers require specialized placements • Depends on terrain analysis engine • Place towers in choke points, avoid building near enemies
Game Components: Unit Manager • Responsible for training units • Keeps track of what units are in training in various buildings • Monitors the computer player's population limits • Prioritizes unit training requests
Game Components: Unit Manager • If training building not currently available, unit manager communicates with build manager • Attempts to maintain a similar unit count to the human players in the game to balance difficulty of game • By not allowing AI unit count to get too high, we lessen the CPU load of the game
Game Components: Resource Manager • Responsible for tasking citizens to gather resources in response from both the unit and build managers. • Balances gathering duties • Governs the expansion of the computer player to newly explored resource sites
Game Components: Research Manager • Responsible for directed research of computer player • Technologies are examined and selected based on their usefulness and cost
Game Components: Combat Manager • Responsible for directing military units on the battlefield • Requests units to be trained via unit manager • Deploys units in whatever offensive or defensive position is most beneficial
Game Components: Combat Manager • Keeps track of units via a personnel manager • Periodically updates the status, movement and actions of various attack groups • Offense and Defense are sub-managers within the combat manager.
Game Components: Combat Manager • Depending on what programming language is used, the combat manager communicates with the other managers in different ways. • In C++, with the managers implemented as classes, public methods can be used as a means to communicate.
Game Components: Combat Manager • Example: TrainUnit method in Empire Earth's Unit Manager • Responsible for for bringing new units into the world • Parameters: unit type, number desired, where is the unit required? (optional) • Communicates with Resource Manager to ensure sufficient resources, checks population headroom, communicates with Build Manager if training building needed
Game Components: Combat Manager • Example: TrainUnit method in Empire Earth's Unit Manager • Use training orders as a mechanism to determine when the request was complete • Training Orders are simple classes that contain information about the request and a method to call to check if and when something is complete
Game Components: Combat Manager • RTS Combat AI Example • Shogun 2
Game Components • All the game components will be communicating with each other • The problem comes when changing a manager • Small changes have profound effects on AI • AI becomes unpredicatable • Tracking down chains of cause and effect becomes the focus of late development testing
The Difficult Problem of Difficulty • Games are played by players with a broad range of experience • Tailor games to fit level of competence of player • Need to find a way for AI that can learn from the player as it goes along • Settle for pre-set difficulty levels • Avoid just adding more computer players for expert players. (more work for player and CPU)
The Difficult Problem of Difficulty • Goal should be to develop an AI that is good enough to give challenge to an expert player in a 1-to-1 match • Then tone down AI for intermediate and beginners • Hire expert players to help programmers do balancing • More difficult to start with an easy AI and increase its intelligence
The Difficult Problem of Difficulty • Choose what modifications to make to differentiate difficulty levels (narrow down) • The more variables you have, the harder it will be to test changes • Testing difficulty level changes is very time-consuming • Consider Cheating • Biggest Challenge: random maps
Goal Engine Architecture • Responsible for making all strategic-level decisions in the opposing player AI • Decides what actions to take, where to take those actions, and what resources to apply to each
Actors • Things within the game controlled by a human or AI players • Buildings: immobile actors • Defensive structures: can attack things • Economic buildings: provide some nonmilitary advantage • Units: movable actors • Military Units: can attack things • Builders: construct and/or repair buildings Combat Value (CV): numerical measure of an actor's effectiveness in a fight
Goals • Used to represent every action a player can take in the game • attack, defend, explore, recruit, construct, and repair • Influenced by resources (units, money) • Goal status: active/inactive/selected/finished • Base priority: priority of certain goal given the current state • Current priority: takes into account resource assignments as well as game state Change of priority by red team: http://youtu.be/0b1uSwY48r0?t=3m23s
Generating Goal Priorities (Part 1) • Common Tools: balance varying factors going into a priority • Make more realistic/human- like • Less predictable • Multipliers • Exponents • Min. values • Max. values • Inversion • Bonuses • One-time Bonuses • Repeat penalties • Random Bonuses • Fuzzy Factor: random bonus added to base priority of every goal • Goal Inertia: any bonus added to goals selected previously • Goal Commitment: even though requirements might not be met at the moment, still selected
Generating Goal Priorities (Part 2) • Money Value: AI needs to understand the value of resources such as: gold, wood, iron, food • How much? - More needed? • Actor Value: the value of an actor plays a large role in the priority of a goal • Some considerations that affect the determination of the actor priority • effect an actor has on the economy • the combat value of an actor • the strategic value of the actor's position • the location in the AI's territory
Generating Goal Priorities (Part 3) • Build Template: where buildings should be built with respect to one another • Bonuses for building certain buildings close to one another • Map Analysis: spatial reasoning • Region: map split up into rectangles where units can move freely • Pathfinding: using pathfinding system, can calculate distance between points which will encourage units to move to closer goals • Military Influence: every actor adds an influence to the region they are in depending on their CV • Equation:
Attack Goal • Attack goals are directed at an entire region • Base priority takes into account: • maximum number of a player's CV in a certain region • value that any capturable enemy actors would provide if they were controlled • Current priority takes into account: • CV ratio (ratio of friendly CV to hostile CV) • value of friendly CV in neighboring regions • whether or not there are known hostile units along path to attack region
Goal Based AI Conclusion • Advantages • Flexible and powerful • Complexity scales fairly well as AI grows • Can execute more than one goal at a time • Emergent behavior (to an extent) • Disadvantages: • Priority calculations (“Bucket of Floats”) • Emergent behavior (becomes predictable)
Citizens • Responsible for the building and gathering of resources within a town • Usually low CV • Problem: • Citizens can be instructed by player on what to do • But after completing their task what do they do? • Solution: • AI uses build and gather goals to instruct when/where to build and gather resources
Goals • A player can give citizens high-level goals • A citizen accomplishes these goals by following an FSM of varying actions • Citizens will continue their cycle of actions until sent a trigger by the player which will cause them to move onto another action
Building and Repairing • When a player selects to create a building with certain citizens, the citizens must: • Establish a build site (location where the citizen is to position themselves in order to build the building) • Find a path to the build site • Begin to build the building (by gradually adding hit points to it) • Once the building is complete, the citizen goes idle and waits for next trigger from the player • For repairs: • Similar to building, except the building location has already been determined • Each hit point repaired to the building, cost the player resources • If the player runs out of resources, the citizen goes idle
Building and Repairing • Build Site Selection: • must find a location around the desired building • must take other citizens' build sites into account before determining theirs • Citizen Build Queues • player can issue a queue of commands to a citizen • additional commands are added onto the back of the queue • Three-Phase Building Construction • Foundation: - must be cleared before construction begins - when in construction does not block paths • Scaffolding: - stage during construction - becomes visible to other players in range - more citizens working, the faster it is built • Completed
Gathering • Citizens must gather resources from a resource unit (gold ore, trees, etc.) and bring to a storage unit (town center, mill, etc.): • A player gives selected citizens a command to gather a certain resource • Citizens pathfind to the resource • They gather until their capacity is reached • Then they locate the nearest storage unit and dump the resources off adding to the player's total • Repeat • If a citizen can't find a resource unit or storage unit, it will become idle
Citizen AI Example: Empire Earth http://youtu.be/GUWnK25BdJE?t=2m30s
RTS Terrain Analysis • First need to know information about the terrain to determine what tactic the AI should perform • Some questions that can be used to determine terrain information: • Are my troops in a single region? • Are there enemy forces in the same region as my troops? • Does my region have connections to others? • What regions have important strategic value?