Interactive Fiction

Blitz3D Forums/Blitz3D Programming/Interactive Fiction

sonokong(Posted 2006) [#1]
As shown in my "A.I." discussion, I prefer to avoid graphics. Any ideas on how to create a text-based game?


Andy(Posted 2006) [#2]
research how to write a parser. Do a google search on the various types of parsers used in various adventure games from the 80's and 90's.

moving, keeping track of objects etc. is just adding and subtracting from lists, but the parser is what makes or breaks your game.

Most parsers are simple, just reacting to certain words or phrases, but even a simple parser for an adventure game can add great depth to the game.

Andy


AJirenius(Posted 2006) [#3]
Ive made a few in my youth.. I might give you a structure when I come back from work today.


AJirenius(Posted 2006) [#4]
Ok, this is how i would set it up with Blitz:

Type Room

Field Nr ; Number of the room (might be useful)
Field Name$ ; Short name of the room eg. The Cave
Field ShortDesc$ ; Gives short description of a room eg. The cave is dark and wet
Field LongDesc$ ; You are standing in the middle of a dark and wet cave. A breeze
; can be felt from somewhere.

Field Exits[12] ; Holds the number of the room you will come to if you type any of
; the directions (up, down, in, out, n,w,e,s.. etc)
Field Holds[10] ; The room can hold up to 20 objects (stores objectnumber)

End type

Type Message
Field Nr
Field Mess$
Endtype

Type Object
Field Nr
Field Name
Field Weight
Field Shortdesc$
Field Longdesc$
End type

Type Noun
Field Nr
Field word[2]
Endtype

Type Verb
Field Nr
Field word[4]
Endtype

Type adverb ; this one is used for everything else, prepositions, adverb and words that just will be ignored but not giving errormessage from engine (like 'an','the')
Field Nr
Field word
End type

Ok, then you set up code like this:

Precode (whats happening before player types? Eg. Timeevents)
Player inputs words
Engine check words with all the words in Objects, Noun, Verb and Adverb and “flags” them to be used.
Processcode: if Verb 3 and Noun 2 then Mess 9
If verb 7 and noun 11 then goto room 2, describe room
If verb 28 and object X and room Y contains object X then pick up object
Etc etc

Then just finishing code to set flags correct and start over again

hope it did make any sense


JA2(Posted 2006) [#5]
Here's a small text adventure I made for a mini competition.




JA2(Posted 2006) [#6]
And this...



All one big piece of code. Had to break it up for the code box...

Hope you find it useful...


AJirenius(Posted 2006) [#7]
Just talking (writing) about it made me want to make one again :)


sonokong(Posted 2006) [#8]
Thanks, everyone!