Presentation is loading. Please wait.

Presentation is loading. Please wait.

RTS Presentation by Alex Dulmovits and Luis Villegas.

Similar presentations


Presentation on theme: "RTS Presentation by Alex Dulmovits and Luis Villegas."— Presentation transcript:

1 RTS Presentation by Alex Dulmovits and Luis Villegas

2 History History of RTS Games

3 History... Precursors to RTS Utopia (1982) o Direct manipulation of unit and resources for combat o Turn-based Legionnaire (1982) o Real-time o No resource or economy/production concepts

4 History... First RTS Games Dune II (1992)

5 History... First RTS Games Warcraft: Orcs & Humans (1994) Command and Conquer Age of Empires (1997) Starcraft (1998)

6 History... Transition to 3D and Refinement Total Annihilation (1997) o 1st RTS with 3D elements

7 History... Transition to 3D and Refinement Empire Earth (2001) o Researching tech o Advancing Epochs

8 History... Evolution of the RTS Formula Sins of a Solar Empire (2008) o Grand-Scale stellar empire building

9 History... Evolution of the RTS Formula Achron o Time-travel elements

10 History... Evolution of the RTS Formula Halo Wars o Modern RTS on a console

11 Architecting an RTS AI

12 RTS Game Components Civilization Build Unit Resource Research Combat

13 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)

14 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

15 Game Components: Build Manager Where buildings can and cannot be placed o RTS games restrict component placement o Red usually signifies invalid placement

16 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

17 Game Components: Build Manager Military Buildings o Nearby resources, but shouldn't interfere with area of effect buildings o Built in a ring around immediate area of resources Other Buildings o Farms, airports, walls, docks, towers require specialized placements o Depends on terrain analysis engine o Place towers in choke points, avoid building near enemies

18 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

19 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

20 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

21 Game Components: Research Manager Responsible for directed research of computer player Technologies are examined and selected based on their usefulness and cost

22 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

23 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.

24 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.

25 Game Components: Combat Manager Example: TrainUnit method in Empire Earth's Unit Manager o Responsible for for bringing new units into the world o Parameters: unit type, number desired, where is the unit required? (optional) o Communicates with Resource Manager to ensure sufficient resources, checks population headroom, communicates with Build Manager if training building needed

26 Game Components: Combat Manager Example: TrainUnit method in Empire Earth's Unit Manager o Use training orders as a mechanism to determine when the request was complete o Training Orders are simple classes that contain information about the request and a method to call to check if and when something is complete

27 Game Components: Combat Manager RTS Combat AI Example o Shogun 2

28 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

29 Difficulty Levels

30 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)

31 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

32 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

33 Priorities in Goal- Based RTS AI

34 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

35 Actors Things within the game controlled by a human or AI players Buildings: immobile actors o Defensive structures: can attack things o Economic buildings: provide some nonmilitary advantage Units: movable actors o Military Units: can attack things o Builders: construct and/or repair buildings Combat Value (CV): numerical measure of an actor's effectiveness in a fight

36 Goals Used to represent every action a player can take in the game o 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 http://youtu.be/0b1uSwY48r0?t=3m23s

37 Generating Goal Priorities (Part 1) Common Tools: balance varying factors going into a priority o Make more realistic/human- like o 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

38 Generating Goal Priorities (Part 2) Money Value: AI needs to understand the value of resources such as: gold, wood, iron, food o How much? - More needed? Actor Value: the value of an actor plays a large role in the priority of a goal o 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

39 Generating Goal Priorities (Part 3) Build Template: where buildings should be built with respect to one another o Bonuses for building certain buildings close to one another Map Analysis: spatial reasoning o Region: map split up into rectangles where units can move freely o Pathfinding: using pathfinding system, can calculate distance between points which will encourage units to move to closer goals o Military Influence: every actor adds an influence to the region they are in depending on their CV  Equation:

40 Attack Goal Attack goals are directed at an entire region Base priority takes into account: o maximum number of a player's CV in a certain region o value that any capturable enemy actors would provide if they were controlled Current priority takes into account: o CV ratio (ratio of friendly CV to hostile CV) o value of friendly CV in neighboring regions o whether or not there are known hostile units along path to attack region

41 Goal Based AI Conclusion Advantages o Flexible and powerful o Complexity scales fairly well as AI grows o Can execute more than one goal at a time o Emergent behavior (to an extent) Disadvantages: o Priority calculations (“Bucket of Floats”) o Emergent behavior (becomes predictable)

42 RTS Citizen AI

43 Citizens Responsible for the building and gathering of resources within a town Usually low CV Problem: o Citizens can be instructed by player on what to do o But after completing their task what do they do? Solution: o AI uses build and gather goals to instruct when/where to build and gather resources

44 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

