1 / 24

Random Map Generation and Transport Unit AI for Strategy Games

Random Map Generation and Transport Unit AI for Strategy Games. By Russell Kuchar. Random Map Generation Focusing on Empire Earth (RTS). A system must generate maps for tile-based, real time strategy games for 2-16 players Must be fair with land and resources

Download Presentation

Random Map Generation and Transport Unit AI for Strategy Games

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Random Map Generation and Transport Unit AI for Strategy Games By Russell Kuchar

  2. Random Map GenerationFocusing on Empire Earth (RTS) • A system must generate maps for tile-based, real time strategy games for 2-16 players • Must be fair with land and resources • Maps of the same size, type, and number of players must be similar but allow for different results • 7 different types: continental, large islands, small islands, highlands, plains, tournament islands, and Mediterranean • 6 different sizes: tiny, small, medium, large, huge, and gigantic

  3. Basic Solution • Map Generation uses: number of players, number of teams, map size, map climate, type of random map, and random number seed • Players are placed on a blank map, teammates are placed adjacent, enemies opposite and symmetrical • Land is built around the players, flat land as well as rough terrain, then water fills the remaining area • Resources are added evenly for each player • Map is colored and textured • Player starting units and buildings are placed

  4. Scripts and Testing • Application is tested by creating an array of all possible combinations of the map generation results • Combines all land water arrays, height map arrays, and flat map arrays • Scripting languages allow for different map variations with only small changes • Uses master scripts for each map type and different subscripts for each map size

  5. Player Placement • First step in map generation is player placement • An algorithm is used to place players around the map in an optimal position • Algorithm does place players in predictable positions, but keeps map balanced • Teammates are placed into adjacent positions • Dummy players are created for the purpose of map generation to create additional, unclaimed, resource-rich areas for the growth of player’s colonies

  6. Clump Details • Fair land allocation is a priority • Land must have a natural appearance • Land is grown in the map generator in clumps • Clumps are defined by a clump size, number of clumps, and clump chaos level • Uses the completion method, growing a clump tile by tile, and the step method, growing a clump one tile per iteration • Clumps grow to their clump size, with the specified number of clumps and as random as the chaos level

  7. Clump Details • A land clump is created for each player • Land Clumps • Uses step method to ensure equal land for each player and ensuring that no player’s clump surrounds another • Land clumps are restricted to a certain distance from a player’s starting position and cannot overtake opponent’s land clumps

  8. Clump Details • Island Land Clumps: • Land clumps are restricted to a certain distance from opponent’s land • Flat Elevation Clumps: • Flat land is created within a player’s existing land • Ensures each player has adequate flat land to build buildings

  9. Height Map Details • After land is grown, realistic terrain is added • Fractals generate realistic looking elevation using map attributes resulting in height map array • Filter is applied to smooth out jagged terrain artifacts in the height map array • The height map array is combined with the land water array and adjustments are made to raise or lower some of the height map values to fit the terrain of the land water array

  10. Resource Allocation • Resources (berries, iron, gold, stone, and wildlife) are placed, each player receiving the same amount of each • Resources must maintain a certain distance from others and from players starting positions • Random locations for resources are selected until acceptable locations are found • Trees are the final resource placed since they are the most abundant and are used to also restrict pathfinding

  11. Multi-Island Continent Lake Large Island Random Maps

  12. Transport Unit AIFocusing on Empire Earth (RTS) • Transports move passengers (land-based units) around the map • Air, land, naval, and building transports are needed • Passengers are instructed to load into transports, the transports move to the desired location and the passengers are unloaded from the transport • System must adhere to existing RTS transport standards that players expect

  13. Transport Definitions • Air Transports: flies above the terrain and can move anywhere on the map but can only load and unload on valid flat land • Land Transports: limited to the same level terrain as land units • Building Transports: any stationary unit like a bunker or tower • Naval Transports: limited to moving in the water and loading and unloading on the shores

  14. Basic Solution • All transports have high level goals that are broken down and implemented through a finite-state machine (FSM) • Loading involves instructing units to become passengers, interacting with each other to appropriately load into the transports • Unloading involves the transport moving within a certain range of the unload location and unload the passengers while following rules about valid unload locations

  15. Passenger FSM • When given the load command, passengers are responsible for moving to the rendezvous point, wait for the transport and load into the transport • Passengers are responsible for making sure that the transport is still on its way to the rendezvous point and that they are able to make it to the rendezvous point • Once in the transport the passengers are idle and it is up to the transport to unload the passengers

  16. Transport FSM • When given the load command, transports are responsible for moving to the rendezvous point, waiting for the passengers and loading all the passengers or until the transport is full • When given the unload command, transports must move within range of the unload point and attempt to unload the passengers

  17. Loading • Both passengers and transports have the load command and must meet at a rendezvous point • An initial rendezvous point is determined and adjusted based on validity • If passengers cannot reach location based on a wall, mountains, etc., or the location is not valid, over water, a building, etc., a new rendezvous point is selected • Pathfinding is used to determine the proper path for the passengers and transports to take to make sure that they don’t move over invalid terrain • While moving to the rendezvous point, passengers must test to see if they are in range to load into the transport

  18. Loading • Air Transports: can move regardless of terrain so they move to the location of the nearest passenger which acts as the rendezvous point • Land Transports: the rendezvous point is located at the middle point between the transport and the nearest passenger based on maximum velocity of the units so they arrive at the same time

  19. Loading • Building Transports: cannot move, the rendezvous point is the building • Naval Transports: there are two rendezvous point, one land tile and one water tile, the distance of which must be less than the units load range. Passengers move to the nearest shore tile and the transport moves to the adjacent water tile to rendezvous

  20. Unloading • The transport has the unload command and heads toward the unload point • Unload point can be adjusted to another location if original is invalid • While moving to the unload point, transports must test to see if they are in range to unload the passengers • Sub-tile placement is used to prevent unloading passengers from colliding with other units or terrain and makes sure that illegal movement is not exploited

  21. Unload Point • Given transport point (T) and player’s click point (CP) there are three unload points • Transport Destination Point (TDP): point where transport moves to unload passengers • First Passenger Point (FPP): first tile adjacent to the TDP where passengers unload to and must pathfind from • Unload Point (UP): final destination of passengers which may be adjusted from the CP depending on pathfinding and validity of the UP

  22. Unloading • Air Transports: not restricted in pathfinding so FPP and UP are the same, only restrictions are on passengers to find valid terrain to unload upon • Land Transports: pathfinding is restricted the same as passenger pathfinding so the TDP, FPP, UP and CP are the same assuming the CP is a valid location

  23. Unloading • Building Transports: since these are immobile, the TDP, FPP, and UP are the same as the building’s location. Sub-tile placement code handles the unloading to make sure that placement is valid • Naval Transports: closest water tile to the CP is selected as the TDP and the adjacent land tile is the FPP. The UP is the closest tile on a straight line to the CP but within the unload range of the transport

  24. Summary • Random Map Generation considers player placement, clump detail growth, and resource allocation to ensure a fair but random map each time • Random Map Generation uses scripts and subscripts for the generation process • Transport Unit AI must control the Passengers in addition to the Transports • Transport Unit AI mainly considers loading and unloading, and uses pathfinding for movement of the transport and passengers

More Related