Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

Customization

Peter Keeler edited this page Jul 26, 2019 · 1 revision

Customizing Your Agony Forge

Colors

Any text that gets sent to the player's browser can have color codes in it. The color codes are square brackets with the name of the color you want, like this: [blue]. You can find the CSS definitions of the colors in src/main/resources/static/css/color.css. You can easily add more colors or change the way the existing ones look by editing that file.

Greeting

Changing the greeting is very easy. The greeting is stored in src/main/resources/greeting.txt. There are comments that describe the simple markup you can use. Change it to say whatever you want, run ./gradlew clean build and start the game back up with docker-compose up and you should see your new greeting.

Login

Text Changes Only

You can change everything about the way logging in and character creation works in The Agony Forge. If you like the overall way it works but you just want to change the text of the questions, you can change that text in src/main/resources/application.yaml.

Code Changes

You can completely change the way the game works by implementing your own InterpreterDelegate classes. When you create a new class that implements one of the sub-interfaces of InterpreterDelegate the default one will become inactive (just like in Spring Boot, if you're familiar with that) and your class will replace it.

The DefaultPrimaryInterpreter uses two delegates: a LoginInterpreterDelegate and an InGameInterpreterDelegate. The first is used to manage logins and authentication while the second handles commands within the game. You can replace either one of the delegates if you want to.

The only required methods to write your own InterpreterDelegate are interpret() which accepts a line of input from the player and does something with it, and prompt() which generates a prompt to send to the player.

LoginInterpreterDelegate

The login delegate is a finite state machine that moves new connections along a fixed path to get them logged in. If you write a new LoginInterpreterDelegate make sure to annotate it with @Component and implement the interface. The default one will not be loaded and yours will be used instead.

InGameInterpreterDelegate

The in-game delegate is very simple now, but in the future will be the top layer of a sophisticated command interpreter. If you want to make your own interpreter, just be sure to implement InGameInterpreterDelegate and annotate your class with @Component.