Difference between revisions of "Dungeon Building"

From IvanWiki
Jump to navigation Jump to search
Line 115: Line 115:
 
| <code>BackGroundType</code>
 
| <code>BackGroundType</code>
 
| <code>m;</code>
 
| <code>m;</code>
| Defines the default background type. Not sure what it precisely affects. m can be <code>GRAY_FRACTAL</code>, <code>RED_FRACTAL</code>, <code>GREEN_FRACTAL</code> etcetera
+
| Defines the default background type. Not sure what it precisely affects. m can be <code>GRAY_FRACTAL</code>, <code>RED_FRACTAL</code>, <code>GREEN_FRACTAL</code> etcetera.
 +
|-
 +
| <code>EarthquakesAffectTunnels</code>
 +
| <code>true</code> or <code>false</code>
 +
| Tells the game whether an earthquake on the level can rearrange the layout of tunnels. Open levels will crash if this is not set to false (because there are no tunnels to shift). Set to true if the level has tunnels, set to false if it is open. See also <code>IsOnGround</code>.
 +
|-
 +
| <code>IsOnGround</code>
 +
| <code>true</code> or <code>false</code>
 +
| Tells the game whether the level is above ground. This prevents earthquakes from happening on the level. Silva will summon wolves instead.
 +
|-
 +
| <code>IgnoreDefaultSpecialSquares</code>
 +
| <code>true</code> or <code>false</code>
 +
| If specific squares containing items/traps etc are specified in LevelDefault, then setting this to true for a particular level will cause these random squares not to appear. Accordingly, in LevelDefault this should be set to false.
 
|}
 
|}
  

Revision as of 01:17, 1 May 2016

Introduction

Welcome

Welcome to the world of IVAN dungeon building. It is a part of game development that is as interesting and intricate as the game itself. Designing and building a dungeon for IVAN presents many challenges and it can feel like a steep learning curve, however, the satisfaction of creating a world in which many enthusiastic IVANers can play in and feel part of is very rewarding. This guide is aimed at those with little or no coding skills, but who are comfortably computer literate. Those who are already familiar with C++ (or any other language) will be advantaged by their programming experience, and will hopefully find the collection of examples on dungeon building suitably novel and interesting.

What we will look at

Tools

A suitable text editor and font

When editing the dungeon file, it pays to have a good text editor. A nice program in Windows might be, for example, Programmer’s Notepad 2, but any program with suitable syntax highlighting will do. The script file text is based on C/C++ syntax, so you can set the syntax highlighting to this language. It is also highly prudent to select a mono-space typeface. A mono-space typeface means each character has the same horizontal length in the editor. Because we are also going to “draw” with ASCII characters in the script files, it would be good if the characters can properly align in a grid-like fashion, making it easy to identify the geometrical patterns. This is indispensable when it comes to laying out large rooms and even particular dungeons, helping to avoid confusion along the way. Suitable typefaces to consider for this purpose might include Courier New or Lucida Console fonts.

Backing up your work

This is really the most important step, and should be the first thing you organize. Make a copy of your dungeon file and store the copy somewhere else, that way, you can always revert to the original if you make changes all over the place. No matter if you lose original files, you can usually pick up an old file from a repository somewhere and revert back to it.

A more guru way to do this, would be to set up your own IVAN development branch, by cloning the attnam/ivan git repository and making changes in your own branch. You can make pull requests to merge you work into the main line of IVAN development! By using a version control system like GIT, you enable for yourself a great tool for maintaining your dungeon script file.

Philosophy

Order and Chaos

IVAN has the possibility for building both persistently generated content (order) and procedurally generated content (chaos). It is possible to create very rigidly designed places, with every terrain and item having its proper place. The city of Attnam might be considered a highly persistently generated place. Some places are also generated in a way that produces unique dungeon areas - never before visited - with random layout and loot. The Gloomy Caves might be considered such a place. This is only partly true, however, since we can also find things in the Gloomy Caves that can be encountered in each game, like the Gloomy Caves shop or the Enner Beast. We will examine both philosphies in detail, using the Gloomy Caves as an example of a balance between the tools for producing persistent elements and procedural elements in a dungeon.

A first dungeon

Dungeon script hierarchy

