posted 01-12-20 09:57 AM CT (US)   

RMS Tutorials: Custom Beaches

By: Zetnus

************************************************************
Preface

This tutorial assumes that you are familiar with the basic concepts of RM scripting – ie. you understand what all the parts of a standard ES map script do, and you are able to write your own basic scripts. If this is not the case, I suggest you read my Updated New RMS Guide or otherwise familiarize yourself with the basics of RM scripting.

************************************************************
Introduction

Custom Beaches?
Age of Empires II: Definitive Edition adds a bunch of new beach terrains, in addition to those new ones that were already added in the Rise of the Rajas DLC for Age of Empires II: HD Edition (2013).
In the Definitive Edition scenario editor, you can choose which beach you want to have automatically generated when terrain borders water, but for RM scripting it is not as straightforward.

All the beach types:
2 BEACH (normal beach – generated by most terrains)
37 ICYSHORE (ice beach – generated by snowy terrains)
51 DLC_BEACH2 (whiter beach with vegetation)
52 DLC_BEACH3 (normal beach with vegetation)
53 DLC_BEACH4 (whiter beach without vegetation)
91 DLC_REEDSBEACH (wet sand beach with reed tree objects on it)
107 DLC_WETBEACH (wet sand beach)
108 DLC_GRAVELBEACH (wet gravel beach)
109 DLC_WETROCKBEACH (wet rock beach)

Normal beach and ice beach are the only beach types that will generate by default, and also the only types that were available prior to the Rise of the Rajas DLC.

I will present two approaches for how you can get your map to use any of the other beach types.

************************************************************
Method 1: Place Beaches First

This method involves placing your custom beach type whenever you would normally want to place water. For example, as the map's base_terrain, as the terrain_type for any lake "lands", or as the base_terrain for any lakes produced in TERRAIN_GENERATION.
Once you have done this, replace this custom beach type with water in the TERRAIN_GENERATION section. Make sure to set spacing_to_other_terrain_types 1, otherwise will just get the normal beaches. You can set the spacing to a larger value to produce wider beaches.

Example:
A simple map that generates a river and lakes with rocky beaches (requires the Definitive Edition)

<PLAYER_SETUP>
random_placement

<LAND_GENERATION>
#const BEACH_WET_ROCK 109
base_terrain BEACH_WET_ROCK

create_player_lands
{
terrain_type GRASS
land_percent 100
other_zone_avoidance_distance 15
}

<TERRAIN_GENERATION>
create_terrain BEACH_WET_ROCK
{
base_terrain GRASS
number_of_clumps 40
land_percent 20
}
create_terrain WATER
{
base_terrain BEACH_WET_ROCK
spacing_to_other_terrain_types 1
number_of_clumps 9999
land_percent 100
}


************************************************************
Method 2: Replace Beaches with Connections

This method has you place all your water normally. Then, in CONNECTION_GENERATION you replace the standard beaches with your custom beach type and set a massive terrain size, big enough to cover even the largest of maps.

Example:
A simple map that generates a river and lakes with rocky beaches (requires the Definitive Edition)

<PLAYER_SETUP>
random_placement

<LAND_GENERATION>
base_terrain WATER

create_player_lands
{
terrain_type GRASS
land_percent 100
other_zone_avoidance_distance 15
}

<TERRAIN_GENERATION>
create_terrain WATER
{
base_terrain GRASS
number_of_clumps 40
land_percent 20
}

<CONNECTION_GENERATION>
#const BEACH_WET_ROCK 109
create_connect_all_lands
{
replace_terrain BEACH BEACH_WET_ROCK
terrain_size BEACH 999 0
}

************************************************************
Which Method to Choose?

Method 1 has the advantage that you can make beaches wider than 1 tile, if that is what you want. However, it has the drawback that you cannot use this method if you want elevated water, because water in TERRAIN_GENERATION cannot be placed on elevated terrain.

Method 2 is compatible with elevated water. However, you cannot easily make wider beaches using only this method, unless you combine it with additional code.
Another thing to note is that it is easier to achieve full coverage (if you have very many small clumps of lakes) with CONNECTION_GENERATION than if you use TERRAIN_GENERATION.

That is all
I hope this has been useful!

......../\
......./ / / \ Check out my Blacksmith submissions as well as my Random Map Scripts.
....../ / /\\ \
...../ /_/_\\ \ Proud guardian of the Definitive Random Map Scripting Guide
..../_____\\\ \
....\\\\\\\\\\\\\/ and the Random Map Scripting Links and FAQ thread.

[This message has been edited by Zetnus (edited 03-24-2020 @ 09:23 PM).]