Going Nostalgic With Text Adventures And QB64!

Post Stastics

  • This post has 3202 words.
  • Estimated read time is 15.25 minute(s).

Exploring the World of Textual Games

Textual games, such as text adventures, have long been cherished by enthusiasts for their immersive storytelling and engaging gameplay mechanics. These games, often characterized by their reliance on textual descriptions and player input, offer a unique gaming experience that stimulates imagination and problem-solving skills.

The presented text adventure game, aptly named "The Quest," encapsulates the essence of this genre. Through a series of commands and responses, players are transported into a world of mystery and discovery, where every decision shapes the outcome of their adventure.

Getting Started

Before delving into the intricacies of the game, it's essential to set the stage. Upon initialization, the game clears the screen and initializes various arrays and flags necessary for gameplay. This preparatory phase ensures a seamless gaming experience from the outset.

Navigating the World

Central to any text adventure is the parser, responsible for interpreting player commands. Players can interact with the game world by issuing commands such as "GO," "GET," "DROP," "LOOK," and more. These commands trigger specific routines within the game, enabling players to explore, collect items, solve puzzles, and progress through the narrative.

Immersive Descriptions

One of the hallmarks of textual games is their ability to paint vivid imagery through descriptive text. Each room is accompanied by a detailed description, allowing players to visualize their surroundings and immerse themselves in the game world fully.

Unraveling the Mystery

As players navigate through "The Quest," they unravel the mysteries left behind by their eccentric uncle. The game's storyline unfolds gradually, with each interaction and discovery revealing new clues and challenges. From deciphering diary entries to uncovering hidden treasures, every twist and turn keeps players engaged and eager to uncover the next secret.

The Journey Continues

As with any adventure, the journey in "The Quest" is as important as the destination. With each decision, players forge their path and shape their destiny. Whether they emerge victorious with the coveted magic ruby or succumb to the perils of the unknown, the adventure promises an unforgettable experience.

The game I present here comes from one of my early Christopher Lampton books: "How to Create Adventure Games", Publisher: A Computer-awareness first book, Franklin Watts New York I London | Toronto | Sydney 1986, ISBN: 0-531-10119-3, Copyright 1986 Christopher Lampton.

Christopher Lampton published many books in the area of computer science and children's stories. His computer books range from simple Introduction to BASIC, and other computer languages, to Linear Algebra and How to build flight simulators. Every one of his books is worth a good read and you can still learn much from his books though, they are admittedly, somewhat dated. This book is available on archive.org and many sites focused on BASIC programming and retro-computing.

Since I'm using QB64 and it can easily handle long variable names without eating up all my RAM (which was an issue on the systems this game was written for), I have made some modifications to the code to make it more readable and maintainable. The changes do not effect the way the game operates, only its readability. The changes are simple search and replacement of variable names like OB() to Objects and OB$() to ObjectNames(), and R, to CurrentRoom, etc. Almost all variables have been renamed to make the code easier to read and grok.

1 Rem ** THE QUEST **
2 Rem **
3 Rem ** An adventure game
4 Rem
10 Rem Put a statement here to clear the screen. If you are using a Radio Shack Model I, III, or 4, add a CLEAR statement. (See text.)
19 Clear
20 NumberOfRooms = 19: NumberOfObjects = 17: NumberOfDirections = 6: NumberOfItem = 5
30 Dim RoomNames$(NumberOfRooms)
31 Dim ObjectNumbers(NumberOfObjects)
32 Dim ObjectNames$(NumberOfObjects)
33 Dim ItemTags$(NumberOfObjects)
34 Dim MapArray(NumberOfRooms, NumberOfDirections)
40 Print "Please stand by. . . . ": Print: Print
50 GoSub 25000: GoSub 26000: GoSub 27000: Rem initialize arrays
60 CurrentRoom = 1: CurrentItem = 0: SaltFlag = 0: FormulaFlag = 0: MixtureFlag = 1: GloveFlag = 0
70 GoSub 30000: Rem Execute introductory sequence, if any.
80 Rem Put a statement here to clear the screen.
90 GoSub 700: GoSub 500: GoSub 600
91 Rem

