Age of Empires II (2013) Guide

An Introduction to Random Map Scripting for Age of Empires II (2013)

An Introduction to Random Map Scripting

Overview

A guide I’ve put together to help you find the right resources to learn about random map scripting.I update it whenever I find new and useful resources (or whenever I notice spelling mistakes).

Preface

THIS GUIDE IS NO LONGER BEING MAINTAINED


^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Here’s a remastered RMS guide I am working on [link]

Also, come join our Discord: discord.gg/KbTKFpJ

The Basics

What is a random map script?

A random map script (RMS) is a text file that contains a set of instructions and parameters, which are used to randomly generate a map. For example, Black Forest is popular map; but it’s never exactly the same. The overall theme is the same, but each time it is generated differently. A random map script is just that – it’s the instructions behind a map like black forest, costal, or anything else. (This is not to be confused with the “real world” maps, which are specialised scenario maps.) You can create your own random map scripts – that is what this guide is about!

Where do I find random map scripts?

To find out what a random map script looks like go to the “random” folder within your Age II HD folder. In there you might have some files with the extension .rms – these are random map scripts. Try opening one with notepad or word to take a closer look. If you do not have any .rms files in your random folder, subscribe to one of my maps or any other random map script in the workshop.
Advanced
>If you are using AoFE (the free mod), you can find the new maps under GamesForgotten EmpiresScript.RM

>You can find the all the internal maps by opening up gamedata_x1.drs (and gamedata_x2.drs) in the “Data” folder using any text editor.

How do I use a random map script?

Set up a match (single-player or multi-player). Choose either random map, deathmatch or regicide (the other modes aren’t supported for custom random maps in the HD edition (they were in the original version)). Select – map style: custom. Got to location and choose the random map you want to use.

Are you interested in making your own random map scripts?

Read on ๐Ÿ™‚

RM Scripting Pack

I compiled many of the guides, programs, and other utilities described in this guide into a single zip folder, which you can download here:
use the dropbox link for the most recent version!
[link]

Many of the things in this pack will be referred to later in this guide.

For items that were not created by me, please go to the original author’s page if you have feedback or would like to tell them how great their work is ๐Ÿ™‚

The Guides

Guides

All of these are included in the “Guides” section of my RM Scripting Pack

In order to get the most recent information, please look at the:
>Updated New RMS Guide
[link]
A version of the New RMS Guide where I’ve added updates (in red) to fix mistakes and document the changes brought about by the UserPatch and the HD Edition and the Forgotten.

>New RMS Guide (By Bultro)
Is the same as the updated guide above, but minus all the red bits. If you are scripting for the HD Edition, you should be reading my updated version instead.

– RMSG.doc (Random Map Scripting Guide) โ€“ written by Ensemble Studios and shipped with the original Age of Empires, but not with the HD version. Contains errors and misinformation! so do not trust everything it says if you do decide to read it.
Take a look at the end where they provide the script for the map “Coastal” (I have saved this script as an RMS file which you can find in the “sample scripts” folder of my Scripting Pack.)

CPSB.doc – the Computer Player Strategy Builder – shows you how to make custom AI scripts. Not relevant at the moment.

Some simpler tutorials that don’t cover everything but might be easier for beginners:
[link]
[link]
Be aware that both of these were written at least 10 years ago and thus may not be completely accurate anymore.

“These guides are really long …..”
Yes, I know. You would still benefit from reading them. Make sure to look at the most up-to-date one, which is my Updated New RMS Guide. At the very least skim though it and read the important sections (you can skip the object and unit lists for now and just keep them for reference).

Scripting Programs

How do I write random map scripts?

All you really need is any text editor – here are some options.
Save your file as a .rms file. or as a text file (.txt) and then rename it to a .rms.

Notepad – very simple text editor that comes with windows

Pros – easy to use, comes with windows
Cons – lacks any sort of useful features

My verdict – Well this is how I wrote my first 2 or 3 scripts, but honestly I would really recommend you use one of the other options, just because they have a few more features that can substantially speed up the process.

Notepad++ – a better version of notepad that comes with more features

Pros – still easy to use, search and replace, line numbers
Cons – doesnโ€™t provide any auto-generation capabilities
Download the most recent version at [link]

My verdict – definitely preferable to using notepad. I would recommend this if you just want to use a text editor rather than something which can auto generate parts of the script.

I have also included RMS Language for Notepad++ by ephestion.
I have yet to use it much, but it seems to add some coloring and formatting pertaining to random map scripts.
Originally available at: [link]

A more sophisticated set of RMS syntax for Notepad++ is currently being developed by Axa:
[link]

Word – or any word processor really. Just save it as a text file.

You can use this script generator for Word:
RMS Creator by: chasqui
Lets you auto-generate a script in Word, and offers quite a bit of scope for customizing the auto-generation. Great for beginners or casual scripters.
Included in my Scripting Pack
Originally available at: [link]
Pros – recently updated to work with newer version of Word. Reasonably flexible
Cons – requires enabling macros (but I assure you, using this program is perfectly safe)

