Hugo
- Hugo is also a nickname of Kent Tessman.
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.
The latest stable release is 3.1.03 / January 5, 2006.
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.
Links
- Hugo's homepage
- Hugo Programming Manual PDF
- Unofficial Hugo discussion forum
- Hugo By Example is a wiki about Hugo, hosted by Royce Odle a.k.a. "Gerynar".
- Hugo programming language at Wikipedia.
- Hugor, a new interpreter for Windows, Linux and OS-X.