Giter Club home page Giter Club logo

hex-describe's Introduction

Hex Describe

This application takes a map generated by Text Mapper and a set of random tables to generate a textual description of the region. It's ideal if your players are wandering into unprepared regions, and it's great if you need some seed material to base your work on.

You can provide your own random tables if you have the file online somewhere in a Pastebin or shared it from Dropbox, etc.

The format is simple: every word in the map description and every two word combo from the map description is a potential table in your file. If it exists, it will be used.

Assuming the following description:

0101 dark-green trees village

The description will be generated from any tables that match:

  • dark-green
  • trees
  • village

It would make sense to just provide tables for "trees" and "village", for example.

Tables looks like this:

;trees
1,some trees
1,you encounter [forest monster]

;forest monster
3,[3d6] bandits
1,an elf

A semicolon and some text begin a new table. A number, a comma, and some text are an entry in the table. The text needs to be on one line. The numbers are relative probabilities. The chances for an encounter in the forest are thus 50% and the chances to encounter an elf, if you are encountering anything at all, are 25%. The example also shows how you can link from one table to another using square brackets.

Square brackets are also used for dice rolls. A dice roll can look like this: 3d6, 3d6+5 3d6x10, or 3d6x10+5.

There's an built-in help page with more details for end users. If you intend to host the application yourself, use perldoc hex-describe.pl to get a more technical documentation based on the comments in the code.

Try it.

The app comes with a tutorial built in. See the Help link.

Dependencies

Perl Modules (or Debian modules):

  • Array::Utils or libarray-utils-perl
  • IO::Socket::SSL or libio-socket-ssl-perl
  • LWP::UserAgent or liblwp-useragent-perl
  • List::MoreUtils or liblist-moreutils-perl
  • Modern::Perl or libmodern-perl-perl
  • Mojolicious or libmojolicious-perl
  • Text::Autoformat or libtext-autoformat-perl
  • File::ShareDir or libfile-sharedir-perl
  • File::ShareDir::Install or libfile-sharedir-install-perl

The IO::Socket::SSL dependency means that you’ll need OpenSSL development libraries installed as well: openssl-devel or equivalent, depending on your package manager.

To install from the working directory (which will also install all the dependencies) use cpan or cpanm.

Example:

cpanm .

Installation

Use cpan or cpanm to install Game::HexDescribe.

Using cpan:

cpan Game::HexDescribe

Manual install:

perl Makefile.PL
make
make install

Configuration

In the directory you want to run it from, you may create a config file named hex-describe.conf like the following:

{
  # error, warn, info, or debug
  loglevel => 'debug',
  # undef means stderr, or a file name
  logfile => undef,
  # undef means the default directory, or a directory name
  contrib => 'share',
  # the URL where you run Text Mapper to generate maps (optional)
  text_mapper_url => 'http://localhost:3010',
  # the URL where you run Face Generator to generate faces (optional)
  face_generator_url => 'http://localhost:3020',
}

Development

As a developer, morbo makes sure to restart the web app whenever a file changes:

morbo --mode development --listen "http://*:3000" script/hex-describe

Alternatively:

script/hex-describe daemon --mode development --listen "http://*:3000"

hex-describe's People

Contributors

kensanata avatar lurchhund avatar bluetyson avatar phf avatar

Stargazers

joel avatar Antonio Farinetti avatar Florian Rohrweck avatar  avatar Jason Alway avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

hex-describe's Issues

hex-mapping hex-describe.pl meta tag

image

(base) D:\hex-mapping>perl hex-describe.pl get /describe --form map=@map.txt --form load=schroeder | cat > mapschroederdescrie.svg
[2023-02-04 10:45:29.45326] [175488] [debug] [AORn7K9_] GET "/describe"
[2023-02-04 10:45:29.45399] [175488] [debug] [AORn7K9_] Routing to a callback
[2023-02-04 10:45:29.46016] [175488] [debug] parse_table: parsing 841019 characters
[2023-02-04 10:45:29.79874] [175488] [info] Did not find any hex with village name (2001)
[2023-02-04 10:45:29.79919] [175488] [info] Did not find any hex with magic plant (1103)
[2023-02-04 10:45:29.80051] [175488] [info] Did not find any hex with temple power (1708)
[2023-02-04 10:45:29.80124] [175488] [info] Did not find any hex with village name (1404)
[2023-02-04 10:45:29.80315] [175488] [info] Did not find any hex with village name (1703)
[2023-02-04 10:45:29.80404] [175488] [info] Did not find any hex with human patron (1405)
[2023-02-04 10:45:29.80440] [175488] [info] Did not find any hex with village name (1104)
[2023-02-04 10:45:29.80457] [175488] [info] Did not find any hex with village name (0105)
[2023-02-04 10:45:29.80491] [175488] [info] Did not find any hex with village name (0306)
[2023-02-04 10:45:29.80529] [175488] [info] Did not find any hex with magic plant (1707)
[2023-02-04 10:45:29.81846] [175488] [debug] get_post_data: https://campaignwiki.org/text-mapper/render
[2023-02-04 10:45:31.19255] [175488] [debug] [AORn7K9_] Rendering template "description.html.ep" from DATA section
[2023-02-04 10:45:31.19553] [175488] [debug] [AORn7K9_] Rendering template "layouts/default.html.ep" from DATA section
[2023-02-04 10:45:31.19832] [175488] [debug] [AORn7K9_] 200 OK (1.745052s, 0.573/s)

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.