My verdict – I havenโ€™t actually used this much, but it might be good choice if you are a beginner or if you want to quickly auto-generate a whole map and then edit it.

RMS Toolkit โ€“ (by: chasqui) an add-on for PSPad editor.

Pros – lots of nifty features: context sensitive help that links directly to the new RMS guide, search and replace, auto-generation of script sections, 4 sample scripts, side by side comparison of two files, text highlighting, etc.
Cons – installation is a bit more complicated. PSPad editor has a load of unnecessary options and features that you don’t need for making random map scripts and it can be confusing at first.

Included in my Scripting Pack
Also available at: [link]

My verdict – If you are willing to invest some time learning how to use it, this is great tool for making random map scripts. It’s a bit complex, but very helpful! Itโ€™s what I use.

______________________________________________________________________
Some early RMS generators that could potentially be useful:

RMS Editor 2 – (by Bryan)

Pros – Easy to use. No installation needed
Cons – Not as many features as some of the options described earlier

Included in my Scripting Pack
Originally available at:
[link]

My verdict – Could be useful for generating base scripts

RMS Generator – (by [soz]Exekutor)

Pros – No installation needed
Con – Seems to only let you generate objects, and not the other part of the script.

Included in my Scripting Pack
Originally available at:
[link]

My verdict – Go for one of the other options instead

Summary

RMS Toolkit is my top preference. It really makes random map scripting a lot easier. If you just want to do some basic edits, any text editor will do. However, getting syntax highlighting is very important as it will help you find typos that could mess up your script. Therefore Notepad++ with an RMS language installed is also a very good idea.
As a beginner you might want to try one of the other generators listed. Most require little to no installation and will help you quickly auto-generate a script which you can then edit.
Most of these programs are included in my RM scripting pack in the “Scripting Programs” folder

Getting Started

So you’ve read (or at least glanced at) an RMS guide and have a suitable text editor available.

Now take a look at the “Sample Scripts” folder in my Scripting Pack or the the “random” folder in your Age2HD directory. Choose a suitable base script to begin modifying. The land map and water map templates from RMS Toolkit are a good starting point if you don’t know what to choose (Hint: I have included these as sample scripts, but you can also generate these in RMS Toolkit: File -> New File -> Use Template -> RMS).
You might also want to try RMS creator or RMS Editor or RMS generator to generate a base script.

How to test your script

1) Place the .rms file in the random folder while you are editing it
2) Start up the game and go to the Scenario editor and generate your map a couple of times with a size and number of players of your choice. See what it looks like.
3) Alt+tab out to make edits and save them (or run the game in windowed mode!)
4) Switch back to the game and generate the map again to see if your changes worked as expected.

If you do not have the HD Edition or the UserPatch then you cannot easily generate maps in the scenario editor.
2)b) Start up the game and start a single player match with “all visible” to see what the map looks like
4)b) End your match an set up a new one, (do not choose “restart match” – it used the same seed if you do tha) to see if your changes worked as expected.

If you want some help with terrain names, (they changed some of them in the scenario editor in AoF and HD 3.0) go to the “Constants” folder in my Scripting Pack and take a look at Terrain Names.xls
That file can also be downloaded here:
[link]

Uploading to the Workshop

I can’t find the files in the in-game uploader???

.rms files are not visible in the uploader.
Just type in the name of your file and you will be able to select it.
Edit – I believe this was fixed in a recent patch. This issue still applies to .rms2 files.

Cover Photos

Make sure to add a cover photo so that people in the Workshop can see what you map looks like. You will get many more subscribers that way.
To add a cover photo click on “Add Preview” in the ingame uploader. It’s below the description box.

If you want to update a submission to include a cover photo, then reupload the item and give it the same title as the original. Also, make sure to keep a copy of the description stored somewhere (like a text document) since the update may wipe the description field.

This information needs to be updated for the new workshop system. In the mean time please look at my post here: [link]

How do you take a full-map screenshot?

This doesn’t work in the HD Edition ๐Ÿ™
However, if you own the original game (non-Steam) you can use CTRL+F12 to take full-map screenshots. That’s what I do.

Please! Is there no way to take a full-map screenshot without the original AoC?
You can use the “AoE II HD Compatibility Patch”. However, they don’t like it when you talk about it on Steam, so please don’t ask me where to find it (just google it).

Adding LudiKRIS Compatibility

Making your map work correctly with LudiKRIS size is easy and should be done whenever possible.

Existing random maps should function fine with LudiKRIS size, but there are two things to remember

set_scale_by_size will scale to LudiKRIS, which is 4x the size of Gigantic

