Grow is a text-based adventure game which can be modified during play. It was inspired by the article on Page 90 of the January 1980 edition of the magazine Creative Computing.
While this version of the game is backwards compatible with the version described in the original article, it adds several new features to enrich the experience:
- A GUI which displays the text-based game, as well as an optional image and soundtrack for each scene. The game can be played in a text only mode by running it with the
-t
flag. - A drag and drop interface for importing images to scenes.
- A drag and drop interface for exporting and importing adventures, which are stored in ZIP files.
- More commands which allow for easier editing of the adventure.
java -jar Grow.jar
: launches the GUI versionjava -jar Grow.jar -t
: launches the text based version
--grow-root <path to root folder>
: sets the grow root to the specified folder for the current session. Can be used with any of the forms above.--reset-root
deletes the location of the grow root. When you run grow again, it will pick a new root. Must be used alone.--set-root <path to root folder>
: sets the grow root to the specified folder. The folder will be made if it does not exist. Must be used alone.--help
: prints helpful messages. Must be used alone.
To enter a command, prefix it with :
.
quit
: exits the gamerestart
: sets your score to 0 and takes you back to the first scene of the adventureextend
: adds a rule to the current sceneremove
: removes a rule from the current sceneedit
: edits a rule from the current scenereorder
: reorders the rules of the current scene.description
: changes the description of the current scenecancel
: cancels the current editview
: displays all the rules for the current scenechange story
: changes the storynew
: creates a new story
import image
: imports an image (jpeg or png) from the URI specified on the next line.import music
: imports a music file (mp3, wav, or aac) from the URI specified on the next line.import adventure
: imports an adventure (a zip file) from the URI specified on the next line.clear image
: clears the saved image for the current sceneclear music
: clears the saved music for the current scenesave
: saves the current adventure. The game saves automatically when needed, so there is no need to use this command during normal use.
about
: prints information about the program.license
: prints license information.
- Drag and drop JPEG image files onto the image to set the image for the current scene.
- Drag and drop WAV, MP3, or AAC files onto the audio player to set the sound for the current scene.
- Drag and drop the
.zip
file for the current adventure from the bottom right corner of the screen. This is useful for sharing. - Drag and drop
.zip
files into the text input area to import adventures.
A Grow adventure is comprised of scenes and begins at the starting scene. Each scene must have a description, and may have an image and music. Each scene also has a list of rules to process user input. A rule is a list of patterns and a list of actions. When any of the patterns occur in the user's input, the game executes all of the rule's actions.
The patterns are case insensitive, and support regular expressions. A rule matches the user's input if any of the patterns for that rule can be found in the input. Because in most cases, a pattern is intended to match a whole word, before matching, all patterns are substituted into the regular expression .*\b(%s)\b.*
, where %s
is the uppercase version of the pattern. The program than searches for that regular expression in the uppercase version of the user's input. While it is not possible not make matching case sensitive, it is still possible to match parts of words by adding .*
as a suffix or prefix to a pattern. For example, if you want to match any word that has foo
in it, you could use the pattern foo.*
, which when inserted into the expression above, becomes .*\b(foo.*)\b.*
, and will match any word which starts with foo
.
There are four main types of actions: print, go, change score, and display score. The print action prints text out to the user. It is denoted by the prefix p
. For example, the action pRight on!
would print out "Right on!". The go action changes the scene to a different scene. It is indicated by the prefix g
. Thus, the action gforest
would cause the game to go to the forest scene. The change score action causes the user's score to change. It has two prefixes: +
and -
. The action +100
will increase the score by 100, and the action -100
will decrease the score by 100. The display score action causes the program to display the player's current score. It is simply s
.
When a player first visits a scene, the program displays the description for that scene, along with the associated media. The player can then type anything, and hit enter to submit their response. Then, the game analyzes the response. First, the game checks to see if the response is a command. If so, it executes that command. If the response is not a command, the game checks to see if any of the scene's rules match the command. The game then executes all the actions of the first rule that matches the user's input.
While playing Grow is fun, the real power of Grow is that it allows the player to modify the game during play. The main command for this is extend
. When the player types the extend command, the program will ask the player for patterns to match. He can enter as many patterns as he wants, one per line, and then type a blank line when he is done. Then, the program will ask the player for actions to take when those patterns are matched in the user's input. Once again, the player can enter the actions, one per line, in the format described above, and then type a blank line when done.
Grow has several more editing commands which allow for editing the description of the current scene, changing the order of rules, and editing rules. The most useful are edit
and description
.
The edit
command allows the player to edit rules from the current scene. It first asks the user to pick a rule to edit. Then it displays three choices:
- Edit patterns
- Edit actions
- Reorder actions
The pattern and action editing work in the same way. First, the game asks the user to pick a pattern or action to edit. Then, it asks for a replacement for that pattern or action. If the user is using the GUI mode, the game will put the text of the last pattern or action into the input field so the user can edit it. If the user is using the console mode, this will not happen because Java does not support it. Then, once the user hits enter, the program saves the new pattern or action. If the user deletes all the text and hits enter, the game removes that pattern or action. After the editing is complete, the game asks the user to enter any new patterns or actions, in the same way as the extend
command.
The reordering of actions is simple: the program prints out a numbered list of the actions, and asks the user for a new order as a list of space-separated integers. For example, consider the following actions:
1. pWhat is so hard about this?
2. pI told you: you have to destroy the death star!!
3. pIf you do not destroy the death star, the Empire may win
If the user typed in 1 2 3
, the order would not change, but if the user typed in 3 2 1
the order would be reversed.
The description
command allows the user to change the description for the scene. If the user is using the GUI, the game will fill the input area with the last description.
All the other commands operate in a similar way to one of the commands already described.
#Building
Run ant
to produce a runnable jar. If you also want the documentation, you can use ant doc
.
This program is licensed under GPLv3.0. A copy of the license is in LICENSE.txt
.
- Font Awesome by Dave Gandy - http://fontawesome.io.
- Ubuntu Mono - see the Ubuntu Mono license at
attribution/ubuntu-font-licence-1.0.txt
.