Skip to content

DRM File Format

Ethan Roderick edited this page Sep 15, 2021 · 2 revisions

Overview

This is a custom plain-text file denoted by the '.drm' filetype extension. The file will contain information for a single room, allowing for easy 'saving' and 'loading' of constructed rooms.

The current proposed syntax is as follows:

# Comments are defined with hash symbol

# Room scale (largest width and height)
# This must match the size of both the texture and entity grids
SCALE:X:Y

# Anchoring points for connecting rooms
# Anchors are defined as X:Y
ANCHOR:X:Y

# Tiles are the textures on the underlying tilemap
TILES {
    DEFINE {
    	# Define a symbol and its corresponding texture
        X:path/to/image.png
        Y:path/to/alternate/image.png
    }
    GRID { 
    # Grid placement of textures
        X X X X
        X X Y X
        X X Y Y
        X X X X
    }
}

# Entities are any entity to spawn
ENTITIES {
    DEFINE {
    	# Can be used to spawn walls
    	# Definition is a symbol, a creator method, additional args
        W:spawnWall:path/to/wall/image.png
        P:spawnPlayer
    }
    GRID {
    # Having surrounding walls is optional
        W W W W
        W P . W
        W . . W
        W W W W
    }
}

Specifics

The new drm format can be broken into three regions of input, which control the way a map can generate. These are the initial room statements, the tile placer, and the entity placer.

Room Statements

This region of the file contains statements that apply to the entire room. The statements which are valid here are:

  • SCALE:X:Y
    • Announces the width and height of the largest row and column, respectively.
    • This is a mandatory field.
  • ANCHOR:X:Y
    • Announces there will be an anchor point at given x, y position.
    • Anchor points are locations at which the given room can be connected to other rooms, also at anchor points.
    • Anchor points are not connected to any particular tile or entity.
    • This is an optional field.

Tile Placement

The syntax for tile placement is two part, starting with defining tiles and corresponding textures, and linking them to a single character symbol; and placing tiles in the room using a grid.

  • DEFINE
    • Define a new tile as a single character symbol, a colon :, and then the path to that tile's texture, relative to the game's assets folder.
  • GRID
    • Placement of tiles occurs by having a series of 'space' separated single characters, in a grid pattern.
    • The grid will account for separating whitespace, and create rooms to the outline of the created grid.
    • This grid is not confined to a single, rectangular shape.

Entity Placement

The syntax for entity placement is two part, starting with defining entities via a single character symbol, and placing said entities in the room using a grid.

  • DEFINE
    • Define a new entity using a series of colon : separated values. These values should be, in order:
      • The symbol defining the entity,
      • The name of the method that will construct said entity, in the corresponding GameArea class, and
      • Any parameters that need to be given to the constructor method.
  • GRID
    • Placement of entities occurs by having a series of 'space' separated single characters, in a grid pattern.
    • This grid and the TILE grid must match in shape.
    • If no entity is needed, a . character can be used.
Clone this wiki locally