This is a work in progress.


Code:
'ProgramMode:RUN
0->S
"Hello AdventurerChar!"
Prog "WAIT"
"Welcome to DroogChar!"
Lbl 0
?->A
If A=6
Then Goto 3
IfEnd
If A=4
Then Goto 1
IfEnd
If A=8
Then "You hear a loud noise as the door slams behind you."
Prog "WAIT"
"A dark shape runs at you."
Prog "WAIT"
If S=0
Then Red "You die."
Prog "WAIT"
Red "Hint:"
Red "dont do that again."
Prog "WAIT"
Prog "DIE"
Goto 0
IfEnd
If S=1
Then Red "ATTACK IT"
?->D
If D=9
Then Red "You killed a Grue."
Prog "WAIT"
"Inside the lair of"
"the Gru you find"
"a battered old"
"shield"
Prog "WAIT"
"Press 7 during a"
"battle to use the"
"shield"
Prog "WAIT"
2->S
Goto 0
IfEnd
Lbl 1
"You enter a peaceful forest."
Prog "WAIT"
"A little bunny hops onto the path."
Prog "WAIT"
"_#E595_Run you stupid git_#E596_ Yells an angry Scott."
Prog "WAIT"
"Press 5 to run."
Prog "WAIT"
"Press 0 to stay."
Prog "WAIT"
?->C
If C=5
Then "_#E595_Not that wayChar!_#E596_ yells the scott."
Prog "WAIT"
Red "You are eaten"
Prog "WAIT"
Prog "DIE"
Goto 1
IfEnd
If C=0
Then
"The rabbit leaps at you."
Prog "WAIT"
"You cower in fear."
Prog "WAIT"
"The rabbit wasnt"
"aiming at you,"
"but at the dark"
"knight behind you"
Prog "WAIT"
Red "DECAPITATION_#E5AC__#E5AC__#E5AC_"
Prog "WAIT"
"You take the knight's sword."
Prog "WAIT"
"Press 9 to use sword"
"during battle."
1->S
Goto 0
Lbl 3
"You have arrived at""a river."
Prog "WAIT"
"WHOOSH_#E5AC_"
Prog "WAIT"
"Someones shooting"
"at you."
If S<>2
Then "He got you."
Red "You die."



Currently debating where to go with this.
This is not super-relevant to the topic at hand, but are you aware that SourceCoder 2.5 can tokenize and detokenize Prizm BASIC programs?
Cool! I love IF. Do you think it would be possible to make a generic engine?
Not sure, but I doubt it. You can mod my source code if you want to.
Nah, it's too specific to your game.
I actually don't think it would be that hard. You'd just need a text representation of a potentially-cyclic event graph tagged with vertices as events and edges as commands to move between events. The program to interpret that might be somewhat short, I think.
KermMartian wrote:
I actually don't think it would be that hard. You'd just need a text representation of a potentially-cyclic event graph tagged with vertices as events and edges as commands to move between events. The program to interpret that might be somewhat short, I think.


What? That sounded like specs for a graphics program. What you need is a command parser, an underlying model (Rooms, objects, descriptions), and a way to organize all of it. Like a sort of MVC.

Take a look at the IF Archive for some ideas.
i think you don't know what a graph is. i propose you take some computer science, engineering, and algorithmics classes. Wink A cyclic tagged graph is the perfect way to store and organize it.
KermMartian wrote:
i think you don't know what a graph is. i propose you take some computer science, engineering, and algorithmics classes. ;) A cyclic tagged graph is the perfect way to store and organize it.


I understand what a graph is, and I agree that that would be the best way to organize it. I am unclear about the "cyclic tagged" bit, though. It sounds like it's a circle, why that would be desirable, I have no idea, as it would make for linear storylines, exactly what IF is not supposed to be.
Cycles in the graph are needed for a whole variety of cases. Consider being in a room with a wall in front of you. "Forward" should display a message about running into a wall, then return you to the same vertex. Voila, a cycle.
*Facepalm*

