All 4 scripts are running concurently (that means 4 games concurently).duration of "test session" is about 4 hours, so I am getting 10 - 30 games per map during "session".
These four maps are used for testing and DNA of best AI player from particular map is copied to the source code and used for generation of new players in next iteration of test. Moreover each of 4 input DNAs are linked to test map, I picked the maps so that they are different and covers various conditions (limited space, snow, green land). There are 4 distinct DNA sets in the code, and new AI player takes genes randomly from all of them and performs mutation with probability about 1/15 afterwards. will cover following topics:Īfter some thinking current generation of new DNA of AI players look like this: So individual drops and rivers are usually very thin and gets filtered out You can have rivers visible, but for the game map I used threshold for WATER values to have actual lakes visible only. Note that you can have water column high in hundreds.
As a rule, final point terrain+water height cannot be higher than final terrain+water on starting pointĪ drop can move only to one of 8 nearest points.Įrosion process wraps (map wrapping is also feature of diamond-square)Įxception to “each drop moved each iteration” - in fact only 3 drops from a single spot can move in each iteration. When a drop moves it takes some soil with it if elevation difference is sufficient, so drop move changes WATER array always and TERRAIN array most of timeĪmount of moved soil is derived from TERRAIN + WATER differences between initial and target point. Individual drop in a water column on a single point does not have own “elevation”, we presume it is always positioned on the top elevation = TERRAIN + WATERĮach drop initializes on random position and (as expected) increased water value in WATER 2D arrayĮach drop when evaporates (after expiration of lifetime) decreases the water level on water 2D array TERRAIN is defined as 2D array and WATER is separate 2D array with count of drops per each field (pixel) The lifetime of a drop is defined (parameter of scrip) as a number of iterations (epochs) and all drops live the same timeĮach iteration every drop “wake up” and looks if it can move downward The number of drops is defined (parameter of scrip is drops per pixel) We start with raw diamond square filling up the TERRAIN array With exception of few areas on the earth.Īnd diamond-square algorithm create local minimums and maximums as a feature. The reason is that every point needs an water outflow way and is eventually connected to a sea that is generally lowest point on earth. I mean a complete valley completely encircled by slopes. But if you look at real world terrain - local minimas are almost non-existent. But this is out of scope of this my blog.ĭiamond-square algorithm is great here, and very easy to implement. Part of my workflow is to import output of this map generation script (an txt file) into widelands editor. My goal was and is to generate as realistic maps as possible. To get an idea visit and filter map by author ‘Tibor’ and ‘TiborB’ - both are me. This small work is to describe my experiences with generating maps for open source game Widelands.