Giter Club home page Giter Club logo

room_generator's Introduction

room_generator

Description

room_generator is a service that generates 2D "rooms" in JSON format. This is useful for e.g. procedural roguelike/dungeon games if the rooms are aggregated into a larger level. It is intended for use with level_generator (not yet released).

Depending on request criteria, it may create a rectangle, circle, or ellipse shape. Walls have closed diagonals.

room_generator runs in Google App Engine. You can deploy it to your own application or try it here.

Usage

To generate a room with height 11 and width 7, GET /?h=11&w=7. Try it.

h and w have a minimum size of 3 and default of 3.

The output format is a JSON document describing the room. Each nested list in data represents a row. 0 is floor, 1 is wall.

Example

If a local server is running on port 4949, http://localhost:4949/?h=3&w=4 yields (when pretty-printed):

{
  "data": [
    [1, 1, 1, 1],
    [1, 0, 0, 1],
    [1, 1, 1, 1]
  ],
  "shape": [3, 4],
  "style": "rectangle"
}

Running a local instance

In the room_generator project directory, create and set up the venv environment:

python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt

Using gunicorn:

gunicorn 'room_generator:create_app()'

Using the debug server:

flask --app room_generator run --port 4949

Using waitress:

pip install waitress
waitress-serve --host 127.0.0.1 --port 4949 --call room_generator:create_app

Further Work

  • Add API tests.
  • Permit client to request a room type.
  • Generate other, more interesting room shapes.

room_generator's People

Contributors

ifimust avatar nobrain35t avatar

Watchers

 avatar

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.