92 Rem *** PARSER
99 Rem
100 Print: CM$ = "": Input "WHAT NOW"; CM$: If CM$ = "" Then 100
110 C = 0: CurrentVerb$ = "": CurrentNoun$ = ""
120 C = C + 1: If C > Len(CM$) Then 150
130 W$ = Mid$(CM$, C, 1): If W$ = " " Then 150
140 CurrentVerb$ = CurrentVerb$ + W$: GoTo 120
150 C = C + 1: If C > Len(CM$) Then 180
160 W$ = Mid$(CM$, C, 1): If W$ = " " Then 180
170 CurrentNoun$ = CurrentNoun$ + W$: GoTo 150
180 If CurrentVerb$ = "" Then 100
190 If Len(CurrentVerb$) > 3 Then CurrentVerb$ = Left$(CurrentVerb$, 3)
200 If Len(CurrentNoun$) > 3 Then CurrentNoun$ = Left$(CurrentNoun$, 3)
210 If CurrentNoun$ = "SHA" Then CurrentNoun$ = "SAL"
220 If CurrentNoun$ = "FOR" Then CurrentNoun$ = "BOT"
259 Rem
290 Rem
480 GoTo 2000: Rem Execute verb routines.
490 Rem

491 Rem *** DISPLAY DIRECTIONS
496 Rem
500 Print "YOU CAN GO: ";
510 For I = 0 To 5
    520 If MapArray(CurrentRoom, I) > 0 Then Print DirectionNames$(I); " ";
530 Next I
540 Print
550 Return
590 Rem

596 Rem *** DISPLAY OBJECTS IN CURRENT ROOM
600 Print "YOU CAN SEE: "
610 ObjectExistsFlag = 0: For I = 0 To NumberOfObjects - 1
    620 If (ObjectNumbers(I) And 127) = CurrentRoom Then Print " "; ObjectNames$(I): ObjectExistsFlag = 1
630 Next I
640 If ObjectExistsFlag = 0 Then Print " NOTHING OF INTEREST"
650 Return
690 Rem

691 Rem *** DISPLAY ROOM DESCRIPTION
696 Rem
700 Print: Print "YOU ARE "; RoomNames$(CurrentRoom)
710 Return

999 Rem *** REMOVE ITEM FROM INVENTORY AND PLACE IN CURRENT ROOM
1000 If NumberOfObjects = 0 Then Return
1010 For I = 0 To NumberOfObjects - 1
    1020 If ItemTags$(I) = CurrentNoun$ Then ObjectExistsFlag = 1: ObjectRoomNumber = ObjectNumbers(I): GoTo 1050
1030 Next I
1040 ObjectExistsFlag = 0: Return
1050 ObjectRoomNumber = ObjectNumbers(I): If ObjectRoomNumber > 127 Then ObjectRoomNumber = ObjectRoomNumber - 128
1060 Return
1904 Rem

1994 Rem ===========================================
1995 Rem *            VERB ROUTINES                *
1996 Rem ===========================================

1997 Rem
1998 Rem Routine for the verb 'GO'.
1999 Rem
2000 If CurrentVerb$ <> "GO" Then 2500
2010 If CurrentNoun$ = "NOR" Then DirectionIndex = 0: GoTo 2400
2020 If CurrentNoun$ = "SOU" Then DirectionIndex = 1: GoTo 2400
2030 If CurrentNoun$ = "EAS" Then DirectionIndex = 2: GoTo 2400
2040 If CurrentNoun$ = "WES" Then DirectionIndex = 3: GoTo 2400
2050 If CurrentNoun$ = "UP" Then DirectionIndex = 4: GoTo 2400
2060 If CurrentNoun$ = "DOW" Then DirectionIndex = 5: GoTo 2400
2070 If CurrentNoun$ = "BOA" And ObjectNumbers(11) = CurrentRoom + 128 Then CurrentRoom = 13: GoTo 90
2390 Print "YOU CAN'T GO THERE!": GoTo 100
2391 Rem
2399 Rem
2400 If MapArray(CurrentRoom, DirectionIndex) > 0 And MapArray(CurrentRoom, DirectionIndex) < 128 Then CurrentRoom = MapArray(CurrentRoom, DirectionIndex): GoTo 90
2409 Rem
2410 If MapArray(CurrentRoom, DirectionIndex) = 128 Then Print "THE GUARD WON'T LET YOU!": GoTo 100
2480 GoTo 2390
2490 Rem

