Designing a game using adventure engine - PatrickHoward/adventure-engine GitHub Wiki

Introduction

adventure-engine uses a text file (called a structure file) for the actual design of the game. Upon startup, the program reads the text file and builds up the adventure from there. This page goes through the structure of how a game is designed using the engine. Each section is

Structure

adventure-engine follows the following structure:

  • Information
    • Details such as game name, creator, short description.
  • Rooms
    • Section details the room name and description. Rooms are alternatively known as node.
  • Connections (roomlinks)
    • Details the connections between two rooms and the directions available.
    • Called roomlinks in the structure file.

Back to top

Information

Simply enough, this section assigns variables based on information such as name, creator, description, etc. This section starts with a --information tag and ends with a --end tag. Each variable is separated with a newline, as the program interprets the structure file line by line.

Rooms

Rooms (or nodes) are defined based on the order they are defined (for example, the room defined at the top has a location number of "1", the next room defined has a location number of "2", and so on. The room declarations start with the --rooms tag and ends with the --end tag.

Rooms are defined with the following structure:

["Room Name","Room Description"]

Connections (edges)

Once all the rooms are defined, the program will check to see what connections between two nodes. Connections are defined with a rigid cardinal directions (North, NorthEast, East, SouthEast, South, and so on). Each number identifies the room ID number (that is, the order of rooms generated by the file parser). And follows the same order as the rooms above.

For example, room one is defined as such:

["Room One","A boring room"]

Room one has an ID of 1, and it connects to room two with an ID of 2 to the north, therefore, this line should be the first :

`[2, -1, -1, -1, -1, -1, -1, -1, -1]

Note - -1 means that there is no edge in that direction

Back to top

Sample file

Below is a sample of a structure file I used to define the structure I envisioned for this project.

--information
name: Dungeon of the Damned
author: Patrick M. Howard
version: 0.0.1
--end

--room
["Room 1","Room 1 Desc."]
["Room 2","Room 2 Desc."]
["Room 3","Room 3 Desc."]
["Room 4","Room 4 Desc."]
--end

--edges
[2, -1, -1, -1, -1, -1, -1, -1]
[3, -1, -1, -1, -1, -1, -1, -1]
[4, -1, -1, -1, -1, -1, -1, -1]
[3, 2, -1, -1, -1, -1, -1, -1]
--end

Back to top