T4 Modules Howto Guide/Zones

From Tales of Maj'Eyal
Revision as of 05:56, 29 May 2013 by 66.225.111.10 (Talk)

Jump to: navigation, search

Zones: Your local adventurer hangouts

Zones are description files for areas. The dungeon is a zone, the ice themed cave is a zone, the overland map is a zone, the town is a zone. They can be relatively simple or complex, and can be interconnected in various ways.

What a zone is to the module writer is a directory in the /data/zones folder with 5 files in it:


File Purpose
zone.lua Zone description file
grids.lua Description of the zone terrain
npcs.lua NPCs that exist in the zone
objects.lua Objects in the zone
traps.lua Traps in the zone


Zone Description: zone.lua

The zone name, as referred to by other files, is the same as the folder name that this file is in.


Variable Effect
name Display name of this zone. May contain punctuation and spacing.
level_scheme If "player", scale zone and NPC levels to match player level, if "fixed", do not scale NPC levels.
level_range If level_scheme is "player", this limits the min and max that NPC levels can scale to.
max_level Depth of a multi-level dungeon
actor_adjust_level See below under "On level_scheme and level_range"
width Width of levels. No effect if static level generated.
height Height of levels. No effect if static level generated.
all_remembered If true, level starts explored.
all_lited If true, level starts lit.
persistant If not set, randomizes the level again every time it is entered. If true it saves one level per file. If "zone" it saves all levels in a zone file. If "memory" it saves the level with the mail savefile.
generator Defines the generators used for this zone, read below.
levels Used to override zone defaults for single levels, such as to add a static boss level at lowest level of zone.


Generator

There are four kinds of generators at the time of writing. You can only select one of each type per zone, though you can override this in the levels variable.


map

  • engine.generator.map.Cavern
    • Generates a caven-like level. Used e.g. for Ardhungol in the tome module.
  • engine.generator.map.Empty
    • makes an empty level
  • engine.generator.map.Forest
    • Generates a forest level with possible ponds of water. Used for the Trollshaws.
  • engine.generator.map.GOL
    • GOL is game of life I should rename it
  • engine.generator.map.Heightmap
    • Heightmap is just a bad experiment;
  • engine.generator.map.Maze
    • Maze makes well, a maze...like in .. the maze ;)
  • engine.generator.map.Roomer
    • Roomer is the standard dungeon builder
  • engine.generator.map.Rooms
    • yeah Rooms is badly named and half working
  • engine.generator.map.Static
    • Loads a map file from the data/maps/ folder. It is used e.g. for towns or special levels (the map is then fixed) or for placing special fixed rooms/structures in a random map (e.g. the last level of Amon-Sûl).
  • engine.generator.map.TileSet
    • TileSet splits the level in tiles of 3x3, 5x5, .. (customizable) each with a set of defined tiles possibilities and it randomly places them, matching existing ones. Examples are the ancient elven ruins, the moria, the first level of the lost merchant quest
  • engine.generator.map.Town
    • Generates a random town composed by L-shaped and rectangular buildings. Used e.g. for the Rak'shor Pride.


actor

  • engine.generator.actor.Random

object

  • engine.generator.object.Random

trap

  • engine.generator.trap.Random

Additional file contents

The files grids.lua, npcs.lua, objects.lua and traps.lua are used to load or define the features available in the zone.

At its simplest, a load() call to one of the files defined in the /data/general/ directory is used, but zone special features can also be defined here, such as ice tiles in a ice cave or a boss that appears only in that zone.

The reason for this is so you can have only orcs or trolls appear in your zone, with a forest tileset and only outdoor traps. This is also one of the main reasons for segmenting your definition files.


Static maps

Travelling between zones

Word of DarkGod

On level_scheme and level_range

<> max_level is the "physical" depth
<> and level_range is the range of levels allowed
<> if the scheme is set to "fixed", or not set, then actors will only have their natural level
<> if it is set to "player" then the zone calls game:getPlayer() to get a player, takes its level and uses it to select a level for the zone
<> imagine:
<> if you haev a zone with max_level = 5; level_range={10,20}
<> then if a level 12 player enters, the zone "levels itself" to be level 12 for the first level and then one more per level
<> basically it means that you can have zones that levelup with the player, as to provide a challenge even if the player is not at the exact right level
<> actors are always created as level 1, then they are leveled up to theuir minimun level (their own level_range)
<> then the zone force levelup to the selected level\<dg_> using the
<> actor_adjust_level = function(zone, level, e) return zone.base_level + e:getRankLevelAdjust() + level.level-1 + rng.range(-1,2) end,
<> field of the zone

Go back to T4modules-module-howto-guides