45 Building and Repairing When a player selects to create a building with certain citizens, the citizens must: o Establish a build site (location where the citizen is to position themselves in order to build the building) o Find a path to the build site o Begin to build the building (by gradually adding hit points to it) o Once the building is complete, the citizen goes idle and waits for next trigger from the player For repairs: o Similar to building, except the building location has already been determined o Each hit point repaired to the building, cost the player resources o If the player runs out of resources, the citizen goes idle

46 Building and Repairing Build Site Selection: o must find a location around the desired building o must take other citizens' build sites into account before determining theirs Citizen Build Queues o player can issue a queue of commands to a citizen o additional commands are added onto the back of the queue Three-Phase Building Construction o Foundation: - must be cleared before construction begins - when in construction does not block paths o Scaffolding: - stage during construction - becomes visible to other players in range - more citizens working, the faster it is built o Completed

47 Gathering Citizens must gather resources from a resource unit (gold ore, trees, etc.) and bring to a storage unit (town center, mill, etc.): o A player gives selected citizens a command to gather a certain resource o Citizens pathfind to the resource o They gather until their capacity is reached o Then they locate the nearest storage unit and dump the resources off adding to the player's total o Repeat If a citizen can't find a resource unit or storage unit, it will become idle

48 Citizen AI Example: Empire Earth http://youtu.be/GUWnK25BdJE?t=2m30s

49 RTS Terrain Analysis

50 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: o Are my troops in a single region? o Are there enemy forces in the same region as my troops? o Does my region have connections to others? o What regions have important strategic value?

51 Geometric Terrain Analysis Approach Uses Voronoi diagrams using geometric information Useful for dividing map into different areas which can later be classified by an algorithm Drawbacks: o doesn't take into account changing map features (such as water and land) o provides no information about strategic value of area Voronoi diagram of obstacles consists of a set of points which are equidistant from two or more distinct obstacles Created from 2D Segment computer programs

52 Pathfinding Simulation Analysis Approach Attempts to find important paths on map Useful to help determine paths and avenues of approach that are most likely to be used After a pathfinding technique is used, determines the paths that were travelled the most o Higher concentration of paths = more important the location is Drawbacks: o No information about logical areas o No information about connections o No information from the paths about which of their waypoints are important

53 Combined Approach Both Geometric Terrain Analysis and Pathfinding Simulation Analysis Approaches have drawbacks Use a combination of the two approaches Geometric Terrain Analysis o Used to detect logical areas and their connections Pathfinding Simulation Analysis o Determine the importance of paths

54 Basic Concepts Passability Map: map that shows what regions are passable o Black pixels: represent passable areas o White pixels: represent impassable areas (slope too steep or river) o Bridges displayed since they affect passability o Other buildings or trees not included Regions: passable areas surrounded by impassable terrain or regions of different type o Game zones: broad, open passable areas o Chokepoints: narrow corridors between game zones Connections: logical links between chokepoints and game zones Hotspot: best position to defend a game zone from attacks coming through a particular chokepoint

55 Terrain Analysis Algorithm Noise Reduction o Cleans passability map  Removes small islands or pockets of impassable terrain that produce useless divisions o Selects zones of impassable terrain o Fills small areas with black pixels Random Pathfinding o Takes information of terrain heightmap and pathfinding data  Finds most likely used paths by enemy o Calculates a large number of random paths and stores them

56 Terrain Analysis Algorithm Iterative Image Processing o Takes in a clean passability map o Generates an output image on which each region is clearly marked by different colors: passable terrain impassable terrain game zone choke point Combining Image Processing and Pathfinding Data o Computes a hotspot for each connection between a chokepoint and game zone o Returns list of game zones connected by the chokepoint o Returns hotspot for each chokepoint o Direction from the hotspot to the game zone connected to it

57 Terrain Analysis Depiction 1. Select impassable terrain 2. Expand selection 3. Invert selection 4. Fill (Free spaces) 5. Expand selection 6. Invert selection 7. Deselect impassable 8. Fill (Choke points)

58 Terrain Analysis Conclusion: Use of Map Information AI system can use this knowledge to help defeat the enemy o Properties of each region o Which areas contain allied and enemy units o Hotspots: which connections must be defended or attacked depending on enemy position o Direction of hotspot: where to place units at appropriate locations relative to the connection o Weighting information: which regions and connections are most important

59 Conclusion Recap: History Architecting an RTS AI Difficulty Levels Priorities in Goal-Based RTS AI RTS Citizen AI RTS Terrain Analysis The future of RTS games/graphics Total War: Shogun 2 http://youtu.be/RgglJXnjNe4?hd=1&t=36s


Download ppt "RTS Presentation by Alex Dulmovits and Luis Villegas."

Similar presentations


Ads by Google