intfiction.org

The Interactive Fiction Community Forum
It is currently Sat May 18, 2013 7:00 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 47 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
PostPosted: Thu Oct 28, 2010 9:49 pm 
Offline

Joined: Thu Oct 28, 2010 9:21 pm
Posts: 19
Easy question for the Inform pros out there.
Hopefully, there is an equally easy answer. :-)

I am trying to create an IF that is ludicrously simple in terms of its game "world". I want each room to be logically connected to the next in a linear fashion. By that, I mean the player follows a straight path from one room to the next. I won't need N/E/S/W directional markers. And users can't skip rooms along the path.

The reason behind such an (odd?) request is that I'm developing a sort of children's riddle game. The primary objective is to solve one puzzle before you can proceed to the next room. Typically, the puzzles will have one-word answers. If, and only if, the player provides the correct answer to the current room's puzzle, he may proceed to the next room.


If all of this is unclear, let me give an example:

Room 1:
"You are sitting in a room. You see nothing but the door and it's locked. Keeping the door locked, is an electronic keypad which you have access to. The keypad display reads "2+2=". What number do you punch on the keypad in order to unlock the door?"
(If, and only if, the player types "4" and presses Enter, he proceeds to Room 2)
(If the player enters anything but "4", then some text may appear offering a hint, etc.)

Room 2:
<another puzzle. completely unrelated to the one that came before it. when correctly solved, player then moves to...>

Room 3:
<another puzzle. completely unrelated to the one that came before it....>
You get the idea.


Any ideas on how I would get started?

I admit that I am new to Inform, but I have read the documentation and most of that is geared towards creating rooms with objects, and the interactions between objects. Indeed, I was able to create a simple adventure game just fine using some template examples.

I'm a little stuck on my "riddle" game, though. So any help would be GREATLY appreciated!

Thanks in advance,


- Anthony


Top
 Profile Send private message  
 
PostPosted: Thu Oct 28, 2010 10:36 pm 
Offline

Joined: Sat Dec 22, 2007 11:52 pm
Posts: 766
Maybe this can get you started:

Code:
The Manipularium is down from the Pullarium. The Pullarium is down from the Contactorium.

Instead of going, say "There are no directions but up."

Instead of going up:
   if the riddle-solved of the location is true:
      say "Good luck up there...";
      move the player to a random room above the location;
   otherwise:
      say "You can only go up when you 'say' the answer to the riddle.".

Instead of going up when in the Contactorium, say "You've solved all the riddles!"

a room has a truth state called riddle-solved.
riddle-solved usually is false.

The block answering rule is not listed in the report answering it that rulebook.

Instead of answering yourself that it when in The Manipularium:
   if the topic understood matches "manipulate":
      say "Correct!";
      now riddle-solved of the location is true;
   otherwise:
      say "Gesundheit!"

Instead of answering yourself that it when in The Pullarium:
   if the topic understood matches "pull":
      say "Correct!";
      now riddle-solved of the location is true;
   otherwise:
      say "Gesundheit!"

test me with "n / e / s / u / say xyzzy / say Manipulate / u / say pull / u / u"


The basic idea is to unlock the next room when you say the magic word. It doesn't have to be a say -- you could make a custom action, or match to the text exactly too. The awkward 'answering yourself that it' is due to the name of the answering action (whose rule gets triggered by the say command).

Other oddities (explained as best I can, I'm no Inform pro :) ):

* 'to a random room' is what you need to code when you're thinking 'to the room' due to Inform syntax.
* truth states are specialized properties which only can be true or false.
* the 'topic understood' will match the text you enter, in this case the text entered for the answering it that action.
* don't forget to unlist the block answering rule if you use the answering it that action (i.e., the 'say' command).


Top
 Profile Send private message  
 
PostPosted: Thu Oct 28, 2010 11:11 pm 
Offline

Joined: Mon Jun 09, 2008 8:58 pm
Posts: 679
Location: Seattle
Sounds like you're making a choose-your-own-adventure. I believe there's an extension or two on the Inform site that makes that easy. Er, it has Adventure Book or something in the title...?

_________________
Blog at Gamasutra :: Programmer's Guide to Inform 7 :: Seattle I-F


Top
 Profile Send private message  
 
PostPosted: Thu Oct 28, 2010 11:21 pm 
Offline

Joined: Thu Oct 28, 2010 9:21 pm
Posts: 19
George wrote:
Maybe this can get you started:

Code:
--(cut)--


The basic idea is to unlock the next room when you say the magic word. It doesn't have to be a say -- you could make a custom action, or match to the text exactly too. The awkward 'answering yourself that it' is due to the name of the answering action (whose rule gets triggered by the say command).




Thanks George...

The logic here seems like it should work for my application. I suspect there is a more elegant way of doing it, but I'll certainly use this as a starting point and streamline it as I go along.


Top
 Profile Send private message  
 
PostPosted: Thu Oct 28, 2010 11:27 pm 
Offline

Joined: Thu Oct 28, 2010 9:21 pm
Posts: 19
Ron Newcomb wrote:
Sounds like you're making a choose-your-own-adventure. I believe there's an extension or two on the Inform site that makes that easy. Er, it has Adventure Book or something in the title...?




Not quite. Remember that my story path is completely linear. There will be no forking or choosing of paths.

You appear in "Room 1". The only way to get to "Room 2" is to solve Room 1's riddle. For argument's sake, let's say there are 10 rooms until you end. To "win" the game, each and every room must be completed in order.


Top
 Profile Send private message  
 
PostPosted: Fri Oct 29, 2010 12:04 am 
Offline

Joined: Sat Dec 22, 2007 11:52 pm
Posts: 766
One refinement might be to take the topic matching code and abstract it, so from this:

Code:
Instead of answering yourself that it when in The Manipularium:
   if the topic understood matches "manipulate":
      say "Correct!";
      now riddle-solved of the location is true;
   otherwise:
      say "Gesundheit!"


to something like this (not tested):

Code:
Instead of answering yourself that it:
    if the topic understood matches the magic word of the location:
        say the correct answer of the location;
        now riddle-solved of the location is true;
    otherwise:
        say the wrong answer of the location.


And you would then define the appropriate properties on the rooms. Might be easier to manage once you had a bunch of rooms.


Top
 Profile Send private message  
 
PostPosted: Fri Oct 29, 2010 12:08 am 
Offline

Joined: Mon Jun 09, 2008 8:58 pm
Posts: 679
Location: Seattle
Tigger31337 wrote:
Not quite. Remember that my story path is completely linear. There will be no forking or choosing of paths.

Eh? One path goes forward, the other loops back with a hint...

_________________
Blog at Gamasutra :: Programmer's Guide to Inform 7 :: Seattle I-F


Top
 Profile Send private message  
 
PostPosted: Fri Oct 29, 2010 1:14 am 
Offline
User avatar

Joined: Mon Oct 04, 2010 11:35 am
Posts: 776
Location: Toronto
Tigger31337 wrote:
Easy question for the Inform pros out there.
Hopefully, there is an equally easy answer. :-)

