Add harlon into version control.
[harlon.git] / README
1 This was a brief attempt at making a text adventure game engine. It's 
2 not complete and not in active development. Using the logic that if 
3 it took more than 3 minutes to make it's worth sharing I'm sharing it 
4 in case anyone else is interested and wants to continue with it.
5
6 ----------------------------
7
8 Text adventure games contain, among other things, rooms and objects. A 
9 room simply means a particular location or scene in the game, which 
10 usually corresponds to the name shown to the player as they move 
11 around. Let's consider the following example:
12
13 my $rooms = {
14     $the_kitchen = {
15         name        => 'Kitchen',
16         description => 'This was once an exquisite kitchen.',
17         east        => 'living_room',
18         action      => 'kitchen_routine',
19         flags       => [ 'light', ],
20     },
21 };
22
23 my $objects = {
24     table => {
25         name => 'kitchen table',
26         description => 'It looks like something right out of the 1950s: Green formica and chrome legs.',
27         location => 'kitchen',
28         action   => 'table_routine',
29         flags    => [ 'surface', ],
30     },
31     apple => {
32         name     => 'apple',
33         location => 'table',
34         action   => 'apple_routine',
35         flags    => [ 'vowel', 'take', ],
36     },
37 };
38
39 The above established a few things: There is a room. It has an 
40 internal name of the_kitchen, but the name shown the the player is 
41 "Kitchen". It also has a description. From here the the player can go 
42 east into the room with the internal name living_room. Finally, there 
43 is a subroutine called kitchen_routine. That subroutine will be called 
44 at various points in the game. More on that later.
45
46 The above also creates a table, located in the kitchen. Finally, there 
47 is also an apple on the table in the kitchen. The table has been 
48 flagged to indicate that it is a surface that things can be placed on, 
49 and the apple has been flagged to indicate that the player an take it. 
50 This provides the game engine with important information about what 
51 objects can be taken, and what objects can be placed on other objects. 
52 (The apple doesn't have the surface flag set, because it would not 
53 make sense to be able to put the table on the apple. Also, the table 
54 does not have the take bit set because the table is very heavy and the 
55 player shouldn't be able to move it.) Rooms and objects can have an 
56 arbitrary number of flags, any of which may be added or removed while 
57 the game is in progress. Similar to the kitchen, each of these also 
58 has a subroutine associated with them. The location of objects may 
59 change during game play. The player might take the apple, for example, 
60 and it would no longer be on the table. Or perhaps the light in the 
61 kitchen is turned off, so it no longer has the "light" flag. Thus, the 
62 information above establishes information about rooms and objects as 
63 they exist at the start of the game.
64
65 --
66 Copyright (C) 2018 Jason Self <j@jxself.org>
67
68 You can redistribute and/or modify this file under the terms of the 
69 GNU Affero General Public License as published by the Free Software 
70 Foundation, either version 3 of the License, or (at your option) any 
71 later version.
72
73 This file is distributed in the hope that it will be useful, but 
74 WITHOUT ANY WARRANTY; without even the implied warranty of 
75 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
76 Affero General Public License for more details.
77
78 You should have received a copy of the GNU Affero General Public 
79 License along with this file. If not, see 
80 <http://www.gnu.org/licenses/>.