You must be logged in to post messages.
Please login or register

The University

Hop to:    
Welcome! You are not logged in. Please Login or Register.3 replies
Age of Kings Heaven » Forums » The University » RMS Tutorials: Unequal Player Starts - part 2 (Approved)
Bottom
Topic Subject:RMS Tutorials: Unequal Player Starts - part 2 (Approved)
Zetnus
Squire
posted 02-10-17 08:41 AM CT (US)         
This article has been approved and can also be read at the University. - Leif Ericson

RMS Tutorials: Unequal Player Starts - part 2

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

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 you 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

........//\
......./ / / \ Check out my Blacksmith submissions as well as my stuff in the Steam Workshop.
....../ / /\\ \
...../ /_/_\\ \ Proud guardian of the Updated New RMS Guide <<<version 3 is out<<<
..../_____\\\ \
....\\\\\\\\\\\\\/ and the Random Map Scripting Links and FAQ thread.

[This message has been edited by Zetnus (edited 03-21-2017 @ 05:56 PM).]

AuthorReplies:
local boi
Squire
(id: dragon14)
posted 03-21-17 02:13 AM CT (US)     1 / 3       
Very informative I fidn't know there's a 99 object command limit or that id lands need them, bunch of things really



also an error in **Introduction**

> If have have not read part 1, I suggest doing that first

USA
katsup or mustard
Zetnus
Squire
posted 03-21-17 06:03 PM CT (US)     2 / 3       
Very informative I fidn't know there's a 99 object command limit or that id lands need them, bunch of things really
I didn't know that id lands would need them either, until I tested it and found that it was not working.
also an error in **Introduction**

> If have have not read part 1, I suggest doing that first
Thanks for pointing that out!

........//\
......./ / / \ Check out my Blacksmith submissions as well as my stuff in the Steam Workshop.
....../ / /\\ \
...../ /_/_\\ \ Proud guardian of the Updated New RMS Guide <<<version 3 is out<<<
..../_____\\\ \
....\\\\\\\\\\\\\/ and the Random Map Scripting Links and FAQ thread.
Zetnus
Squire
posted 01-12-20 09:54 AM CT (US)     3 / 3       
I should note that you can give multiple lands the *same* id, and then a single create_object command can be used to place that object on all of them.

........//\
......./ / / \ Check out my Blacksmith submissions as well as my stuff in the Steam Workshop.
....../ / /\\ \
...../ /_/_\\ \ Proud guardian of the Updated New RMS Guide <<<version 3 is out<<<
..../_____\\\ \
....\\\\\\\\\\\\\/ and the Random Map Scripting Links and FAQ thread.
You must be logged in to post messages.
Please login or register

Hop to:    

Age of Kings Heaven | HeavenGames