2499 Rem *** 'GET' ROUTINE
2500 If CurrentVerb$ <> "GET" And CurrentVerb$ <> "TAK" Then 2600
2510 GoSub 1000
2520 If ObjectExistsFlag = 0 Then Print "YOU CAN'T GET THAT!": GoTo 100
2530 If ObjectRoomNumber = -1 Then Print "YOU ALREADY HAVE IT!": GoTo 100
2540 If ObjectNumbers(I) > 127 Then Print "YOU CAN'T GET THAT!": GoTo 100
2550 If ObjectRoomNumber <> CurrentRoom Then Print "THAT'S NOT HERE!": GoTo 100
2570 If CurrentItem > NumberOfItem Then Print "YOU CAN'T CARRY ANY MORE,": GoTo 100
2575 If CurrentRoom = 18 And CurrentNoun$ = "RUB" Then Print "CONGRATULATIONS! YOU'VE WON!": GoTo 3430
2580 CurrentItem = CurrentItem + 1: ObjectNumbers(I) = -1: Print "TAKEN,": GoTo 100

2599 Rem *** 'DROP' ROUTINE
2600 If CurrentVerb$ <> "DRO" And CurrentVerb$ <> "THR" Then 2700
2610 GoSub 1000
2620 If ObjectExistsFlag = 0 Or ObjectRoomNumber <> -1 Then Print "YOU DON'T HAVE THAT!": GoTo 100
2650 CurrentItem = CurrentItem - 1: ObjectNumbers(I) = CurrentRoom: Print "DROPPED,": GoTo 100

2699 Rem *** 'INVENTORY' ROUTINE
2700 If CurrentVerb$ <> "INV" And CurrentVerb$ <> "I" Then 2800
2710 ObjectExistsFlag = 0: Print "YOU ARE CARRYING:"
2720 For I = 0 To NumberOfObjects - 1
    2730 If ObjectNumbers(I) = -1 Then Print " "; ObjectNames$(I): ObjectExistsFlag = 1
2740 Next I
2750 If ObjectExistsFlag = 0 Then Print " NOTHING"
2760 GoTo 100
2798 Rem

2799 Rem *** 'LOOK' ROUTINE
2800 If CurrentVerb$ <> "LOO" And CurrentVerb$ <> "L" Then 2900
2810 If CurrentNoun$ <> "" Then 2910
2820 GoTo 90
2899 Rem *** 'EXAMINE' ROUTINE
2900 If CurrentVerb$ <> "EXA" Then 3400
2910 If CurrentNoun$ <> "GRO" Then 2940
2920 If CurrentRoom <> 6 Then Print "IT LOOKS LIKE GROUND!": GoTo 100
2930 Print "IT LOOKS LIKE SOMETHING'S BURIED HERE.": GoTo 100
2940 Rem
3000 GoSub 1000
3010 If ObjectRoomNumber <> CurrentRoom And ObjectRoomNumber <> -1 Then Print "IT'S NOT HERE!": GoTo 100
3020 If CurrentNoun$ = "BOT" Then Print "THERE'S SOMETHING WRITTEN ON IT!": GoTo 100
3030 If CurrentNoun$ = "CAS" Then Print "THERE'S A JEWEL INSIDE!": GoTo 100
3040 If CurrentNoun$ = "BAR" Then Print "IT'S FILLED WITH RAINWATER.": GoTo 100
3390 Print "YOU SEE NOTHING UNUSUAL.": GoTo 100

3399 Rem *** 'QUIT'Routine, REquires no Noun
3400 If CurrentVerb$ <> "QUI" Then 3500
3410 Print "ARE YOU SURE YOU WANT TO QUIT (YIN)";: Input QU$
3420 If QU$ = "N" Then GoTo 100
3430 Print "WOULD YOU LIKE TO PLAY AGAIN (YIN)";: Input QU$
3440 If QU$ = "Y" Then Run
3450 If QU$ = "N" Then End
3460 GoTo 3430

