Big card generation in the remake of Caesar III (c)

    If you are a fan of the Caesar III game, you must have noticed how diligently and attentively to the little things campaign maps were made, and free mode too. The natural landscapes on which the player erects the “new Rome” look quite realistic (within the framework of the game): streams flow into rivers and lakes, rivers flow through the whole map, and “immortal” sheep roam in the forests, sometimes wandering into meadows and interfering with building farms, gulls circling over places of fish gathering, and sometimes an unfortunate sailor swims in the remains of a ship. The rock massifs are surrounded by trees, and the ground is covered with a carpet of lush green grass. All this wonderful picture has a drawback, the size of the map does not exceed 160x160 tiles, in the article I will tell you how to generate large-sized maps.

    The original game does not support large maps, so all experiments were carried out as part of the CaesarIA project (open-source clone of Caesar III (c)) . Support for large cards in the remake was from the very beginning, but before reading a good article about using the diamond-square method in building landscapes , it was not possible to load any cards other than those that came with the game or made by fans. Realizing in which direction you need to move, I came across another article on the generation of landscapes , which finally convinced me of the reality of using this method to automatically create a map.

    The result of the original algorithm will be an array of points with heights, by associating the height with the color we get such a map.


    The colors have the corresponding meanings:
    - blue color corresponds to water with great depth,
    - lighter will mean water near the coast,
    - yellow will be the coast,
    - green means grass and flat areas,
    - saturated forest will show the forest,
    - gray and dark gray shallow and high mountains respectively.

    When adapting the results of the work to the specifics of the game landscape, I had to reconsider the interpretation of some values ​​and settings, but in general these data are suitable for further processing. Now you can display the obtained values ​​on the city map, for a start I will only change the water tiles and leave the rest unpainted.


    After pouring water tiles, you can fill in grass, forest and mountains. Now the generated map is more like a normal one.

    The remaining part of the map should, in theory, be covered with high mountains, but then it will become impassable for people, so instead of high mountains I will again use plain tiles. On the received map, the areas adjacent to the water remained empty.

    When filling in these areas, you will have to take into account the position of the neighbors in order to select the correct texture for a particular tile. The game has the following types of textures for a coast oriented:
    - North:
    - East:
    - South:
    - West:

    Such tiles are determined by the location of the tiles with water relative to the tile for which the calculation is performed. For example, a north-oriented coastal tile may have a water tile only in the north, northeast, and northwest directions, and combinations thereof. Similarly, we carry out calculations for the rest of the coast tiles and do not touch others. The result is a coastline without corner tiles.


    The next step is to find the corner tiles that were skipped in the previous step. Such tiles have triples of neighbors (water) in the direction north-> northeast-> east, east-> southeast-> south and analog. To display the angles of the coast in the game there are the following textures: placing them, we get a practically complete map.


    Now there are tiles on the water and on the ground that were not processed in the previous stages. Tiles that are surrounded by earth on all sides will also be attributed to the earth, and those that are surrounded by water - respectively, to the water. Tiles of the coast are simultaneously considered both water and land. Now it remains to supplement the map with a road so that settlers can come, and rivers to diversify the general landscape.


    Generating a card with a size of 500x500 tiles takes a little time, but still significantly more than loading ready-made cards. Below I posted a screenshot of a large map, 3800x1880 pixels in size. You can add different objects, settlements and even a city to this map in single player mode, but it seems to me that it is more suitable for the network. Another of the positive aspects of the selected algorithm is scalability, you can save the results of calculations and, if necessary, use them to calculate the neighboring territory.

    Of course, the generated map cannot be compared with that made by man, but the ability to create maps in automatic mode allows you to take one more step forward in creating a continuation and development of ideas embedded in the original game. You can also watch and participate in the development of the remake of Caesar III on the project page . The source code of the map generator is here .

    Bonus Screenshots from the remake

    Also popular now: