Skip to content
Scion Altera edited this page Sep 3, 2023 · 1 revision

Introduction

Menus are an important part of the user interface in a MUD. They are used when users first log in to figure out what character to play, or to build a new character. They can also be used to build rooms, items and creatures in the game, for bulletin boards or in-game mail, or all kinds of other things. Agony Forge provides a simple but powerful menu system that is easy to use with the Question class.

The menu classes don't tie directly into the game engine at all. Their purpose is only to format a bunch of text to be shown to the user and to help keep the menus looking standardized in terms of formatting and colors.

MenuComponent

The MenuComponent interface has only a render() method on it, which tells the component to build the menu and return it as an Output object. The Output will usually be multiple lines, with colors, and could be dynamic based on all kinds of different information the user might need to make a choice.

MenuPane

A MenuPane represents a whole menu with a title, some items, and then a prompt. Calling render() on a MenuPane will call render() in the right order on all of the parts inside it and produce a whole menu for you. Typically you will create a MenuPane, then add a title, the items and dividers it needs, and finally a prompt all inside a Question that has the information needed for the menu.

MenuTitle

A MenuPane can have one MenuTitle that is the top title of the menu. It tells the user what that menu is for, and is decorated by some lines that surround it.

MenuItem

The middle of the menu consists of several MenuItems which have a single letter or number that represents the choice for the user to type in, a name that describes what that option does, and optionally some extra hidden information to help when you have to process the choice.

MenuDivider

A MenuDivider is just a horizontal divider in the menu to visually separate groups of menu items from one another.

MenuPrompt

The MenuPrompt is the question at the bottom of the menu. It's usually something like this:

Please make your selection:

Customization

The built in menu implementations are a fast way to get nice looking menus going for your MUD. You can change the colors by passing different primary and secondary colors into the render() method, but the formatting is all handled for you.

To change the formatting and appearance of your menus beyond just the colors, you can easily implement and use your own MenuComponent implementations.