3499 Rem *** 'READ' ROUTINE
3500 If CurrentVerb$ <> "REA" Then 3700
3510 If CurrentNoun$ <> "DIA" Then 3560
3520 If ObjectNumbers(0) <> CurrentRoom And ObjectNumbers(0) <> -1 Then Print "THERE'S NO DIARY HERE!": GoTo 100
3530 Print "IT SAYS: 'ADD SODIUM CHLORIDE PLUS THE"
3540 Print "FORMULA TO RAINWATER, TO REACH THE"
3550 Print "OTHER WORLD.' ": GoTo 100
3560 If CurrentNoun$ <> "DIC" Then 3590
3570 If ObjectNumbers(4) <> CurrentRoom And ObjectNumbers(4) <> -1 Then Print "YOU DON'T SEE A DICTIONARY!": GoTo 100
3580 Print "IT SAYS: SODIUM CHLORIDE IS": Print "COMMON TABLE SALT.": GoTo 100
3590 If CurrentNoun$ <> "80T" Then 3620
3600 If ObjectNumbers(6) <> CurrentRoom And ObjectNumbers(6) <> -1 Then Print "THERE'S NO B0TTLE HERE!": GoTo 100
3610 Print "IT READS: 'SECRET FORMULA'.": GoTo 100
3620 Rem
3690 Print "YOU CAN'T READ THAT!": GoTo 100

3699 Rem *** 'OPEN' ROUTINE
3700 If CurrentVerb$ <> "OPE" Then 3900
3710 If CurrentNoun$ <> "BOX" Then 3740
3720 If ObjectNumbers(1) <> CurrentRoom And ObjectNumbers(1) <> -1 Then Print "THERE'S NO BOX HERE!": GoTo 100
3730 ObjectNumbers(6) = CurrentRoom: Print "SOMETHING FELL OUT!": GoTo 100
3740 If CurrentNoun$ <> "CAB" Then 3770
3750 If CurrentRoom <> 2 Then Print "THERE'S NO CA81NET HERE!": GoTo 100
3760 Print "THERE'S SOMETHING INSIDE!": ObjectNumbers(3) = 2: GoTo 100
3770 If CurrentNoun$ <> "CAS" Then 3820
3780 If CurrentRoom <> 18 Then Print "THERE'S NO CASE HERE!": GoTo 100
3790 If GloveFlag <> 1 Then Print "THE CASE IS ELECTRIFIED!": GoTo 100
3800 Print "THE GLOVES INSULATE AGAINST THE"
3810 Print "ELECTRICITY! THE CASE OPENS!"
3820 ObjectNumbers(15) = 18: GoTo 100
3890 Print "YOU CAN'T OPEN THAT!": GoTo 100

3899 Rem *** 'POUR' ROUTINE
3900 If CurrentVerb$ <> "POU" Then 4100
3910 If CurrentNoun$ <> "SAL" Then 3960
3920 If ObjectNumbers(3) <> CurrentRoom And ObjectNumbers(3) <> -1 Then Print "YOU DON'T HAVE THE SALT!": GoTo 100
3930 If SaltFlag = 1 Then Print "THE SHAKER IS EMPTY!": GoTo 100
3940 If CurrentRoom = 5 Then MixtureFlag = MixtureFlag + 1
3950 SaltFlag = 1: Print "POURED!": GoTo 4010
3960 If CurrentNoun$ <> "BOT" Then Print "YOU CAN'T POUR THAT!": GoTo 100
3970 If ObjectNumbers(6) <> CurrentRoom And ObjectNumbers(3) <> -1 Then Print "YOU DON'T HAVE THE BOTTLE!": GoTo 100
3980 If FormulaFlag = 1 Then Print "THE BOTTLE IS EMPTY!": GoTo 100
3990 If CurrentRoom = 5 Then MixtureFlag = MixtureFlag + 1
4000 FormulaFlag = 1: Print "POURED!"
4010 If MixtureFlag < 3 Then 100
4020 Print "THERE IS AN EXPLOSION!"
4030 Print "EVERYTHING GOES BLACK!"
4040 Print "SUDDENLY YOU ARE . . . "
4050 Print " . . . SOMEWHERE ELSE!"
4060 CurrentRoom = 6: GoTo 90

