Skip to content

Feature Overview

REMCodes edited this page Dec 28, 2022 · 2 revisions

This page gives a brief overview of the numerous features of ModernRift.

Commands

ModernRift brings a new feature to the heart of RiftEngine: Commands. Similar to writing commands in the terminal or command prompt, ModernRift commands execute Directives when they are executed by the user.

Default Commands

The ModernRift engine comes with an array of default commands for the user to use. Almost all* of these commands can be disabled by the developer.

Here is the list of default commands.

  • quit: Safely stops the ModernRift engine and closes the window.
  • help: Lists the available commands and (optionally) what they do.
  • clear: Clears the console window.

*The only command that cannot be disabled is quit

Directives

ModernRift introduces a new feature into RiftEngine that replaces both Interactions and Events. This new feature is the customizable and modular Directive. Directives are a somewhat abstract concept. They contain a parameter-less lambda with a void return type. You invoke them (or they are invoked) with the Execute() method.

Default Directives

Just like Commands, ModernRift ships with an array of default directives for the developer to use.

Here is the list of default directives.

  • ConsoleDirective: Prints a string to the console, and appends a carriage return (\n), much like Console.WriteLine().
  • InlineConsoleDirective: Prints a string to the console but does not append a carriage return (\n), much like Console.Write().
  • ConsoleFromFileDirective: Prints the contents of a file to the console. Optionally, you can use parameters by putting {0}, {1}, {2}, etc, in the file.
  • QuitDirective: Companion to the QuitCommand; safely shuts down the ModernRift engine.
  • HelpDirective: Companion to the HelpCommand; prints the list of active commands and a short summary to go along with them.
  • ClearDirective: Companion to the ClearCommand; clears the console screen.

Messages

ModernRift also introduces messages, a system that allows directives to be triggered by any commands, other directives, or by the system. A message is simply a string enclosed in a class that is used to broadcast information to all directives, commands, and the system. A message can be created in any function. The companion class for it, MessageHandler, handles the broadcasting of the messages.

The engine will broadcast a message once per command loop that contains update. Any directives in the MessageHandler that have the update trigger will be executed once every time a command finishes, directly after the game's Update() method is called.

Subroutines

ModernRift adds a feature called subroutines. These are classes that have their own Initialize, Start, Update, and End functions. You can think of them as miniature game classes that can be instantiated by directives.

An important difference, however, is that you must override all members of the Subroutine class, whereas you only need to override the members you want to in game classes.

Clone this wiki locally