The dungeon script file follows a definite structure. However, this may be hard to see since certain keywords can be used over and over again. For example to re-define default values in a certain portion of the script, the keyword RoomDefault might be encountered at the LevelDefault stage or simply the Level stage.

Each dungeon has default parameters specified within LevelDefault and RoomDefault. This is where the general look and feel of the dungeon can be uniformly specified with only a few commands. These defaults can be overridden at any point in the script, within that dungeon.

Each level is explicitly catalogued by level number. LevelDefault can be overridden to change the look and feel of just one particular level if desired.

Rooms are described in the Level portion of the script, since rooms are contained on levels in the same way levels are contained in dungeons. Default specs for rooms (RoomDefault) can be overridden. This can either be done within each level, affecting only the specifications for rooms generated on that level, or it may be done on a per-room basis. Rooms can be rigidly specified, with special "script maps" GTerrainMap, OTerrainMap, ItemMap and CharacterMap listed, showing which types to be generated.

Squares can be defined within rooms, or within a level somewhere. On a square may be placed any amount of items, or a particular ground-terrain or over-terrain, such as stairs or a fountain.

Each room and square can be made to appear randomly within a level, in a random position, and/or within a random sub-area of a level (handled by BoundedRandom), and/or on a random member of a subset of levels (handled by RandomLevel).

DungeonHierarchies.png

Dungeon default control variables

Dungeon

Keyword Values Description
Dungeon 0, 1, 2, ... , 64 This is the dungeon enumerator variable. Enumerations 0 to 4 are occupied by the original dungeons with predefined variables like ATTNAM or ELPURI_CAVE.
Levels 0, 1, 2, ... This determines the total number of levels in the dungeon.
Description "string" This is a short name for the dungeon that shows up in the high score list explaining which dungeon the player died in.
ShortDescription "string" This is an even shorter name for the dungeon usually limited to two or three characters, for example "GC" for gloomy caves. It shows up on the side bar.

LevelDefault

Keyword Values Description
Size x, y; This is the size of the level in squares. x and y are the horizontal and vertical size respectively with x, y ∈ {1, 2, 3, ... }.
Rooms n; or p:q; Total number of rooms possible on the level. Can be a fixed number, n, or a number of generic rooms between p and q with p < q. n, p and q ∈ {0, 1, 2, 3, ... }.
Items n; or p:q; Total number of items that will generate on the level. Can be a fixed number, n, or a random number of items between p and q with p < q. n, p and q ∈ {0, 1, 2, 3, ... }.
TunnelSquare solidterrain(FLOOR_TYPE), 0; TunnelSquare determines the appearance of the tunnel floor. First parameter determines the floor appearance, second parameter should be zero.
FLOOR_TYPE Choose from PARQUET, FLOOR, GROUND, GRASS_TERRAIN etcetera
0; To make a tunnel, this ought to remain zero. Non-zero will cause the tunnel to fill with material!
FillSquare solidterrain(FLOOR_TYPE), MATERIAL earth FillSquare determines what to fill the level's walls and filling material with, and what type of ground appears under those walls. First parameter determines the floor, second parameter determines the walls.
FLOOR_TYPE Choose from PARQUET, FLOOR, GROUND, GRASS_TERRAIN etcetera. Good to choose from the same type as TunnelSquare.
MATERIAL Choose from GRAVEL, MORAINE, GOLD etcetera
BackGroundType m; Defines the default background type. Not sure what it precisely affects. m can be GRAY_FRACTAL, RED_FRACTAL, GREEN_FRACTAL etcetera.
EarthquakesAffectTunnels true or false Tells the game whether an earthquake on the level can rearrange the layout of tunnels. Open levels will crash if this is not set to false (because there are no tunnels to shift). Set to true if the level has tunnels, set to false if it is open. See also IsOnGround.
IsOnGround true or false Tells the game whether the level is above ground. This prevents earthquakes from happening on the level. Silva will summon wolves instead.
IgnoreDefaultSpecialSquares true or false If specific squares containing items/traps etc are specified in LevelDefault, then setting this to true for a particular level will cause these random squares not to appear. Accordingly, in LevelDefault this should be set to false.

RoomDefault

Dungeon concrete elements

Level

Room

Square (on level)

Rooms

GTerrainMap

OTerrainMap

ItemMap

CharacterMap

Square (in room)

Dungeon random elements

RandomLevel

Random rooms

Square, BoundedRandom;