4099 Rem *** 'CLIMB' ROUTINE
4100 If CurrentVerb$ <> "CLI" Then 4300
4110 If CurrentNoun$ <> "TRE" Then 4140
4120 If CurrentRoom <> 7 Then Print "THERE'S NO TREE HERE!": GoTo 100
4130 Print "YOU CAN'T REACH THE BRANCHES!": GoTo 100
4140 If CurrentNoun$ <> "LAD" Then 4280
4145 If ObjectNumbers(7) <> CurrentRoom And ObjectNumbers(7) <> -1 Then Print "YOU DON'T HAVE THE LADDER!": GoTo 100
4150 If CurrentRoom <> 7 Then 4180
4160 Print "THE LADDER SINKS UNDER YOUR WEIGHT!"
4170 Print "IT DISAPPEARS INTO THE GROUND!": ObjectNumbers(7) = 0: GoTo 100
4180 Print "WHATEVER FOR?": GoTo 100
4280 Print "IT WON'T DO ANY GOOD.": GoTo 100

4299 Rem *** 'JUMP' ROUTINE
4300 If CurrentVerb$ <> "JUM" Then 4400
4310 If CurrentRoom <> 7 And CurrentRoom <> 8 Then Print "WHEE! THAT WAS FUN!": GoTo 100
4315 If CurrentRoom = 8 Then 4350
4320 Print "YOU GRAB THE LOWEST BRANCH OF THE"
4330 Print "TREE AND PULL YOURSELF UP . . . . "
4340 CurrentRoom = 8: GoTo 90
4350 Print "YOU GRAB A HIGHER BRANCH ON THE"
4360 Print "TREE AND PULL YOURSELF UP."
4370 CurrentRoom = 19: GoTo 90

4399 Rem *** 'DIG' ROUTINE
4400 If CurrentVerb$ <> "DIG" Then 4500
4410 If CurrentNoun$ <> "HOL" And CurrentNoun$ <> "GRO" And CurrentNoun$ <> "" Then Print "YOU CAN'T DIG THAT!": GoTo 100
4415 If ObjectNumbers(8) <> CurrentRoom And ObjectNumbers(8) <> -1 Then Print "YOU DON'T HAVE A SHOVEL!": GoTo 100
4420 If CurrentRoom <> 6 Then Print "YOU DON'T FIND ANYTHING.": GoTo 100
4430 If ObjectNumbers(10) <> 0 Then Print "THERE'S NOTHING ELSE THERE!": GoTo 100
4440 Print "THERE'S SOMETHING THERE!": ObjectNumbers(10) = 6: GoTo 100

4499 Rem *** 'ROW' ROUTINE
4500 If CurrentVerb$ <> "ROW" Then 4600
4510 If CurrentNoun$ <> "BOA" And CurrentNoun$ <> "" Then Print "HOW CAN YOU ROW THAT?": GoTo 100
4520 If CurrentRoom <> 13 Then Print "YOU'RE NOT IN THE BOAT!": GoTo 100
4530 Print "YOU DON'T HAVE AN OAR!": GoTo 100

4599 Rem *** 'WAVE" ROUTINE
4600 If CurrentVerb$ <> "WAV" Then 4700
4610 If CurrentNoun$ <> "FAN" Then Print "YOU CAN'T WAVE THAT!": GoTo 100
4615 If ObjectNumbers(12) <> CurrentRoom And ObjectNumbers(12) <> -1 Then Print "YOU DON'T HAVE THE FAN!": GoTo 100
4620 If CurrentRoom <> 13 Then Print "YOU FEEL A REFRESHING BREEZE!": GoTo 100
4630 Print "A POWERFUL BREEZE PROPELS THE BOAT"
4640 Print "TO THE OPPOSITE SHORE!"
4650 If ObjectNumbers(11) = 140 Then ObjectNumbers(11) = 142: GoTo 100
4660 ObjectNumbers(11) = 140: GoTo 100

4699 Rem *** 'LEAVE' OR 'EXIT' ROUTINE
4700 If CurrentVerb$ <> "LEA" And CurrentVerb$ <> "EXI" Then 4800
4710 If CurrentRoom <> 13 Then Print "PLEASE GIVE A DIRECTION!": GoTo 100
4720 If CurrentNoun$ <> "BOA" And CurrentNoun$ <> "" Then Print "HUH?": GoTo 100
4730 CurrentRoom = ObjectNumbers(11) - 128: GoTo 90

4799 Rem *** 'FIGHT' ROUTINE
4800 If CurrentVerb$ <> "FIG" Then 4900
4810 If CurrentNoun$ = "" Then Print "WHOM DO YOU WANT TO FIGHT?": GoTo 100
4820 If CurrentNoun$ <> "GUA" Then Print "YOU CAN'T FIGHT HIM!": GoTo 100
4830 If CurrentRoom <> 16 Then Print "THERE'S NO GUARD HERE!": GoTo 100
4840 If ObjectNumbers(10) <> -1 Then Print "YOU DON'T HAVE A WEAPON!": GoTo 100
4850 Print "THE GUARD, NOTICING YOUR SWORD,"
4860 Print "WISELY RETREATS INTO THE CASTLE."
4870 MapArray(16, 0) = 17: ObjectNumbers(13) = 0: GoTo 100

4899 Rem *** 'WEAR' ROUTINE
4900 If CurrentVerb$ <> "WEA" Then 5000
4910 If CurrentNoun$ <> "GLO" Then Print "YOU CAN'T WEAR THAT!": GoTo 100
4920 If ObjectNumbers(16) <> CurrentRoom And ObjectNumbers(16) <> -1 Then Print "YOU DON'T HAVE THE GLOVES.": GoTo 100
4930 Print "YOU ARE NOW WEARING THE GLOVES.": GloveFlag = 1: GoTo 100

4999 Rem *** DONT KNOW HOW TO DO THAT ROUTINE
5000 Rem
24900 Print "I DON'T KNOW HOW TO DO THAT": GoTo 100

24980 Rem =================================================
24981 Rem *            DATA LOADING ROUTINES              *
24982 Rem =================================================

24990 Rem
24991 Rem The following routine reads the MapArrayp data into
24992 Rem the MapArrayp array, MapArray(ROOM, DIRECTION).
24993 Rem
25000 If NumberOfRooms = 0 Then Return
25010 DirectionNames$(0) = "NORTH": DirectionNames$(1) = "SOUTH": DirectionNames$(2) = "EAST"
25020 DirectionNames$(3) = "WEST": DirectionNames$(4) = "UP": DirectionNames$(5) = "DOWN"
25030 For I = 1 To NumberOfRooms
    25040 For J = 0 To NumberOfDirections - 1
        25050 Read MapArray(I, J)
    25060 Next J
25070 Next I
25080 Return

25099 Rem *** ROOM DIRECTION DATA (Adjacent Rooms)
25100 Data 4,3,2,0,0,0: Rem LIVING ROOM
25110 Data 0,0,0,1,0,0: Rem KITCHEN
25120 Data 1,0,0,0,0,0: Rem LIBRARY
25130 Data 0,1,0,5,0,0: Rem FRONT YARD
25140 Data 0,0,4,0,0,0: Rem GARAGE
25150 Data 9,7,0,0,0,0: Rem OPEN FIELD
25160 Data 6,0,0,0,0,0: Rem EDGE OF FOREST
25170 Data 0,0,0,0,0,7: Rem BRANCH OF TREE
25180 Data 0,6,10,0,0,0: Rem LONG, WINDING ROAD (1)
25190 Data 11,0,0,9,0,0: Rem LONG, WINDING ROAD (2)
25200 Data 0,10,0,12,0,0: Rem LONG, WINDING ROAD (3)
25210 Data 0,0,11,0,0,0: Rem SOUTH BANK OF RIVER
25220 Data 0,0,0,0,0,0: Rem BOAT
25230 Data 15,0,0,0,0,0: Rem NORTH BANK OF RIVER
25240 Data 16,14,0,0,0,0: Rem WELL-TRAVELED ROAD
25250 Data 128,15,0,0,0,0: Rem SOUTH OF CASTLE
25260 Data 0,0,0,0,18,0: Rem NARROW HALL
25270 Data 0,0,0,0,0,17: Rem LARGE HALL
25280 Data 0,0,0,0,0,8: Rem TOP OF TREE


