antisplice: An engine for text-based dungeons.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

An engine for text-based dungeons. See the README for a guide on how to use it.


[Skip to Readme]

Properties

Versions 0.7.0.0, 0.7.2.0, 0.8.0.1, 0.11.0.3, 0.11.0.4, 0.12.0.0, 0.12.1.0, 0.12.3.0, 0.13.0.1, 0.13.1.0, 0.13.2.0, 0.13.2.2, 0.14.0.0, 0.14.0.3, 0.15.0.1, 0.16.0.1, 0.17.0.0, 0.17.0.2, 0.17.0.3, 0.17.1.0, 0.17.1.1, 0.17.2.0
Change log CHANGELOG.md
Dependencies base (>=4.13 && <4.15), chatty (>=0.7 && <0.8.0.0), chatty-utils (>=0.7), haskeline (>=0.7), mtl (>=2.1), template-haskell (>=2.8), text, time (>=1.4), transformers [details]
License AGPL-3.0-only
Author Enum Cohrs
Maintainer darcs@enumeration.eu
Category Game
Uploaded by implementation at 2021-01-11T17:46:36Z

Modules

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for antisplice-0.17.2.0

[back to package description]

Antisplice

Antisplice is an engine for text-based dungeons. The world is modeled in rooms and characters can move through it using text commands. In theory, both single-user and multi-user dungeons are supported, but to my knowledge, no multi-user dungeons are using it.

For inspiration and examples, it might be a good idea to have a look at Ironforge.

Game design

Rooms

The world is organized in rooms. Rooms are connected by paths, which can be uni- or bidirectional. In total, they form a graph. Paths that are associated with cardinal directions (or "up" or "down") are called "exits", but not all paths are exits. Other paths can be taken by entering an object, or casting a spell. Exits can be guarded by gates, i.e. they open as soon as a requirement is fulfilled.

Stereos

A stereo is a set of traits that may be attached to a player, object or room. It may:

Stereos may be attached to:

Skills and recipes

Dungeon construction

Dungeon monads

Input masks

Input masks are heterogenous lists that describe the syntax of commands, skills, recipes, etc, in a type-safe way.

The following reads as "whenever the command line only consists of the verb 'quit', throw QuitError":

Verb "quit" :-: Nil #->> throwError QuitError

On the left of the #->> operator, there is a mask describing that the input line only consists of the verb "quit". On the right, there is a Handler. Together, they form a Consumer.

Input masks can also pass parameters to the handler, for example by matching against available objects.

Verb "enter" :-: AvailableObject :-: Nil #-> \o -> objectTriggerOnEnterOf o

Whenever you pass an argument from the mask to the handler, you use the #-> operator. #->> is like #->, in cases where there is no argument to pass. The "quit" example could have also been written like this:

Verb "quit" :-: Nil #-> \() -> throwError QuitError

In a similar style as input masks, there are also preprocessing masks, that may modify your parsed arguments before passing them to the handler.

Verb "drop" :-: CarriedObject :-: Nil #- objectIdOf :-: Nil &-> dropObject

In the above case, CarriedObject matches against an object from the player's inventory and returns the ObjectState. But because dropObject only expects an id, we use objectIdOf as a postprocessing mask. In this case, it is equivalent to the following:

Verb "drop" :-: CarriedObject :-: Nil #-> dropObject . objectIdOf

In case we already use post-processing masks, we can also add a predicate mask. The following example makes sure you can only acquire objects that are actually acquirable.

Verb "acquire" :-: SeenObject :-: Nil #- objectIdOf :-: Nil &-> acquireObject +? Acquirable :-: Nil

Finally, there are also combined post-processing and predicate masks, built on Either:

Verb "go" :-: CatchFixe :-: Nil
              #- (\case
                    "north" -> Right North
                    "south" -> Right South
                    "east" -> Right East
                    "west" -> Right West
                    "northeast" -> Right NorthEast
                    "northwest" -> Right NorthWest
                    "southeast" -> Right SouthEast
                    "southwest" -> Right SouthWest
                    "up" -> Right Up
                    "down" -> Right Down
                    s -> Left $ Unint 0 ("\""++s++"\" is not a direction.")) :-: Nil &?-> changeRoom

Here's an overview of those weird arrow operators:

input_mask #-> \args -> handler
input_mask #->> handler
input_mask #- postproc_mask &-> \args -> handler
input_mask #- postproc_mask &-> (\args -> handler) +? predicate_mask
input_mask #- combi_mask &?-> \args -> handler

Types of invokables

There are quite many types in this library that represent something invokable. This can be confusing, but in fact most of them are only used internally, and not to be meant directly. There are also typeclasses like IsConsumer and Extensible that automatically convert the types in the right way.

You should know Handler, Prerequisite, Action and Consumer though.