No commit activity in last 3 years
No release in over 3 years
A simple gem that generate square dungeons
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 2.0.2, ~> 2.0
~> 1
~> 2.16
 Project Readme

Build Status Maintainability Test Coverage

Square dungeon gen

This repository contain a library for generating square simple dungeons

Compatibility

Require ruby 2.4.0 or higher.

Usage

Basics


# Create a dungeon for four 1 level players
d=Dungeon.new
d.generate( dungeon_size, party_array )

# Exemple :
d=Dungeon.new
d.generate( 4, [ 1, 1, 1, 1 ] )
# This will not create a dungeon of 4 rooms size, but a dungeon of 4**2*0.3 rooms (rounded up)
# The dungeon constructor accept another parameter wich is the amount of rooms to remove from the dungeon
# This parameter is a number between 0 and 1. By default it is set to 0.3 which mean that it will remove 30% of the rooms.
# The [ 1, 1, 1, 1 ] array mean that the dungeon is designed for four 1 level players.

d=Dungeon.new
d.generate( 4, [ 1, 1, 1, 1 ], 0.5 )
# Will remove 50% of the rooms

# Draw your dungeon
d.draw( 'out/dungeon.jpg' )
# Or only the curren room
d.draw_current_room( 'out/current_room.jpg' )

# You can get the directions available from the current room
d.available_directions
# => [ :left, :right ] # according to your dungeon which is random

# Then you can move the current room by moving in a direction
d.set_next_room( :left )
# Will move the current_room to the left.

Examples


This is an example of the current room :

test picture

This is an example of the full dungeon room :

test picture