A Kotlin-based DSL for text adventures, with a partial replica of the classic Colossal Cave as an example.

Related tags

Kotlin AdventKT
Overview

AdventKT

A Kotlin-based DSL for text adventures, with a partial replica of the classic Colossal Cave as an example.

Background

My main goal was playing with Kotlin to get a feel for what it was like. A text adventure model and DSL were a fun little exercise to do, as well as replicating some of the classic locations, items, and events. However, the game was more of a use case and a test case than a goal in itself. This said, it turned out to be a fairly complete mini-adventure with its own goal and plot.

Locations and item descriptions are generally true to the original, as published by Eric Raymond (see a link below). Some interactions are changed or augmented to try out various engine features, and to keep the world cohesive without replicating it all.

Building and running

Run gradle jar in the project directory to build a jar under build/libs/AdventKT.jar.

Alternatively, open the project directory in IntelliJ (it is a project) and build the AdventKT:jar artifact. This produces out/artifacts/AdventKT_jar/AdventKT.jar.

Run the jar using the advent shell script in the project directory. It runs the jar from the location where the IDE builds it. If using Gradle, edit the path in the script accordingly.

Study pointers for the curious

The game is defined entirely in the ColossalCave class. (Spoiler alert). The class is Kotlin code, but shaped into a DSL. The definition is extensively commented to explain the use of DSL constructs. It's accompanied by global action definitions in ColossalCaveActions.kt

The implementation revolves around four core classes under framework: World, Room, Item, and Action. The DSL expressions in cave.ColossalCave ultimately create a particular structure of those classes and their subclasses.

The world definition DSL as seen in the ColossalCave class is defined by a set of methods in World and Room, and to a lesser degree, the Item class.

Contact

My email is <first name> dot <last name> at gmail dot com.

Links of interest

Open Adventure, the original Colossal Cave version 2.5

Photos of the real world cave

You might also like...
Nice and simple DSL for Espresso in Kotlin
Nice and simple DSL for Espresso in Kotlin

Kakao Nice and simple DSL for Espresso in Kotlin Introduction At Agoda, we have more than 1000 automated tests to ensure our application's quality and

DSL for constructing the drawables in Kotlin instead of in XML

Android Drawable Kotlin DSL DSL for constructing the drawables in Kotlin instead of in XML Examples Shape drawables ?xml version="1.0" encoding="utf-

Lightweight Kotlin DSL dependency injection library
Lightweight Kotlin DSL dependency injection library

Warehouse DSL Warehouse is a lightweight Kotlin DSL dependency injection library this library has an extremely faster learning curve and more human fr

Code generation of Kotlin DSL for AWS CDK

Code generation of Kotlin DSL for AWS CDK

Regular expression DSL on Kotlin

Examples Characters Construct Equivalent Matches x character(Char) The character x \\ character('\\') The backslash character \0n octal(OctalValue(7))

Kotlin Object Notation - Lightweight DSL to build fluid JSON trees

Kotlin Object Notation Lightweight kotlin MPP DSL for building JSON trees Setup Just drop the dependency in your commonMain sourceSet kotlin { sourc

Kotlin parser library with an easy-to-use DSL
Kotlin parser library with an easy-to-use DSL

Pratt Library for parsing expressions and a beautiful Kotlin DSL Just define your operators and operands with the Kotlin DSL and the parser is ready!

Kotlin DSL for Junit5

Kupiter is Kotlin DSL for Junit5. Current API is only for dynamic tests. Get it repositories { maven { url 'https://jitpack.io' } } dependencies

Kotlin-dsl-sample - Preferences project on android

kotlin-dsl-example Sample preferences project on android. How to use val

Owner
Vassili Bykov
Vassili Bykov
Speech-Text Converter is a simple task that enable the user to convert the speech to text or convert text to speech (by Mic)

Speech-Text Converter About Speech-Text Converter is a simple task that enable the user to convert the speech to text or convert text to speech (by Mi

Kareem Saeed 1 Oct 21, 2021
AbstractMvp 0.8 0.0 Kotlin is a library that provides abstract components for MVP architecture realization, with problems solutions that are exist in classic MVP.

MinSDK 14+ AbstractMvp AbstractMvp is a library that provides abstract components for MVP architecture realization, with problems solutions that are e

Robert 12 Apr 5, 2022
A Mindustry mod adding turrets from older versions of Mindustry, specifically Mindustry Classic

Mindustry Kotlin Mod Template A Kotlin Mindustry mod that works on Android and PC. This is equivalent to the Java version, except in Kotlin. Building

null 4 Sep 3, 2022
Example of migrating from Dagger to Hilt with a real service/repository example

DaggerToHilt Overview This repo provides a real example of using Hilt for dependency injection. It hits endpoints provided by the Movie Database, and

null 0 Nov 29, 2021
Android + Kotlin + Github Actions + ktlint + Detekt + Gradle Kotlin DSL + buildSrc = ❤️

kotlin-android-template ?? A simple Github template that lets you create an Android/Kotlin project and be up and running in a few seconds. This templa

Nicola Corti 1.5k Jan 3, 2023
This repository contains the article describing my attempt to implement a simple state reducer based on Kotlin Flow and an example app that uses it.

This repository contains the article describing my attempt to implement a simple state reducer based on Kotlin Flow and an example app that uses it.

Maciej Sady 18 Dec 29, 2022
A Kotlin DSL wrapper around the mikepenz/MaterialDrawer library.

MaterialDrawerKt Create navigation drawers in your Activities and Fragments without having to write any XML, in pure Kotlin code, with access to all t

Márton Braun 517 Nov 19, 2022
{ } Declarative Kotlin DSL for choreographing Android transitions

Transition X Kotlin DSL for choreographing Android Transitions TransitionManager makes it easy to animate simple changes to layout without needing to

Arunkumar 520 Dec 16, 2022
Kotlin Dsl for Android RecyclerView

KRecyclerDsl Kotlin Dsl for Android RecyclerView Exemple Sample project recyclerView.adapter = dataClassAdapter<MyView, MyDataClass>(R.layout.my_view,

Thomas Girard 14 Mar 31, 2019
The most complete and powerful data-binding library and persistence infra for Kotlin 1.3, Android & Splitties Views DSL, JavaFX & TornadoFX, JSON, JDBC & SQLite, SharedPreferences.

Lychee (ex. reactive-properties) Lychee is a library to rule all the data. ToC Approach to declaring data Properties Other data-binding libraries Prop

Mike 112 Dec 9, 2022