Actions

Random Map Generator

From Populous Wiki

Revision as of 01:03, 11 July 2007 by MadMan (talk | contribs)

The best known Random Map Generator is TedTycoon's RMG. It generates maps based on populous (rms) scripts. There is also a better, but less well-known map generator, which is MadMan's RGG.

History

First version of RMG

In late 2006 Ted started by writing a program which could produce a random polygon and fill it to create an area of land at a specified height. By applying multiple layers, islands containing land of varied contours could be produced. Once a smoothing algorithm was added, playable maps could be generated with interesting features looking very like original Bullfrog maps. The ability to spread random trees, wildmen, and Reincarnation Sites was added, then Ted played these random maps with beta-testers to check them out and get additional ideas and thoughts.

The first maps looked quite similar to one another with land looking much like Dead Sea. Ted then developed the progam to allow the map generation to be controlled by a script that allowed different areas of the map to be generated using varied criteria. This meant that maps could be specified to have islands of a certain number, size and height with objects, such as Stone Heads, to be created in tightly defined locations.

Ted then released a beta program which can read scripts (text files) and generate a random map. The program shows the map produced with generation statistics.

Current Status

In May 2007 Ted re-wrote the RMG as a windows dll which opens compiled scripts to generate level files. The RMG is planned to be implemented into the Reincarnated Matchmaker so players will be able to generate maps and immediately play them against with other players.

Script Files

RMS Compiler

Script files are commands that tell the RMG instuctions for how to create the map. Commands can be where to draw the island on the map and how many wildmen that need to be created etc.

Scripts are tested in the first version of the RMG where you can generate them one after the other to see what your random map looks like. For the latest version of the RMG, scripts must be compiled using the RMS Compiler.

Script Commands

Scripts start off with Island Commands which tell the RMG to create an island of constant height. Island commands have a number of parameters which tell the RMG what type of island to make, how big to make it, how high the land is and the area of the map to create it. By generating many islands over the top of one another, contours of land are created. After smoothing the land two or three times you get a random variety of hills, valleys and lakes depending on your script.

Commands start with the command name and then a colon. Parameters are separated using either commas or full-stops. Comments can be written into the script using two forward slashes. A random number between a range can be written as 'rnd(min-max)' where this is permitted.

Island

Island is one of the most important commands. It generates an area of flat land of the specified height and size. Lots of these overlapping will create islands of interesting shapes and varied height.

//Island:[Number],[IslandType],   [Size] ,  [Height]  ,[StartX],[StartY],[EndX],[EndY]
  Island:   5    ,     0      ,rnd(25-35),rnd(100-600),   10   ,   10   ,  120 , 120

This example creates five islands with a random diameter of 25 to 35 land tiles, each with a random height between 100 to 600, and placed in the map X,Y coordinate range of (10,10) to (120,120). Creating islands with a height of 0 will produce a water so you can create lakes, inlets etc over the top of previously generated land.

There are three island types. 0. A round blob with a feathered edge. 1. A ragged polygon with sharply defined features. 2. A plain rectangle from the start x,y to the end x,y.

RSGEN

The RSGen command should be placed after most of the island commands. This command creates a Shaman and 0 to 8 wildmen around her. It also flattens the area around her so that the Reincarnation Site is not on a cliff or edge. This command must be before any other objects are created to avoidplacing over trees or wildmen. If it is placed before the land is smoothed, the flattened area around the Reincarnation Site is smoothed to the area around it.

// RSGen:[Tribe],[Flatten Range],[RSWildies],[StartX],[StartY],[EndX],[EndY]
   RSGen:   0   ,        5      ,     6     ,    0   ,    0   ,  63  ,  63

This example picks a location in the upper left quadrant (range 0,0 to 63,63) and flattens five by five land squares around a blue Shaman and 6 wildmen. The RMG will prevent Reincarnation Sites being created too close too one another.

Smooth

The Smooth command gives the landscape a more realistic feel, by reducing sharp changes in height created by island commands. It does this by modifying the height of every land tile on the map to the average of the 8 tiles that surround it. Repeat the command (by using the Smooth Count parameter) until the desired degree of smoothing is obtained.

// Smooth:[Smooth Count]
   Smooth:       3

This example smooths all the land on the map 3 times which gives a good balance. The larger the number, the flatter and smoother it will be.

Wildies

This command generates wildmen at the required density, randomly across the area specified.

// Wildies:[Percentage],[StartX],[StartY],[EndX],[EndY]
   Wildies:    1.8     ,   0    ,   0    ,  63  ,  127

This example generates a number of wildmen in the left hand half of the map. The number of wildmen it creates is calculated as a the percentage of land tiles in the range. The command will accept either a decimal point or a comma, but it must be present (e.g. 1,0 or 1.0).

Trees

This command generate trees in an identical format to Wildies.

// Trees:[Percentage],[StartX],[StartY],[EndX],[EndY]
   Trees:    1.2     ,   0    ,   0    ,  63  ,  127

This example generates a number of trees in the left hand half of the map. The number of trees it creates is calculated as a the percentage of land tiles in the range. The command will accept either a decimal point or a comma, but it must be present (e.g. 1,0 or 1.0).

Head

This command creates a Stone Head, an Obelisk or a Gargoyle. There are many parameters to control worshipping and Spell properties.

// Head:[Head Type],[Range from RCs],[Occurrences],[Followers], [Seconds]  ,[Spell1],[Spell2],[Spell3],[StartX],[StartY],[EndX],[EndY]
   Head:     1     ,       25       ,   rnd(1-3)  ,     6     ,rnd(60-120),   16   ,   8    ,   14   ,     0   ,    0   ,   63 , 127

This example creates a Stone Head which is more than 25 blocks away from a Reincarnation Site, which can be triggered 1, 2 or 3 times using 6 followers to worship it. The worshipping time is randomly selected between 60 and 120 seconds to give the player Volcano, Earthquake or Firestorm. It is placed anywhere in the left hand half of the map (X,Y range 0,0 to 63,127).

Head Types:

  1. Stone Head
  2. Obelisk
  3. Gargoyle

Anything else is a Stone Head

Object

This command can create a custom object of your choice.

// Object:[Objects],[ID],[Group],[Colour],[StartX],[StartY],[EndX],[EndY]
   Object:    3    , 6  ,   18  ,   255  ,   0    ,    0   ,  127 ,127

This example creates three magical stones (neutral) anywhere on the map (X,Y range of 0,0 to 127,127). Object ids can be found on the Object Data page.

Landscape

This command tells the RMG which landscape and tree style to use when generating the .hdr file.

// Landscape:[Landscape], [Tree] 
   Landscape: Rnd(0-35) ,Rnd(0-6)

This example will use a random landscape and tree style out of all those possible.

Spells, Huts and God

These commands tell the RMG what Spells and Huts should be made available on the level, and whether God mode is set on or off.

   Spells:458996
   Huts:3840
   God:Off

Spells is a long integer containing booleans, -1 gives all. Huts is a short integer containing booleans, -1 gives all. God is either on or off and can be either 0 or off or anything else which is on.

External Links

Random Map Generator (First Version)