25900 Rem
25910 Rem The following subroutine reads the object data
25920 Rem into the three object arrays, ObjectNumbers(X), ObjectNames$(X), and
25930 Rem 02$(X).
25940 Rem
26000 If NumberOfObjects = 0 Then Return
26010 For I = 0 To NumberOfObjects - 1
    26020 Read ObjectNames$(I), ItemTags$(I), ObjectNumbers(I)
26030 Next I
26040 Return

26099 Rem *** Object Data
26100 Data AN OLD DIARY,DIA,1: Rem OBJECT #0
26110 Data A SMALL BOX,BOX,1: Rem OBJECT #1
26120 Data CABINET,CAB,130: Rem OBJECT #2
26130 Data A SALT SHAKER,SAL,0: Rem OBJECT #3
26140 Data A DICTIONARY,DIC,3: Rem OBJECT #4
26150 Data WOODEN BARREL,BAR,133: Rem OBJECT #5
26160 Data A SMALL BOTTLE,BOT,0: Rem OBJECT #6
26170 Data A LADDER,LAD,4: Rem OBJECT #7
26180 Data A SHOVEL,SHO,5: Rem OBJECT #8
26190 Data A TREE,TRE,135: Rem OBJECT #9
26200 Data A GOLDEN SWORD,SWO,0: Rem OBJECT #10
26210 Data A WOODEN BOAT,BOA,140: Rem OBJECT #11
26220 Data A MAGIC FAN,FAN,8: Rem OBJECT #12
26230 Data A NASTY-LOOKING GUARD,GUA,144: Rem OBJECT  #13
26240 Data A GLASS CASE,CAS,146: Rem OBJECT #14
26250 Data A GLOWING RUBY,RUB,0: Rem OBJECT #15
26260 Data A PAIR OF RUBBER GLOVES,GLO,19: Rem OBJECT  #17
26990 Rem

26999 Rem *** ROOM DISCRIPTION
27000 RoomNames$(1) = "IN YOUR LIVING ROOM."
27010 RoomNames$(2) = "IN THE KITCHEN."
27020 RoomNames$(3) = "IN THE LIBRARY."
27030 RoomNames$(4) = "IN THE FRONT YARD."
27040 RoomNames$(5) = "IN THE GARAGE."
27050 RoomNames$(6) = "IN AN OPEN FIELD."
27060 RoomNames$(7) = "AT THE EDGE OF A FOREST."
27070 RoomNames$(8) = "ON A BRANCH OF A TREE."
27080 RoomNames$(9) = "ON A LONG, WINDING ROAD."
27090 RoomNames$(10) = "ON A LONG, WINDING ROAD."
27100 RoomNames$(11) = "ON A LONG, WINDING ROAD."
27110 RoomNames$(12) = "ON THE SOUTH BANK OF A RIVER."
27120 RoomNames$(13) = "INSIDE THE WOODEN BOAT."
27130 RoomNames$(14) = "ON THE NORTH BANK OF A RIVER."
27140 RoomNames$(15) = "ON A WELL-TRAVELED ROAD."
27150 RoomNames$(16) = "IN FRONT OF A LARGE CASTLE."
27160 RoomNames$(17) = "IN A NARROW HALL."
27170 RoomNames$(18) = "IN A LARGE HALL."
27180 RoomNames$(19) = "ON THE TOP OF A TREE."
29900 Return
29990 Rem

