Git Product home page Git Product logo

rogueelements's Introduction

RogueElements

Build Status

RogueElements is a C# library that allows the user to randomly generate maps for use in roguelikes. Generation is implemented in a series of interchangeable steps, similar to shader passes. These steps all share a base class, which the user can inherit to make their own steps. Additionally, RogueElements contains a collection of functions designed to make working with 4-directional and 8-directional tile maps more convenient.

There exist a large base of unit tests that serve to cover the basic functions of the library.

RogueElements does NOT provide a base engine for the gameplay of an actual roguelike; that's for the game developers themselves to decide on. A map generation context specified by the developer is all that is needed to integrate the library with their game. It will inherit all interfaces that the developer is interested in to allow the correct steps to apply to it.

The presence of diagnostic methods also makes it easy to set breakpoints and view the entire map state at a given time:

Overview

The library revolves around 3 major classes: MapGen, GenStep, and IGenContext.

IGenContext is an interface that represents the map you wish to generate. Implement it with your own user-defined MapGenContext class so that it can be passed into RogueElements's other classes. Other interfaces in RogueElements inherit from IGenContext, and specify more features that RogueElements will be allowed to interact with. For example, implementing ITiledGenContext indicates that your MapGenContext class has tiles that can be get and set.

GenStep is a class with a single Apply function, which will perform an operation on any IGenContext passed in (specified by its class parameter). Many GenSteps have constraints on what kind of IGenContext they will accept. For example, PerlinWaterStep will randomly generate user-specified water terrain on the map using Perlin Noise, but it only allows classes implementing ITiledGenContext as its parameter.

MapGen is the class that generates the map. Add GenSteps to the GenSteps list, then call the method GenMap() to output a MapGenContext.

The flow of map generation resembles a shader pipeline:

An example map generation pipeline. The GenSteps can be swapped in and out.

  • InitFloorPlanStep<MapGenContext>: Initializes a list of rooms (A FloorPlan).
  • FloorPathBranch<MapGenContext>: Creates the shape of the path of rooms in the grid as a minimum spanning tree.
  • ConnectRoomStep<MapGenContext>: Randomly connects adjacent rooms in the FloorPlan.
  • DrawFloorToTileStep<MapGenContext>: Draws the list of freehand rooms onto the actual map tiles.
  • FloorStairsStep<MapGenContext, StairsUp, StairsDown>: For adding an up and down stairs to your map. You must provide the StairsUp and StairsDown classes.
  • PerlinWaterStep<MapGenContext>: For generating water patterns on your map using Perlin Noise.
  • RandomSpawnStep<MapGenContext, Item>: For distributing items across the floor in a random pattern. You must provide the Item class.
  • RandomSpawnStep<MapGenContext, Mob>: For distributing items across the floor in a random pattern. You must provide the Mob class.

RogueElements.Examples contains examples of how to set up a MapGen. Each example builds on the previous one.

Credits

  • Brogue: A major inspiration in itemizing steps to generate dungeon maps.
  • Spike Chunsoft Mystery Dungeon Series - Several floor layouts used as a reference for grid-based floor steps.
  • RogueSharp - A C# library dedicated to creating a full roguelike, used as an example for integrating RogueElements.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.