LRDL2 – Creating a Roguelike Engine – Part 1 – Design and Tiles

Take me to Part 2!->

Roguelikes are a genre of games based on the classic game Rogue. They usually include random generation, permanent death, and turn-based movement/combat, though there are many more contenders for inclusion here. LRDL2 is a roguelike engine that will run in a console window and allow players to traverse random dungeons looking for loot, talking to characters, and fighting and scavenging for survival.

Choice of Tech: C#. Though it’s built as an ASP.NET Core project (in case heavier Web functionality is needed), it’s currently using only .NET/C# conventions. This choice of ASP.NET Core is primarily motivated by the fact that it leaves room for some Web functionality if development goes that way, though I think plain C#/.NET is already showing some benefits, even relative to its older cousin Java (Console.Clear() is very convenient!).

Design Philosophy: LRDL2 is a roguelike engine designed to give developers a template to use for their own custom roguelikes. In roguelike fashion, the engine is built for games using the console window, though output for other formats that could be more easily plugged into a GUI might be useful down the road as well. The base engine will include basics for creating maps, adding layers, loot, enemies, player control, and a longest-lived/high score table. The engine will be based on “tiles” which are essentially blocks of content that serve as the basic unit of the game’s movement and display. One tile may be a wall, or another, a section of floor. A tile might also contain things, such as a your player, a monster, a fellow traveler, or loot (project README as of this writing).

You can find this project here.

Creating Tiles: Tiles are an abstract class which allow tiles such as FloorTile and WallTile to inherit fields but still retain certain differences in implementation (such as different default values for MySymbol in the derived classes’ default constructors (see below).

public abstract class Tile
{
  public char MySymbol { get; set; }
  public ConsoleColor MyColor { get; set; }
}

public class FloorTile : Tile
{
  public FloorTile()
  {
    MySymbol = '.';
    MyColor = ConsoleColor.DarkGray;
  }
}

public class WallTile : Tile
{
  public WallTile()
  {
    MySymbol = '#';
    MyColor = ConsoleColor.Gray;
  }
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s