I am trying to create an IF that is ludicrously simple in terms of its game "world". I want each room to be logically connected to the next in a linear fashion. By that, I mean the player follows a straight path from one room to the next. I won't need N/E/S/W directional markers. And users can't skip rooms along the path.

The reason behind such an (odd?) request is that I'm developing a sort of children's riddle game. The primary objective is to solve one puzzle before you can proceed to the next room. Typically, the puzzles will have one-word answers. If, and only if, the player provides the correct answer to the current room's puzzle, he may proceed to the next room.


If all of this is unclear, let me give an example:

Room 1:
"You are sitting in a room. You see nothing but the door and it's locked. Keeping the door locked, is an electronic keypad which you have access to. The keypad display reads "2+2=". What number do you punch on the keypad in order to unlock the door?"
(If, and only if, the player types "4" and presses Enter, he proceeds to Room 2)
(If the player enters anything but "4", then some text may appear offering a hint, etc.)

Room 2:
<another puzzle. completely unrelated to the one that came before it. when correctly solved, player then moves to...>

Room 3:
<another puzzle. completely unrelated to the one that came before it....>
You get the idea.


Any ideas on how I would get started?

I admit that I am new to Inform, but I have read the documentation and most of that is geared towards creating rooms with objects, and the interactions between objects. Indeed, I was able to create a simple adventure game just fine using some template examples.

I'm a little stuck on my "riddle" game, though. So any help would be GREATLY appreciated!

Thanks in advance,


- Anthony


I'd probably approach this by finding the part in the manual that identifies how to define a new cardinal direction (I remember seeing it somewhere, probably next to the part where they explained how to cancel the old cardinal directions). Then you can name new exits anything you wish. You can name 13 new exits and definre each of those for each room as leading to the next in the sequence. In other words, one exit per room, named after the answer to its riddle. So for example if the answer to room 1's riddle is 'yes' then you can use 'Room 2 is yes of Room 1' instead of, say, west of Room 1. But you would have to define yes as a new direction, first, which unfortunately I can't give you code for off the top of my head, but I remember it seemed pretty simple. I still kinda think in MUD-brain, where defining any text you wish as an exit verb is a trivial operation; it's more unusual in Inform but I think it'd work fine for a standalone quiz game unless you had hundreds of rooms or something.

P.


Top
 Profile Send private message  
 
PostPosted: Fri Oct 29, 2010 1:42 am 
Offline

Joined: Tue Dec 25, 2007 10:06 am
Posts: 887
It also seems like an IF language might not be the best choice of tool for this kind of game, unless you have some other reasons to use one. You could make a trivia game like that with a few lines of HTML and JavaScript.


Top
 Profile Send private message  
 
PostPosted: Fri Oct 29, 2010 2:47 am 
Offline

Joined: Wed Oct 13, 2010 1:42 am
Posts: 343
Juhana is probably right--this is not a game that plays to Inform's strengths.

However, I think the absolute simplest way to do it would just be to make every room have no exits and then change them to have appropriate exits:

Code:
Completing question 1 is an action applying to nothing.
Carry out completing question 1:
Change north exit of room 1 to room 2.
Report completing question 1:
Say "A doorway opens to the north!"


This is automatically a one-way connection (you can't return to room 1), which is probably what you want.

As for interface, I'd put a person in the room who asks you the riddle and to whom you reply the answer:

Code:
The Sphinx is a person in room 1.  "An impassive stone statue gazes at you with stern, intelligent eyes."

Instead of asking the Sphinx about:
say "'What goes by four legs in the morning, two legs at noon, and three legs in the evening?'"

Instead of answering the Sphinx about:
say "'Incorrect,' says the Sphinx, glowering at you with such ferocity that you almost fear to try again."

Instead of answering the Sphinx about "[man]":
say "'Correct!'";
try completing question 1.

Understand "man" or "men" or "person" or "people" or "human" or "humans" as "[man]".


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 47 posts ]  Go to page 1, 2, 3, 4, 5  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group