This was a brief attempt at making a text adventure game engine. It's not complete and not in active development. Using the logic that if it took more than 3 minutes to make it's worth sharing I'm sharing it in case anyone else is interested and wants to continue with it. ---------------------------- Text adventure games contain, among other things, rooms and objects. A room simply means a particular location or scene in the game, which usually corresponds to the name shown to the player as they move around. Let's consider the following example: my $rooms = { $the_kitchen = { name => 'Kitchen', description => 'This was once an exquisite kitchen.', east => 'living_room', action => 'kitchen_routine', flags => [ 'light', ], }, }; my $objects = { table => { name => 'kitchen table', description => 'It looks like something right out of the 1950s: Green formica and chrome legs.', location => 'kitchen', action => 'table_routine', flags => [ 'surface', ], }, apple => { name => 'apple', location => 'table', action => 'apple_routine', flags => [ 'vowel', 'take', ], }, }; The above established a few things: There is a room. It has an internal name of the_kitchen, but the name shown the the player is "Kitchen". It also has a description. From here the the player can go east into the room with the internal name living_room. Finally, there is a subroutine called kitchen_routine. That subroutine will be called at various points in the game. More on that later. The above also creates a table, located in the kitchen. Finally, there is also an apple on the table in the kitchen. The table has been flagged to indicate that it is a surface that things can be placed on, and the apple has been flagged to indicate that the player an take it. This provides the game engine with important information about what objects can be taken, and what objects can be placed on other objects. (The apple doesn't have the surface flag set, because it would not make sense to be able to put the table on the apple. Also, the table does not have the take bit set because the table is very heavy and the player shouldn't be able to move it.) Rooms and objects can have an arbitrary number of flags, any of which may be added or removed while the game is in progress. Similar to the kitchen, each of these also has a subroutine associated with them. The location of objects may change during game play. The player might take the apple, for example, and it would no longer be on the table. Or perhaps the light in the kitchen is turned off, so it no longer has the "light" flag. Thus, the information above establishes information about rooms and objects as they exist at the start of the game. -- Copyright (C) 2018 Jason Self You can redistribute and/or modify this file under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this file. If not, see .