29999 Rem *** INTRODUCTION ROUTINE
30000 Print "ALL YOUR LIFE YOU HAD HEARD THE STORIES"
30010 Print "ABOUT YOUR CRAZY UNCLE SIMON. HE WAS AN"
30020 Print "INVENTOR, WHO KEPT DISAPPEARING FOR"
30030 Print "LONG PERIODS OF TIME, NEVER TELLING"
30040 Print "ANYONE WHERE HE HAD BEEN."
30050 Print
30060 Print "YOU NEVER BELIEVED THE STORIES, BUT"
30070 Print "WHEN YOUR UNCLE DIED AND LEFT YOU HIS"
30080 Print "DIARY, YOU LEARNED THAT THEY WERE TRUE."
30090 Print "YOUR UNCLE HAD DISCOVERED A MAGIC"
30100 Print "LAND, AND A SECRET FORMULA THAT COULD"
30110 Print "TAKE HIM THERE. IN THAT LAND WAS A"
30120 Print "MAGIC RUBY, AND HIS DIARY CONTAINED"
30130 Print "THE INSTRUCTIONS FOR GOING THERE TO"
30140 Print "FIND IT."
30150 Input A
31999 Return

This code could be further enhanced if it used functions. However, I wanted to keep this code as close as possible to its original form. If you read the book, it gives a detailed description of how it works, so I wont go into that here. I present the code here only for review and to allow others to type it in and learn from it.

I will soon be publishing an article on creating text adventure games (as they were called when I learned to code) A.K.A. Interactive Fiction, using a small extensible python framework. Until then, download and install QB64 and type this program in (or copy and paste the source code above) and play the game. The book will be helpful but give it a go before reading the book.

The Art of Game Design

Behind every captivating text adventure lies a meticulously crafted design that balances gameplay mechanics, narrative depth, and player engagement. Let's delve deeper into the design principles underpinning "The Quest" and explore how they contribute to the game's immersive experience.

Structural Foundation

At the core of "The Quest" lies a robust structural foundation that encompasses various elements essential for gameplay. From defining the number of rooms and objects to mapping out directions and item interactions, meticulous attention to detail ensures coherence and consistency throughout the game world.

Player Agency

Central to the design philosophy of "The Quest" is the concept of player agency – the ability for players to shape the outcome of their adventure through meaningful choices and actions. By providing a diverse range of verbs and nouns for interaction, the game empowers players to express their creativity and problem-solving skills.

Dynamic Storytelling

Textual games excel in delivering dynamic storytelling experiences that adapt to player input and decisions. Through carefully crafted descriptions, dialogues, and plot twists, "The Quest" captivates players with its immersive narrative, keeping them invested in the unfolding story from start to finish.

Puzzle Design

Puzzles play a crucial role in text adventures, serving as both obstacles to overcome and gateways to new discoveries. The puzzles in "The Quest" are designed to challenge players' logic and lateral thinking, rewarding ingenuity and perseverance with satisfying solutions and narrative progression.

Player Feedback and Guidance

Effective player feedback is essential for guiding players through the game world and providing clarity on their actions' consequences. Whether through descriptive room descriptions, informative error messages, or subtle hints, "The Quest" ensures that players always feel supported and encouraged on their journey.

Balancing Challenge and Accessibility

A well-designed text adventure strikes a delicate balance between challenge and accessibility, catering to both seasoned adventurers and newcomers to the genre. Through intuitive controls, gradual difficulty curves, and optional hints, "The Quest" welcomes players of all skill levels to embark on their quest with confidence.

Community Engagement

The longevity of a text adventure often relies on its ability to foster a vibrant community of players who share their experiences, strategies, and fan creations. By embracing player-generated content, such as custom puzzles, mods, and fan fiction, "The Quest" cultivates a sense of camaraderie and creativity among its player base.

Continual Iteration and Improvement

Even the most finely crafted games can benefit from ongoing iteration and improvement based on player feedback and emerging trends. Through regular updates, patches, and expansions, "The Quest" evolves alongside its player community, ensuring that the adventure remains fresh and captivating for years to come.

In conclusion, textual games like "The Quest" offer a captivating blend of storytelling, exploration, and problem-solving. By embracing the power of words, these games ignite the imagination and challenge players to embark on epic adventures from the comfort of their own screens.

Leave a Reply

Your email address will not be published. Required fields are marked *