User Tools

Site Tools


places:progtutii

Programming Tutorial II - One way doors.

One way doors. Useful for any number of situations. (Fireman's pole, collapsing floors, jump from train, etc. etc.) What a one way door amounts to is a door which can be seen and used from one side but not the other. In practice this means that from one side, the link back is hidden.

To do this is reasonably simple. To have a one way door going from Room A to Room B, you need to make a program in Room B, let's call it 'Hide B to A', and which consists of a 'Hide Door' Contraption. But there's a catch here. Which door is the contraption meant to hide? There could be several doors coming off Room B, and surely you've got to give the poor player at least one way to go, so you don't want to hide all of the doors. You've got to tell this Contraption which door it's meant to be hiding.

When you look at it in the Program page, the 'Hide Door' Contraption has a little label on 'Parameters'. If you click on that then you'll be given a list of all the doors in your Place, and you choose which one you're interested in.1) Don't worry about forgetting to set this, as the Contraption will take you to the Parameter settings if you try to use it without setting them.

Now you've set the parameters, you can put this in the grid, stand back, and play with your newly built one way door. The logic grid should look like this:

 One way door - here's one way to do it.

<note>Note for budding programmers.

You've learnt about what parameters are: they're extra bits of information that a Contraption or Contrivance needs to work. In this case it was the particular door that a 'Hide Door' Contraption is meant to work on. Other examples might be contraptions used to show particular pages, so they need to be told which page to show.</note>

An Alternative Method.

The above program takes a specific door and hides it if the Player is in a particular room. This only works because the door is naturally showing. If the door is already hidden, then all the a program described above will do is hide an already hidden door. It is possible to achieve the desired result the other way round.

To make a one way door going from A to B, go to 'Master Settings', find the door (the list of doors is at the bottom) and set the door's 'navigation link' setting to hidden. Then go to Room A and make a program using a 'Show Hidden Door' contraption, with it's parameter set to the door in question. The final result should look like this:

 Or, you could also make a one way door like this.

Now your door, which was hidden from both sides, is visible from one side and acts the same as a one way door.

<note>Note for budding programmers.

With apologies to cats, remember that there is more than one way to skin them.2) It may be that two quite different uses of Contraptions and Contrivances will achieve the same thing. Read on! </note>

Yes, there is more than one way of achieving the same result. The above two methods for building one way doors are functionally equivalent, and any player in the Place will see exactly the same thing whichever one you use. So why use one rather than the other?

There might be many different reasons for choosing one method over the other in practice. Perhaps you happen to have a 'Show Hidden Door' contraption but not a 'Hide Door' contraption. In this case, use the second method. Another difference is which side of the door the program goes. Once you get going you will probably start finding that you have Rooms with multiple things happening. Perhaps one side of the door is outside and you want to include raindrop graphics in the background when it's raining. Or perhaps there's an extra door that's only available to members of a particular clan or race. These all take programming to achieve. It's not always easy to fit everything in.

You could always buy a new logic grid for a Room to have multiple programs running, but it may well be easier to just put the 'One way door' program on the other side of the door instead.

Also, notice how these programs interact with the Place. It's not just which components you've used to build your program that is important, it's where the program is and the state that the Place is in. In this case whether the door in question is showing or hidden.

Exercise.

Suppose that you don't want the door to be hidden from Room B, but locked instead. The player can see the door, they just can't go through it. (“The door bangs shut behind you and no amount of pulling can open it again.”) See if you can devise a program to achieve this. Here's the list of available components. Have a look to see if you can find a suitable Contraption.

Hidden Doors in Action

One possible use for hidden doors is for guiding players along story arcs. Suppose you want players to go through a series of Rooms containing a slowly unfolding story. Without programs, you'd need to build a sequence of Rooms and connect them, in order, somewhere in the depths of your Place. Even then you are supposing that the player is well behaved3) and goes through each room in turn till they reach the end, without turning round and going backwards half way through or something daft like that.

Then what happens at the end of the story arc? The Player has to come back through the whole arc, effectively going through the whole story backwards. Alright, so now you build one extra door from the end of the story arc back to the Room that the whole story started off from. Now you have the worry that the Player might go in the wrong door first and read the whole thing the wrong way round!

Use one way doors! Each room in your story sequence has a one way door leading to the next Room. The last part of the story, the final Room, has a one way door going round back to the start again. This then guides the Player along the arc in the desired fashion. You could even have forks in the story where the Player has a choice of two actions (two links away from their current Room) which then take them down different paths which may or may not converge again later.

Your Place is now much more dynamic. It's not just a static collection of Rooms just sitting there that a player can wander between at will, you can start guiding players around at your whim.

Go to next tutorial.
Return to previous tutorial.
Tutorial Contents Page
Return to Introduction to Programming.
Return to Places Overview

1)
If you choose a door which doesn't connect to the room with the program in, then it won't do anything visible at all. Oh oh … wasted all that effort!
2)
No cats were harmed in the use of this cliche.
3)
Not a safe assumption!
places/progtutii.txt · Last modified: 2023/11/21 18:04 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki