by Tdarcos » Sat Nov 02, 2019 7:32 pm
Introduction to the Hugo Interactive Fiction Authoring System
by Paul Robinson
The Hugo Interactive Fiction Authoring System and Programming Language is a system for specifying the commands, and responses to the commands, necessary to construct an Interactive Fiction story, or more specifically, any application which could accept typed in command instructions and provide varying responses to those commands, based upon what the user has typed in before or what has happened within the application previously. It is also possible to develop a graphical style interactive Fiction story, using images and mouse clicks, but, since this is just an introduction to Hugo I'm going to keep things simple in general, and discuss mostly text-based stories.
The Hugo Programming Language is what is called a "domain-specific language." As Wikipedia put it, "A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains." What Hugo is specialized for, is the specifications of commands used to manipulate the character the person running the story is playing, the places that character could visit, and the objects in the various rooms (or within other objects) or carried by the player's character.
While Interactive Fiction is the primary focus of Hugo, it is not the only potential use of the language. Even in text-only mode, the Run-Time System supports multimedia, allowing the playing of sounds, showing of pictures, and even video playback. Another types of applications Hugo could be used to produce, for example, is tp create a model of a building where images of floors could be shown, and also described in prose, where a person moves from room to room and floor to floor, It might be useful in the case of something intended for blind persons as a text-to-speech program could provide descriptions of areas, something not possible with images.
You might ask why you would want to use Hugo to write an Interactive Fiction story as opposed to some of the other Interactive Fiction Authoring Languages. Hugo provides a much easier language to write Interactive Fiction while not sacrificing the richness of features and capacity to write even very complex stories. Its means of specifying commands, objects and routines to process commands are straightforward, and fairly intuitive. Hugo tends to "get in the way" much less than other Interactive Fiction authoring languages that make writing specifications for a story difficult. As mentioned earlier, Interactive Fiction authors with more experience can use Hugo to develop graphical mouse-driven stories.
As was stated earlier, Hugo is a domain-specific language, it is designed to handle certain types of applications. You would not want to use Hugo to write a payroll program (for one thing, it has no database functions), but for what it is designed to do, it does very well. In a program written using the Hugo languagr, it is necessary to specify all of the potential commands the user could type in, the routines to handle those commands, the places that exist within the stiry, and the objects that are found there.
Now you do not have to do everything, the standard Hugo library has predefined objects which define things like rooms, properties of objects (characteristics such as whether the object is movable, enterable, can be picked up, or, (in the case of a room) either lit or dark), and variables relating to the object (the object's name, description, where it is located, if it has something inside of it, and for a room, its title, its description, the directions you can travel and what happens if you do.) Hugo also supports the creation of Non-Player Characters (NPCs), other "people" the user of the story can interact with, and NPCs can be a friend, or an enemy, of the player.
The standard library includes a large number of predefined commands to provide "generic" responses to most commands, e.g. "take", "push" or "pull" followed by the name of an object will provide the common expected result of that command applied to that object, or, if the properties of that object do not allow that command, an error message is given. If a particular command works differently for a certain object (e.g. if you are in a bathroom, "take book" would mean something entirely different from "take shower"), then you can either provide a special command or a specific operation for that particular object. Hugo also supports "events" where things can happen after a certain number of commands are issued, e.g. walking more than 5 moves in a pitch-black room or rooms causes the player character to break a leg, fall into a pit, etc.
Like many other programming languages, Hugo has certain structure requirements. First, you define any commands (or include the standard library and add additional commands as needed) which tell what routine (what Hugo calls a procedure) will handle each of those commands. Next, you define the various rooms and objects (or additional ones added to those in the standard library), and declare the routines to handle the new commands. Next, you declare the initialization routine that sets up anything necessary to be done at the start of the game, then you define the "main loop" which is run once each turn.
Hugo supports inline inclusion of source files, so stories can be broken up logically, so commands may be defined in one file, rooms defined in another (or a group of related rooms), scenery (objects that are merely descriptive but can't be interacted with), objects the user will interact with, and routines to process commands can all be in separate files.
At any point in the development of a story, that you feel it is at least somewhat playable (in order to test it) you can save the current story files (Hugo source code is simply several text files, and any text editor that produces plain ASCII files can be used to edit them), then "compile" the source using the Hugo Compiler If there are no syntax errors, the output of the compiler (a file with a name ending in .hex) can be passed to the Hugo Run-Time System for execution. Then you can return to editing the appropriate files to fix errors or add more details and/or features to the story.
Hugo comes with the compiler, run-time system, source to the run-time library, a sample template stub for designing a story, a sample game, a reference manual, and (not required to create Interactive Fiction stories) sources in C to the compiler and run time system.
Licensing for the system is clear. It is given away for free from several places including
https://www.ifarchive.org/if-archive/programming/hugo/ Redistribution of source for free is permitted; redistribution for profit is not permitted. Redistribution of the Run-Time System binary to permit a user to run a story and with necessary multimedia files, if any, for free or for profit is permitted.
There are additional third-party options to replace the standard support files for Hugo programs to provide improved functionality. A user with the handle Roody Yogurt has released a replacement for the standard library which is called Roodylib and provides improved features. A user named RealNC has created a replacement for the Hugo Run Time System called HugoR which provides 32-bit and 64-bit support for Windows and Linux.
Hugo provides an excellent language for the development of Interactive Fiction, with a gradual learning curve for new users while providing even advanced features for experienced users. If you are considering developing an Interactive Fiction story, Hugo just might be the better choice over other alternatives!
Introduction to the Hugo Interactive Fiction Authoring System
by Paul Robinson
The Hugo Interactive Fiction Authoring System and Programming Language is a system for specifying the commands, and responses to the commands, necessary to construct an Interactive Fiction story, or more specifically, any application which could accept typed in command instructions and provide varying responses to those commands, based upon what the user has typed in before or what has happened within the application previously. It is also possible to develop a graphical style interactive Fiction story, using images and mouse clicks, but, since this is just an introduction to Hugo I'm going to keep things simple in general, and discuss mostly text-based stories.
The Hugo Programming Language is what is called a "domain-specific language." As Wikipedia put it, "A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains." What Hugo is specialized for, is the specifications of commands used to manipulate the character the person running the story is playing, the places that character could visit, and the objects in the various rooms (or within other objects) or carried by the player's character.
While Interactive Fiction is the primary focus of Hugo, it is not the only potential use of the language. Even in text-only mode, the Run-Time System supports multimedia, allowing the playing of sounds, showing of pictures, and even video playback. Another types of applications Hugo could be used to produce, for example, is tp create a model of a building where images of floors could be shown, and also described in prose, where a person moves from room to room and floor to floor, It might be useful in the case of something intended for blind persons as a text-to-speech program could provide descriptions of areas, something not possible with images.
You might ask why you would want to use Hugo to write an Interactive Fiction story as opposed to some of the other Interactive Fiction Authoring Languages. Hugo provides a much easier language to write Interactive Fiction while not sacrificing the richness of features and capacity to write even very complex stories. Its means of specifying commands, objects and routines to process commands are straightforward, and fairly intuitive. Hugo tends to "get in the way" much less than other Interactive Fiction authoring languages that make writing specifications for a story difficult. As mentioned earlier, Interactive Fiction authors with more experience can use Hugo to develop graphical mouse-driven stories.
As was stated earlier, Hugo is a domain-specific language, it is designed to handle certain types of applications. You would not want to use Hugo to write a payroll program (for one thing, it has no database functions), but for what it is designed to do, it does very well. In a program written using the Hugo languagr, it is necessary to specify all of the potential commands the user could type in, the routines to handle those commands, the places that exist within the stiry, and the objects that are found there.
Now you do not have to do everything, the standard Hugo library has predefined objects which define things like rooms, properties of objects (characteristics such as whether the object is movable, enterable, can be picked up, or, (in the case of a room) either lit or dark), and variables relating to the object (the object's name, description, where it is located, if it has something inside of it, and for a room, its title, its description, the directions you can travel and what happens if you do.) Hugo also supports the creation of Non-Player Characters (NPCs), other "people" the user of the story can interact with, and NPCs can be a friend, or an enemy, of the player.
The standard library includes a large number of predefined commands to provide "generic" responses to most commands, e.g. "take", "push" or "pull" followed by the name of an object will provide the common expected result of that command applied to that object, or, if the properties of that object do not allow that command, an error message is given. If a particular command works differently for a certain object (e.g. if you are in a bathroom, "take book" would mean something entirely different from "take shower"), then you can either provide a special command or a specific operation for that particular object. Hugo also supports "events" where things can happen after a certain number of commands are issued, e.g. walking more than 5 moves in a pitch-black room or rooms causes the player character to break a leg, fall into a pit, etc.
Like many other programming languages, Hugo has certain structure requirements. First, you define any commands (or include the standard library and add additional commands as needed) which tell what routine (what Hugo calls a procedure) will handle each of those commands. Next, you define the various rooms and objects (or additional ones added to those in the standard library), and declare the routines to handle the new commands. Next, you declare the initialization routine that sets up anything necessary to be done at the start of the game, then you define the "main loop" which is run once each turn.
Hugo supports inline inclusion of source files, so stories can be broken up logically, so commands may be defined in one file, rooms defined in another (or a group of related rooms), scenery (objects that are merely descriptive but can't be interacted with), objects the user will interact with, and routines to process commands can all be in separate files.
At any point in the development of a story, that you feel it is at least somewhat playable (in order to test it) you can save the current story files (Hugo source code is simply several text files, and any text editor that produces plain ASCII files can be used to edit them), then "compile" the source using the Hugo Compiler If there are no syntax errors, the output of the compiler (a file with a name ending in .hex) can be passed to the Hugo Run-Time System for execution. Then you can return to editing the appropriate files to fix errors or add more details and/or features to the story.
Hugo comes with the compiler, run-time system, source to the run-time library, a sample template stub for designing a story, a sample game, a reference manual, and (not required to create Interactive Fiction stories) sources in C to the compiler and run time system.
Licensing for the system is clear. It is given away for free from several places including https://www.ifarchive.org/if-archive/programming/hugo/ Redistribution of source for free is permitted; redistribution for profit is not permitted. Redistribution of the Run-Time System binary to permit a user to run a story and with necessary multimedia files, if any, for free or for profit is permitted.
There are additional third-party options to replace the standard support files for Hugo programs to provide improved functionality. A user with the handle Roody Yogurt has released a replacement for the standard library which is called Roodylib and provides improved features. A user named RealNC has created a replacement for the Hugo Run Time System called HugoR which provides 32-bit and 64-bit support for Windows and Linux.
Hugo provides an excellent language for the development of Interactive Fiction, with a gradual learning curve for new users while providing even advanced features for experienced users. If you are considering developing an Interactive Fiction story, Hugo just might be the better choice over other alternatives!