Hugo

From IFWiki

Hugo
Interpreter, Authoring system
[[File:|385px|center]]
Links Home page Play online
Developer Kent Tessman
Format Hugo
Interaction style Parser
Systems Browser, Windows, macOS, Linux, iOS, Android
System details An online editor is available: see Borogove.
Latest version 3.1.06 / 25 Sep 2021
Status Stable
Uses interpreter
Used byEmglken, Gargoyle, ScummVM, Spatterlight
License BSD-2-Clause
Notes Note that this interpreter cannot simply be downloaded and run to play game files.
Browse the software database
Edit this infobox


Future Boy!, being played in the interpreter Hugor


Hugo is an abbreviation for the Hugo Interactive Fiction Development System, a freeware programming language developed by Kent Tessman for creating IF games. Its structure and style of programming is similar to Inform 6 and TADS 2, making use of both attribute-setting/clearing and class inheritance in defining objects. It inherits Inform's strong "object tree" structure in dealing with manipulation of objects (e.g., when a mug is being sent to the player, this is written as "move mug to you" ['you' being the chosen label for the player character]), as well as TADS's usage of pre-defined object classes (such as 'scenery', 'character' and 'attachable') in further defining object behavior.

Hugo 3.1 offers the following multimedia support : MOD, S3M, MP3, MIDI, XM, WAV for sounds, JPG for images, AVI and MPEG for videos.

Playing Hugo Games

The recommended Windows, Mac OSX and Linux interpreter for playing Hugo games is the Hugor interpreter, developed and maintained by Nikos Chantziaras.

Hugo games can also be played on-line. The website textadventures.online hosts several Hugo games.

Individual Hugo games can be downloaded from the Interactive Fiction Archive. Hugo games use a .hex extension.

Creating Hugo Games

  • 1. Go to the Hugo Downloads page.
  • 2. Click on the link For Developers .
  • 3. Download the standard Hugo Library listed on the page.
  • 4. (Optional) Download the shell game file to build on.
  • 5. Depending on your operating system, download the Windows compiler (hc.exe) in here or the Mac compiler named hc here or build the Unix compiler. (You can download the compiled Hugo compiler for Unix here). On macOS, you can use Homebrew to install the Hugo compiler, debugger and interpreter by adding the realnc/hugo tap.

Language Construction

The Hugo language is a hybrid of several features to provide a command processing system. The system consists of a verb definition section, a property and attribute definition section, an object definition section, and a code section. One may assign multiple names to the same attribute or property through the alias parameter to an attribute or property.

The language is not case sensitive, although much of the code base in the standard library uses camel case for identifiers. Identifiers must start with a letter, and may contain letters, numbers and underscores. Strings are defined by using a double quote. Where it is necessary to include a double quote in a string, it may be escaped by preceding it with a backslash, i.e. \" . With the exception of quoted strings, lines must be explicitly marked as being continued by having the last character on the line to be a backslash.

The system provides for procedures, called a routine which may optionally return a value. All executable statements must be within a routine, there is no default mode to execute code outside of a routine. Comments may be specified anywhere that white space is acceptable, and are indicated by an exclamation point !. This causes anything remaining on the line from that point to be ignored. A special type of block comment for commenting a large area may be used by having the first two characters on a line begin with the comment !\ and the block comment is closed by the next occurrence of the inverse string \! .

Where a block is needed - a set of related values or a particular piece of executable code - it is indicated by encasing it in the open brace character { and closing it with the }, similar to the same functionality in the C language. As with a number of other programming languages, Hugo borrows from C for a number of features, including escaping some values by preceding them with a backslash, the use of the ++ symbol to increment a variable, and the { and } braces for block begin and block end, as noted earlier. Hugo borrows the use of the print command for displaying variables and the use of the semi-colon ( ; ) from the BASIC programming language to indicate output that is not to be broken by a new line.

There are two mandatory routines, one named init and one named main. Init is run once when the program starts, and as the name implies, initializes anything the system needs to do. After Init ends, the routine main is run on every turn, a turn being used in the sense that each command issued by the player is a new turn. The main routine is used to do the typical housekeeping on each turn. The user is prompted for input, the parser processes the input to translate it into a verb and options to the verb, then determine the routine that processes that verb. The routine then returns a set of responses to the verb and options (if any), and the user is then prompted to type in a command.

The system requests commands and continues to do so until a routine indicates the program is over. Since the system was originally designed for writing of games, the determination of the program being over is typically because either because the player won according to the rules for that game, or because the player lost.

Verbs

In the verb definition section, one begins by defining each command, known as a verb in which the code defines the verb as a quoted string. One then lists, one line at a time, each of the parameters to be used for processing the command issued. For example, if one has a command of seach one would define a verb such as

verb "search"

  *                           DoSearchRoom
  * object                    DoSearchObject
  * "me"                      DoInventory


Where the first parameter means that, if the user running the program types the command search with no options, it runs the routine DoSearch -- as in, search the room. If the user types the command search and names a defined object, the DoSearchObject routine is run with the default object being assigned the value of whatever object the user selected. If the user types the command search followed by the option me then the DoInventory routine is run.

Attributes

Hugo allows for up to 128 different attributes to be defined. Attributes are true/false values that represent conditions of an object. All attributes defined in a program are available to any object. For example, if an attribute of an object was hot or cold, one could define an attribute for one or the other, then use not preceding an attribute to test for the opposite condition. Attributes are defined by the attribute command and the name of the attribute, such as:

attribute wet 
attribute cold 
attribute hard 

One defines an attribute as being possessed by an object by the is command, followed by the name of the attribute. To explicitly state that the attribute is not possessed, one indicated by placing not before the attribute on the is command.


Party Arty, Man of La Munchies by Jonathan Blask. This is the text-only view with the standard presentation of white text on a blue background.

Links

Documentation, Tips, and Examples by Individuals

Interpreters
By format ADRIFTAdvSysAGTAlanGlulxHugoMagnetic ScrollsTADSZ-code
By system BrowserAndroidiOSLinuxmacOSWindows
Browse Recommended interpretersSearch formDrilldown
Other software Authoring systemsUtilities
Authoring systems
By style ParserChoiceParser-choice hybrid
By system BrowserAndroidiOSLinuxmacOSWindows
Browse Stable authoring systemsSearch formDrilldown
Other software InterpretersUtilities