190 likes | 322 Views
Artificial Intelligence in Game Design. Content Generation. Content Generation. Creating world for game Terrain for battle games Levels for shooters Tracks for racing games … Most expensive part of development! Goal: Generate content automatically Cheaper, faster
E N D
Artificial Intelligence in Game Design Content Generation
Content Generation • Creating world for game • Terrain for battle games • Levels for shooters • Tracks for racing games … • Most expensive part of development! • Goal: Generate content automatically • Cheaper, faster • Infinite replayability
Terrain Maps • Most commonly applied to terrain maps in civilization games Goals (possibly contradictory): • “Realistic” appearing terrain • Continents, islands, mountains, beaches, deserts, etc. • “Fair” to all players • Equal amounts of resources, water, and flat areas for building cities near initial position for each player
Land Mass Generation One method: • Grow “land clumps” from each player location • Initial “territory” each player given chance to expand into before running into other players
Land Mass Generation • Each iteration grows clump by 1 tile • After given number of tiles, rest of map becomes “water” • Chosen randomly from tiles adjacent to existing clump • Must not be part of another player’s clump • Evaluated using “fitness” criteria • Nearness to initial player position • Number of adjacent tiles already part of player’s clump • Distance from other player’s clumps • If tile fails, choose another • Goal: avoid “peninsulas” P1 P1 P1 P1 P1 P1 P1 P1 P1 P1 P1
Island Map Generation • Each player initially given separate island • Can be built like land clumps • Additional criteria: New land tiles for player not allowed within some distance of tiles for other players (keep islands separated) • Additional islands can be generated in empty spaces after player islands created
Terrain Generation • Creating “realistic” looking map of land masses • Generally height based • Defining h(x, y) for points on the map • Low at beaches • High in mountains • Flat areas for city development • …
Fractals • Shapes which appear the same at any scale (self-similar) • Based on some “variance” applied at each level of detail • Modify area by some variance v • Subdivide into sub areas • Higher v more “jagged” look
Fractals • One dimensional example: • Start with line: • Vary height of center of line by random value between –v and v: • Vary height of center of each segment by –v/2 and v/2:
Fractals • One dimensional example: • Vary height of center of each segment by –v/4 and v/4: • And so on, until have as much detail as necessary
Fractals • Create “random” terrain by doing this in two dimensions
Adding Detail • Smoothing used to level out terrain in areas that should be flat • Beaches at interface of land/water tiles • Flat areas designed to allow players to build cities, etc. • Done by averaging heights in “flat” areas
Adding Detail • Create mountains in non-flat areas • Choose a location and increase its height • Use averaging to affect height of nearby locations (foothills) • Use wander behavior to create a mountain range over a certain distance
Adding Details • Create rivers as paths from mountains to ocean • Choose random point on coast • Seek nearest point at base of a mountain • Add wander to avoid a straight line
Resource Distribution • Must make sure resources are distributed fairly among all players • Gold, oil, uranium, etc. • Land on which structures can be built • Goals: • Each player should have same amount of resources available at any stage of game (depending on amount of territory captured) • Players should be encouraged to explore increasingly further from their initial position
Resource Distribution • Generate rings around player initial position • Randomly place r resources within each ring • r increases with each ring R R R R R R R R R R P1 P2 R R R R R R R R R R
Generate and Test • Generate level content in some random way • Evaluate that content • How playable/fun/challenging is it? • Is the level of difficulty appropriate for that point in game? • Modify that content • Change features that are not appropriate
Track Generation • Track generated as sequence of randomly generated spline curves • AI driver used to evaluate the difficulty level track • Overall time to drive the track • Variation in speed needed to drive the track • Individual spline curvatures modified for track sections which vary from the rest of the level
Mario Level Generation • Two-dimensional level generated • Pits, coins, enemies, etc. • Evaluated by human players • Fun: time moving right, enemies stomped, etc • Frustration: time standing still, falls into pits, etc.