Size——–Tiles on Sides——Total Tiles——Area ratio to 100×100 map
Tiny————120×120————14400—————–1.4
Small———-144×144————20736—————–2.1
Medium——-168×168————28224—————–2.8
Large———-200×200————40000—————–4.0
Huge———–220×220———–48400——————4.8
Gigantic——-240×240————57600—————–5.8
LudiKRIS—-480×480————230400—————23.0

Sorry, I used to have a table here which showed the wrong sizes; this has now been fixed!

*************************

If you specified object generation conditional on map size, these objects will not be generated for LudiKRIS sized maps unless you add a new command

For example, if your map contains something like this:

create_object GOLD { if TINY_MAP number_of_groups 2 number_of_objects 3 elseif SMALL_MAP number_of_groups 2 number_of_objects 3 elseif MEDIUM_MAP number_of_groups 3 number_of_objects 3 group_variance 1 elseif LARGE_MAP number_of_groups 3 number_of_objects 3 group_variance 1 elseif HUGE_MAP number_of_groups 4 number_of_objects 4 group_variance 1 elseif GIGANTIC_MAP number_of_groups 5 number_of_objects 4 group_variance 1 endif group_placement_radius 12 set_tight_grouping set_gaia_object_only min_distance_to_players 40 min_distance_group_placement 9 }

You should include a new LUDIKRIS_MAP command:

elseif LUDIKRIS_MAP number_of_objects 5 number_of_groups 14 group_variance 1

Otherwise the LudiKRIS map will have far too few resources for its size

Alternatively, you can just use an “else” command after all the elseifs from the regular sizes. This is what some of the official maps do.

New Scripting Commands for HD and AoF

New scripting parameters (ie. ones that are not in the RMSG or the New RMS guide. They are in my updated guide though).
The full documentation is here:
[link]

These new perameters can be used in *.rms2 files which can only be used while AoF is enabled.
As of patch 3.4, these paramters also work in the base game and with *.rms files.

ai_info_map_type has new options

New valid map types are:
ACROPOLIS
BUDAPEST
CENOTES
CITYOFLAKES
GOLDENPIT
HIDEOUT
HILLFORT
LOMBARDIA
STEPPE
VALLEY
MEGARANDOM
HAMBURGER

base_elevation
Modify the base elevation for player and standard lands. <ELEVATION_GENERATION> must exist if used.

Use in: LAND_GENERATION :: create_player_lands, create_land

Examples for base_elevation
1. Create a palm desert land with elevation 2.

<LAND_GENERATION> create_land { terrain_type PALM_DESERT number_of_tiles 128 base_elevation 2 } <ELEVATION_GENERATION>

grouped_by_team
Position team members in close proximity on the map. This command and “random_placement” are mutually exclusive. The “base_size” specified in “create_player_lands” determines the distance between players on a team.

Section: PLAYER_SETUP

Examples for grouped_by_team
1. Enable the team positioning system for player lands.

<PLAYER_SETUP> grouped_by_team /*replaces random_placement*/

nomad_resources
Modify starting resources to match the built-in nomad map. This means that the cost of a town center (275W, 100S) is added to the stockpile.
Section: PLAYER_SETUP

Examples for nomad_resources
1. Set starting resources like nomad with +275W, +100S.

<PLAYER_SETUP> random_placement nomad_resources

Constants AoC and AoF

You can make a functioning script without needing any of what is included in this section, but it lets you expand your capabilities.

The point with constants is that many objects in the game don’t have a name that you can use to include them in your RMS scripts. However, you can still include them if you know their constant number and give them a name that you choose. For example:

#const ROAD3 39
#const ROAD_SNOW 38
#const FEMALE_HUNTER 216
#const ANY_RANDOM_NAME_CAN_BE_CHOSEN_AS_A_CONSTANT!!! 217
#const WALKABLE_WATER 28
#const RUBBISH 145
#const OUTLAW 158
#const FURIOUS 860

Basically, there are objects (or terrains) associated with the number listed on the right. The command #const assigns a name (which you choose freely) to that number. You can then use that name in your script.

For a more information about constants, take a look at the relevant section of the New RMS Guide.

Lists of RMS constant numbers

In my Scripting Pack, I have included a series of rms constant lists. The New RMS Guide covers most of the useful ones. However if you want to investigate further, there are 3 sets of constant lists in the “constants” folder in the Scripting Pack. The Readme will tell you about the differences between each list.

AoF Constants

New constants were added with The Forgotten. I have created a list of these (which include stuff like bears, donkeys, elephants, cows, smoke patches and so on). It is in the RM Scripting Pack. The most recent version will always be avilable for download here [aok.heavengames.com]. If you use AoF constants in your script, it may crash when loaded up in the base game. Therefore, you should save files containing AoF constants as *.rms2 files, so that they can only be opened in AoF.

Questions?

Questions? Feedback?

Just leave a comment, and I will try my best to help ๐Ÿ™‚

SteamSolo.com