| 1 |
root |
1.1 |
Included herein is a description of the Region system, as implemented in March 2005. |
| 2 |
|
|
|
| 3 |
|
|
If by the time you read this, this date is old, then this file may not have been kept |
| 4 |
|
|
up to date, either that or no relevant changes have occurred, the Changelog should help |
| 5 |
|
|
you determine which is the case. |
| 6 |
|
|
|
| 7 |
|
|
*****Contents***** |
| 8 |
|
|
|
| 9 |
|
|
How to read this file |
| 10 |
|
|
Overview |
| 11 |
|
|
Struct values and meaning |
| 12 |
|
|
Sample region file entry and meaning. |
| 13 |
|
|
Functions exposed and purpose thereof |
| 14 |
|
|
player visible changes |
| 15 |
|
|
Known/suspected bugs. |
| 16 |
|
|
Future plans |
| 17 |
|
|
|
| 18 |
|
|
*****How to read this file***** |
| 19 |
|
|
|
| 20 |
|
|
If you are a mapper and want to create a new region for your maps |
| 21 |
|
|
read: |
| 22 |
|
|
Overview |
| 23 |
|
|
Sample region file entry and meaning. |
| 24 |
|
|
|
| 25 |
|
|
If you want to add new features to regions, read |
| 26 |
|
|
Struct values and meaning. |
| 27 |
|
|
Known/suspected bugs. |
| 28 |
|
|
Future plans |
| 29 |
|
|
maybe the rest if you can be bothered. |
| 30 |
|
|
|
| 31 |
|
|
If you are developing something else and want to interact with region information read: |
| 32 |
|
|
Functions exposed and purpose thereof |
| 33 |
|
|
Known/suspected bugs. |
| 34 |
|
|
|
| 35 |
|
|
If you are merely a curious player who stumbled upon this by accident, read: |
| 36 |
|
|
player visible changes |
| 37 |
|
|
and, if you care enough... |
| 38 |
|
|
Future plans |
| 39 |
|
|
|
| 40 |
|
|
*****Overview***** |
| 41 |
|
|
Regions are connected to maps, they allow a set of common properties to be associated with |
| 42 |
|
|
the maps in the game. |
| 43 |
|
|
The map struct has had a pointer to a region struct added. This pointer points to the region |
| 44 |
|
|
that the map is in. |
| 45 |
|
|
|
| 46 |
|
|
The map files are altered to have a new field in the header |
| 47 |
|
|
|
| 48 |
|
|
The line should read |
| 49 |
|
|
region name |
| 50 |
|
|
|
| 51 |
|
|
where 'name' is the name of a region defined in the regions file. |
| 52 |
|
|
|
| 53 |
|
|
The maps are linked to their regions at load time. |
| 54 |
|
|
|
| 55 |
|
|
Each region is guaranteed only to have 3 values, a name, next and a parent |
| 56 |
|
|
exception to this, there is a base region with a NULL parent pointer, this should have *all* |
| 57 |
|
|
other fields defined, if a region doesn't have a field defined, then it traverses up the |
| 58 |
|
|
inheritance tree, until it finds a definition of the field. |
| 59 |
|
|
|
| 60 |
|
|
Look to the next section to see what the values stored in the region are. |
| 61 |
|
|
|
| 62 |
|
|
Example of this. |
| 63 |
|
|
region world, this is the base region, with no parent. |
| 64 |
|
|
region scorn, this has parent world, and longname "Kingdom of scorn" |
| 65 |
|
|
it has msg "you are in scorn" |
| 66 |
|
|
region scornoldcity, this has parent scorn, and no longname, it has msg |
| 67 |
|
|
"you are under scorn" |
| 68 |
|
|
|
| 69 |
|
|
if we call get_region_msg(region) with scornoldcity as the region, it will return |
| 70 |
|
|
"you are under scorn" |
| 71 |
|
|
if we call get_region_longname(region) with scornoldcity as the region, it will return |
| 72 |
|
|
"Kingdom of scorn" |
| 73 |
|
|
|
| 74 |
|
|
This means that any combination of values can be used scoped appropriately. |
| 75 |
|
|
|
| 76 |
|
|
Next the values themselves.... |
| 77 |
|
|
|
| 78 |
|
|
*****Struct Values and Meaning***** |
| 79 |
|
|
This contains a list of the information about the regions and what the fields mean. |
| 80 |
|
|
*next; |
| 81 |
|
|
we construct a singly-linked list of regions, to check all, you go through one by one |
| 82 |
|
|
calling region->next until such time as next is NULL. This is the same as the way most |
| 83 |
|
|
other structures in the game work. |
| 84 |
|
|
|
| 85 |
|
|
*name |
| 86 |
|
|
This field is compulsory, it is the name of the region, which is used to connect the maps to the |
| 87 |
|
|
regions. |
| 88 |
|
|
|
| 89 |
|
|
*parent_name |
| 90 |
|
|
This is the name of the parent, only used during initialisation |
| 91 |
|
|
|
| 92 |
|
|
*parent |
| 93 |
|
|
pointer to the parent region. |
| 94 |
|
|
|
| 95 |
|
|
*longname |
| 96 |
|
|
The title of the region, this should be the full, verbose title, with lots of pompousness |
| 97 |
|
|
|
| 98 |
|
|
*counter |
| 99 |
|
|
This doesn't really have a fixed meaning, it is just somewhere to count things |
| 100 |
|
|
(at the moment the number of players) |
| 101 |
|
|
|
| 102 |
|
|
*msg |
| 103 |
|
|
The description of the region, think guidebook entry. |
| 104 |
|
|
Displayed to provide some background flavour. |
| 105 |
|
|
|
| 106 |
|
|
*fallback |
| 107 |
|
|
If a map has a misspelling, say scron instead of scorn, then we can't match the name. |
| 108 |
|
|
One region should have this set, so that the map can still be assigned a region |
| 109 |
|
|
until such time the map creator learns to spell. |
| 110 |
|
|
|
| 111 |
|
|
*****Sample Regions file entry***** |
| 112 |
|
|
|
| 113 |
|
|
region scorn |
| 114 |
|
|
longname The Kingdom of Scorn |
| 115 |
|
|
msg |
| 116 |
|
|
Nestled snugly in a sheltered bay at the west of the Imperial Highway, etc |
| 117 |
|
|
endmsg |
| 118 |
|
|
parent world |
| 119 |
|
|
end |
| 120 |
|
|
|
| 121 |
|
|
Here we see a relatively high level region, it has a longname, that is the title of the kingdom |
| 122 |
|
|
It has a description, and a parent. |
| 123 |
|
|
the region is called scorn, and all maps containing the line 'region scorn' will be in this region |
| 124 |
|
|
|
| 125 |
|
|
The msg field (description) is contained within the lines msg and endmsg |
| 126 |
|
|
NB see Known Bugs section about this... |
| 127 |
|
|
|
| 128 |
|
|
The other line that it could have contained was |
| 129 |
|
|
fallback 1 |
| 130 |
|
|
this would've made it the default region for maps with no region set. |
| 131 |
|
|
However Scorn isn't a sensible choice for this. |
| 132 |
|
|
|
| 133 |
|
|
Each entry in the regions file is finished with a line saying |
| 134 |
|
|
end |
| 135 |
|
|
|
| 136 |
|
|
The regions file stops being parsed when a line saying |
| 137 |
|
|
nomore |
| 138 |
|
|
|
| 139 |
|
|
is encountered. |
| 140 |
|
|
|
| 141 |
|
|
*****Functions exposed and purpose thereof***** |
| 142 |
|
|
|
| 143 |
|
|
The following functions are currently accessible, this list is still fluid, expect it to change. |
| 144 |
|
|
|
| 145 |
|
|
Note, I am describing the functions' specification, what they should be doing, look at the |
| 146 |
|
|
source code to see what they /are/ doing.... |
| 147 |
|
|
|
| 148 |
|
|
extern char *get_region_longname(region *r); |
| 149 |
|
|
returns the longname that the region should use |
| 150 |
|
|
|
| 151 |
|
|
extern char *get_region_msg(region *r); |
| 152 |
|
|
returns the description of the region. |
| 153 |
|
|
|
| 154 |
|
|
extern region *get_region_by_name(char *region_name); |
| 155 |
|
|
given a name returns the region with that name, or the fallback if there isn't one. |
| 156 |
|
|
Used by the map loader and stuff using get_name_of_region_for_map at the moment. |
| 157 |
|
|
|
| 158 |
|
|
extern int region_is_child_of_region(region *child, region *r); |
| 159 |
|
|
1 if the child is a subregion of r |
| 160 |
|
|
0 otherwise |
| 161 |
|
|
|
| 162 |
|
|
extern region *get_region_from_string(char *name); |
| 163 |
|
|
tries to guess which region 'name' corresponds to |
| 164 |
|
|
|
| 165 |
|
|
extern region *get_region_by_map(mapstruct *m); |
| 166 |
|
|
takes a map returns the region it is in. |
| 167 |
|
|
|
| 168 |
|
|
extern char *get_name_of_region_for_map(mapstruct *m); |
| 169 |
|
|
takes a map and returns the name of the region it is in. |
| 170 |
|
|
|
| 171 |
|
|
extern void parse_regions(); |
| 172 |
|
|
used to load the values for the regions at startup |
| 173 |
|
|
called by init regions, may end up being called during runtime if region updating is added. |
| 174 |
|
|
|
| 175 |
|
|
extern void init_regions(); |
| 176 |
|
|
calls parse regions, performs some checks beforehand. |
| 177 |
|
|
called by the startup code. |
| 178 |
|
|
|
| 179 |
|
|
extern region *get_region_struct(); |
| 180 |
|
|
calloc's a new region struct and blanks it for use |
| 181 |
|
|
shouldn't really be used externally yet (maybe later though) |
| 182 |
|
|
|
| 183 |
|
|
extern void assign_region_parents(); |
| 184 |
|
|
called after parse regions, makes the child regions find their parents. |
| 185 |
|
|
shouldn't be called externally yet (maybe later though) |
| 186 |
|
|
|
| 187 |
|
|
*****Player visible changes***** |
| 188 |
|
|
|
| 189 |
|
|
The command mapinfo now returns the region name (not longname, but what is included in the map file) |
| 190 |
|
|
|
| 191 |
|
|
There is a command whereami that prints the regions name and description. |
| 192 |
|
|
|
| 193 |
|
|
There is a command whereabouts that shows region names and the number of players there. |
| 194 |
|
|
|
| 195 |
|
|
who can be given regions as arguments, and only show the players in that region. |
| 196 |
|
|
|
| 197 |
|
|
*****Known/suspected bugs***** |
| 198 |
|
|
|
| 199 |
|
|
Random maps probably don't get their regions set properly (though I am not quite sure what |
| 200 |
|
|
'properly' should be here). |
| 201 |
|
|
|
| 202 |
|
|
The region parser is not particularly robust, it dies if the 'endmsg' line is missing, |
| 203 |
|
|
or if 'nomore' is missing, or if the 'end' line is missing. These stop the server from |
| 204 |
|
|
starting, if it starts, it should be fine afterwards. |
| 205 |
|
|
|
| 206 |
|
|
*****Future plans***** |
| 207 |
|
|
|
| 208 |
|
|
medium term: |
| 209 |
|
|
|
| 210 |
|
|
Have the regions file 'compiled' in the same way the archetypes are. |
| 211 |
|
|
|
| 212 |
|
|
Limit word of recall's range based upon region, add a default savebed to each region, |
| 213 |
|
|
and store in the player the savebeds for each region. |
| 214 |
|
|
|
| 215 |
|
|
add a 'capabilities' field to the region, defining what the region can do. eg, |
| 216 |
|
|
limits_word_of_recall, if set then casting Word of recall takes to the savebed for |
| 217 |
|
|
that region, otherwise for the parent region. |
| 218 |
|
|
|
| 219 |
|
|
Long term: |
| 220 |
|
|
|
| 221 |
|
|
All sorts of other things, regional leaders, governments, economies, justice systems, |
| 222 |
|
|
wars, import restrictions, citizenship, etc, etc |
| 223 |
|
|
|
| 224 |
|
|
Look on CFMB for some of the things that have been suggested. |