RMS Tutorials: Unequal Player Starts - Part 2

Article written by Zetnus
Published on 03-20-2017; updated on 03-21-2017
Tags: Random Maps

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

This is part 2 of my tutorial about unequal player starts. Part 1 relied on using base_terrain to achieve the desired affect. I have since been told that it is also possible to use land_id to create unequal starts. That is the topic of this guide. If have have not read part 1, I suggest doing that first, since I will be building on the principles established there.

Lands

As in part 1, we will be using the create_land command with the assign_to_player (1-8) attribute instead of create_player_lands. However, we will now be adding a land_id to each land. We will keep the different terrains, but only to help you distinguish easily between the lands; they will not be used to differentially place objects.

This is exactly the same example as before, only we have added a land_id to each land. I have chosen the id to match the player number that the land belongs to, but you can choose any id you want.


<LAND_GENERATION>
base_terrain WATER
create_land
{
  terrain_type GRASS2
  land_percent 15
  assign_to_player 1
  land_id 1
}
create_land
{
  terrain_type DESERT
  number_of_tiles 150
  assign_to_player 2
  land_id 2
}
create_land
{
  terrain_type DIRT
  number_of_tiles 300
  assign_to_player 2
  land_id 2
}
create_land
{
  terrain_type LEAVES
  number_of_tiles 300
  assign_to_player 4
  land_id 4
}

<OBJECTS_GENERATION> create_object CASTLE { set_place_for_every_player }

So, let's generate that map in the scenario editor. Ooops ... no one has any castles! This is because set_place_for_every_player does not work for lands with an id. We need to manually place a castle on to EACH unique land_id. So, let us try that:


<OBJECTS_GENERATION>
create_object CASTLE
{
  place_on_specific_land_id 1
}
create_object CASTLE
{
  place_on_specific_land_id 2
}
create_object CASTLE
{
  place_on_specific_land_id 3
}
create_object CASTLE
{
  place_on_specific_land_id 4
}

Now we have the expected behavior (ie. the same as in part 1 of this tutorial).

AI-Friendly Nomad Example

Can we use land_id for our AI-friendly nomad map?

Yes! But we need to be careful to make sure we implement it correctly. The LAND_GENERATION section is relatively straightforward. We no longer need to specify different terrains, but we do need to specify different ids.


<LAND_GENERATION>
base_terrain GRASS
/* for the human player */
create_land
{
  land_percent 10
  base_size 15
  assign_to_player 1
  land_id 1
}
/* for the computer players */
create_land
{
  land_percent 10
  base_size 15
  assign_to_player 2
  land_id 2
}  
create_land
{
  land_percent 10
  base_size 15
  assign_to_player 3
  land_id 3
}  
/* repeat for players 4-8 */

Now we need to add our player objects. Remember: they must be separately placed on each land_id ! set_place_for_every_player will NOT work!


<OBJECTS_GENERATION>
create_object TOWN_CENTER
{
  group_placement_radius     18
  min_distance_to_players    0
  max_distance_to_players    0
  place_on_specific_land_id 2
}
create_object TOWN_CENTER
{
  group_placement_radius     18
  min_distance_to_players    0
  max_distance_to_players    0
  place_on_specific_land_id 3
}
/* repeat for players 4-8 */

create_object VILLAGER { min_distance_to_players 6 max_distance_to_players 21 place_on_specific_land_id 1 } create_object VILLAGER { min_distance_to_players 6 max_distance_to_players 21 place_on_specific_land_id 2 } create_object VILLAGER { min_distance_to_players 6 max_distance_to_players 21 place_on_specific_land_id 3 } /* repeat for players 4-8 */

Concluding Thoughts

So, should you use land_id or base_terrain to create unequal starts?

The land_id method means that all the lands can have the same base_terrain; however, there is also a major drawback! Every object normally placed with set_place_for_every_player now requires 8 create_object commands instead of only 1. This quickly becomes an issue, because having more than 99 distinct create_object commands causes issues where objects stop generating properly! That would only let us place 12 different objects if all 8 players need them (8x12=96). In our specific example with a nomad map, we would probably be able to to avoid this issue, since resources can be spread across the map, rather than placed as player objects. However, it is important to keep this in mind when making any map with unequal starts, since you are very likely to have many more create_object commands than in a normal map.

Basically, choose whichever method suits the map you want to create while making sure that you don't exceed 99 create_object commands.

That's all! I hope this was informative :D


Do you want to comment on this article? Thank the author? Tribute resources for its improvement? Raze it to the ground?

Come by and visit its thread in the University Forum!