Kerm have you ever played IF? If there is no node in the direction that you are traveling, you get a "You can't go x" or a variation of that. The response is handled by the engine, not the model.
I recommend you both go read the z-machine spec if you haven't. I plan on implementing it sometime. Or at least porting an existing one to the Prizm.
Well, the z-machine isn't ideal in terms of designing a game, as it only provides the model of the game. The game has to provide it's own parser, and there is no standard set of commands, hence games for the z-machine may have variations on a theme of commands. This puts a bit of extra weight on the programmer, as they have to design a new parser for every game, and there is no easy way to add commands. I think it would be better to implement something like AGT or GAGS.
KermMartian wrote:
I actually don't think it would be that hard. You'd just need a text representation of a potentially-cyclic event graph tagged with vertices as events and edges as commands to move between events. The program to interpret that might be somewhat short, I think.


No wonder people give me strange looks when I try to explain graph theory to them if that's how I sound Razz
Qwerty.55 wrote:
KermMartian wrote:
I actually don't think it would be that hard. You'd just need a text representation of a potentially-cyclic event graph tagged with vertices as events and edges as commands to move between events. The program to interpret that might be somewhat short, I think.


No wonder people give me strange looks when I try to explain graph theory to them if that's how I sound Razz
It sounded perfectly logical to me. Sad Did you as someone who actually knows that "vertex" and "node" are synonymous understand the gist of what I was saying? Or did I come off as a total wacko?
Quote:
I actually don't think it would be that hard. You'd just need a text representation of a potentially-cyclic event graph tagged with vertices as events and edges as commands to move between events. The program to interpret that might be somewhat short, I think.


So what your saying is, I would need two integer variables, for example A and B, which would represent the characters position? That sounds like it might work.
Oweng4000 wrote:
Quote:
I actually don't think it would be that hard. You'd just need a text representation of a potentially-cyclic event graph tagged with vertices as events and edges as commands to move between events. The program to interpret that might be somewhat short, I think.


So what your saying is, I would need two integer variables, for example A and B, which would represent the characters position? That sounds like it might work.


Noooo... That's not it at all. The concept of IF is that you have "Rooms" which hold everything in the universe of the game. They have descriptions, and names, and could have attributes.

AGT Sample Game wrote:
ROOM 2
Dark Pit
WEST 3 (* Storage Room *)
END_ROOM

ROOM_DESCR 2 (* Dark Pit *)
You are in a deep pit. Climbing back up is simply impossible: the side of the
pit is far too steep and is too slippery to grip. Through a shattered wooden
door, you can faintly make out an exit to the west.
END_ROOM_DESCR

(Note that this is AGT specific code, and that other languages may differ in syntax and design)

The bit called "Room_Description" is displayed when the player enters the room, and when he/she types "look". The rooms are connected to other rooms in various directions. For example: in this game, room 2 is connected to room 3 in the west direction. Trying to move any other way might generate a "You can't go that way", or a "You try to climb the walls, but they're just too slippery." The rooms don't have to be connected in any particular way. (A popular puzzle in many games is to stick the player into a maze of interconnected rooms)

Another thing that comes into play are nouns. If there weren't any nouns, you wouldn't be able to do anything but walk around. Nouns can have many properties, including being a weapon, lockable, closeable, (im)moveable, a light source, a key, and even readable. They also may have properties such as size, and weight, and where they are initially located.

AGT Sample Game wrote:
NOUN 201
Crowbar
Iron
There is an iron crowbar here.
WEIGHT 10
SIZE 20
LOCATION 2 (* Dark Pit *)
(everything else is default)
NOUN_SYNONYMS rod bar
END_NOUN

NOUN_DESCR 201 (* Iron Crowbar *)
The iron crowbar is about three feet long and weighs about eight pounds.
It might be useful as a weapon or as a tool, depending on the circumstances.
END_NOUN_DESCR


From this excerpt, we can glean that its name is the crowbar, it is iron, and it can also be called a rod or a bar. It starts in room 2 (Which is a dark pit, as referenced by the comment). The line of text below the adjective "Iron" is what is displayed when it is lying on the floor in a room. The long "Noun_Description" is what is displayed when it is examined.

AGT Sample Game wrote:
NOUN 202
Crate
Wooden
There is a large wooden crate here.
LOCATION 3 (* Storage Room *)
CLOSABLE
CLOSED
LOCKABLE
LOCKED
READABLE
KEY 201 (* iron crowbar *)
UNMOVABLE
NOUN_SYNONYMS lettering side writing box lid nail nails
END_NOUN

NOUN_DESCR 202 (* Wooden Crate *)
The crate is about eight feet long by six feet wide by six feet high. It is
extremely heavy and quite solid. There is lettering on the side. It has a
lid that is nailed to the top of the crate.
END_NOUN_DESCR

TEXT 202 (* Wooden Crate *)
The side of the crate says, "U.S. Emergency Radiation Supplies. Do Not Open."
END_TEXT


This one is a bit longer than the previous noun. It's closable, and lockable, and happens to be both. It's readable, so there's a "TEXT" for it, which will be displayed when it is read (i.e. "read crate"). The only way to open/unlock it is with the crowbar (i.e. "open crate with crowbar"). Nouns can also be in other nouns, so a radiation treatment kit could be in the box by setting its location to 202, the # of the crate.

Another thing in the game are NPCs. They can be hostile, or friendly, and may need to be killed or transported to a place in order to win. They may also block movement.

AGT Sample Game wrote:
CREATURE 301
Wolf
Grey
There is a grey wolf here, snarling and growling at you.
LOCATION 3 (* Storage Room *)
WEAPON 201 (* crowbar *)
HOSTILE
THRESHHOLD 3 (* can attack it 3 times *)
TIME_THRESH 5 (* can be in room for 5 turns *)
END_CREATURE

CREATURE_DESCR 301 (* Grey Wolf *)
The wolf is grey, with a few white spots on its belly. It is also quite large,
almost as tall as you are. Its claws look sharp. The wolf does not look
friendly; it growls and snarls, plainly upset that you have disturbed it.
END_CREATURE_DESCR


The wolf here is guarding the crate. Most of the rest should be self-explanatory, with the comments. A player cannot exit the room in which a hostile creature is in until he/she has killed it. Creatures can also follow the player around, and lend their witticisms. One more thing to note is that all objects (Nouns/Creatures) can have a point value attached to them that can be gained by acquiring them/killing them/meeting them.

At this point, you may be thinking that IF is pretty dull, after all, all you can do is walk around acquiring things, and fighting NPCs. Not so: IF has one more trick op its sleeve,well maybe a couple... Specials. Specials perform an action, such as moving a player, or altering his/her's status.

'Crusade' wrote:
ROOM 43
Thick woods
NORTH 43
SOUTH 4
EAST 43
WEST 2
ROOM_SYNONYMS CHANGE_LOCATIONS CLIMB GO
KEY 201 (* will cause 'CLIMB or GO TREE' to go to location 3 -- top of tree *)
SPECIAL 3
END_ROOM

...

NOUN 201
trees
large
There are large trees all around you.
LOCATION 43
UNMOVABLE
PLURAL
NOUN_SYNONYMS TREE
END_NOUN

...

ROOM 3
Tree top
DOWN 43
END_ROOM

...

SPECIAL 3
You struggle up branch by branch till you reach the tallest part of the tree.
END_SPECIAL


Let's break this up line by line: On the seventh line, the "ROOM_SYNONYMS" bit is just a list of synonyms. The "CHANGE _ROOMS" bit is a special word that makes the player change rooms when the given key is specified. The "Go" and "Climb" bits are just verbs that can be used. On the next line, There's a KEY. This is the noun that must be specified for the special to work. The SPECIAL bit just specifies what room to move to. When the player types "climb trees" he is moved to room 3, and special 3 is played.

I hope you have enjoyed this mini-tutorial on IF/AGT. Remember, there are may different programming languages out there with a variety of skill levels and expertise. From those like AGT, which you need little to no programming experience to use, to those like the Z-Machine format, which has the programmer create their own parser, the games you make with them are always fun.
That's a very thorough explanation, Seana11; I'm suitably impressed. I definitely think it might be cool to create your own storage format and parser. However, as BenRyves pointed out on IRC yesterday evening, the Prizm has far more than enough space to natively store the 83KB ZORK.DAT file, and you could always write a parser to read that original file.
Well, the Prism is not the only platform around for IF, and I'd be interested in developing a system for the 83+ family.
seana11 wrote:
Well, the Prism is not the only platform around for IF, and I'd be interested in developing a system for the 83+ family.
That would be excellent; I hope you actually pursue it! What would/will you write it in? Perhaps you should start yourself a topic about it?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement