Help doing something fairly complicated

…or it may not be that complicated, i don’t know, it’s just that i don’t know how to begin to work out how to do it… or even if it’s possible.

The first part is easy - “Top of the mossy stairs is up from bottom of the mossy stairs”. The rest of it is pretty hard.

What i’m trying to do is the first time the player goes from the bottom of the mossy stairs to the top (Note: In my game, there is no way to reach the top of the mossy stairs without first going through the bottom of the mossy stairs), a message is displayed - “As you start to climb the stairs, you slip and fall, landing on your front. As you try to stand up, you realise that you are no longer standing on stairs but instead a sloping heap of loose stones that it’s hard to stand up on. As you flounder on the floor for a bit, a weird rock emitting green smoke lands near you, melting through the rocks as if they were butter. You look up towards the roof where it came from and see two… creatures throwing them down at you”

At this point i want to code a way to simulate the player having difficulty scrambling up these stones while dodging whatever’s being thrown. Ideally whether or not the player gets hit is random, yet more likely the longer the player stays put. If the player gets hit, it’s game over.

If the player manages to scramble to the top without dying, the game displays the message “You manage to get to you feet and begin to break into a run, when you turn to see everything as it had been before. The rocks are gone, replaced by the stairs you’ve always known and whatever creatures were on the roof are now gone”.

If the player ever goes up the stairs again, the game displays the message “You’re understandably hesitant about climbing these stairs, yet this time nothing notable happens”

So how do i simulate the player having trouble climbing the rocks and being pelted by these creatures? Also, how do i have it so it only happens the first time you climb the stairs?

Thanks in advance :slight_smile:

There are many ways to swing a bat in I7, but here’s one take on it, using a scene to model the situation. All the writing here is just to show you where the actual text goes, of course, and at least to me coding questions are easier to read if the texts are kept shorter.

This would make a great “weekly coding task”, by the way - how about it?

[spoiler][code]
“rockystairs” by Peter Orme

The bottom is a room. The top is a room. It is up from the bottom.

[Treating the creatures collectively, modeled by just one Person.]
The creatures are a person. It is plural-named. Understand “creature” as the creatures. The description is “They look foul. And they’re throwing rocks”;

[the creatures are not really modeled as characters. They could even be decoration, perhaps.]
Instead of doing something other than examining to the creatures:
say “Honestly, you can’t mean to do that to [the creatures]. They mightn’t like it!”;

A scene can be cued.

To cue (S - a scene):
now S is cued.

Rockthrowing is a scene. Rockthrowing begins when rockthrowing is cued. Rockthrowing ends when the player is in the top.

When rockthrowing begins:
say “The stairs turn to rocks, and you fall back down. Some creatures appear at the top, they’re throwing rocks at yer. Blimey.”;
now creatures is in the bottom.

When rockthrowing ends:
say “You manage to run to the top. Everything turns back to normal.”;
remove creatures from play.

instead of going up from the bottom for the first time:
now rockthrowing is cued.

Every turn during rockthrowing:
if the player is in the bottom:
if a random chance of 25 in 100 succeeds:
say "One of the creatures throw a rock at you. Boom. ";
end the game in death;
otherwise:
say “A stone whirls past you. The creatures missed.”;
[/code][/spoiler]

That handles the scene changing and the rock throwing brilliantly, but it doesn’t simulate the difficulty of scrambling up the rocks. Is that even possible?

Also, a slight fault with the code. Despite the fact that it says ‘a random chance of 25 in 100’,when i playtest it, the player died instantly every time without fail. Not sure if it’s because i’m doing something wrong or if there’s something wrong with the code but it happens.

…and what’s a weekly coding task?

As Peter said, there are many ways to swing a bat. Here’s one that depends on moving the player to a new slopey room rather than cueing a scene and on using text substitutions rather than every turn rules.

Consider it my contribution to this week’s coding task!

[rant][code]
“Another way to swing a bat” by Your Self

Bottom of the mossy stairs is a room.
Top of the mossy stairs is a room.
Top of the mossy stairs is up from bottom of the mossy stairs.

The creatures are a person. It is plural-named. Understand “creature” as the creatures. The description is “They look foul. And they’re throwing rocks.”

Instead of doing anything except examining the creatures:
say “Honestly, you can’t mean to do that to [the creatures]. They mightn’t like it!”

Sloping heap of stones is a room.
The creatures are in the sloping heap of stones.

Instead of going up from the bottom of the mossy stairs when the top of the mossy stairs is unvisited:
move the player to the sloping heap of stones, without printing a room description;
say “As you start to climb the stairs, you slip and fall, landing on your front. As you try to stand up, you realise that you are no longer standing on stairs but instead a sloping heap of loose stones that it’s hard to stand up on. As you flounder on the floor for a bit, a weird rock emitting green smoke lands near you, melting through the rocks as if they were butter. You look up towards the roof where it came from and see two… creatures throwing them down at you.”

Instead of going up in the sloping heap of stones:
say “[one of]The creatures keep hurling rocks at you, and you keep dodging them best as you can while scrambling up the heap of stones.[paragraph break][get hit with chance 10][or]It’s no easy climb, and avoiding the smoking stones whizzing through the air towards doesn’t make it any easier.[paragraph break][get hit with chance 20][or]You’re almost there. If you can only keep from being hit by those stones, you will soone have made it to the top of this heap of stones.[paragraph break][get hit with chance 25][or]You manage to get to you feet and begin to break into a run, when you turn to see everything as it had been before. The rocks are gone, replaced by the stairs you’ve always known and whatever creatures were on the roof are now gone.[arrive at the top][stopping]”.

Instead of going down in sloping heap of stones:
say “You decide to scramble back down the slope, but you stumble and fall headlong. Before you regain your orientation you hear a whooshing sound and just catch a short glimpse of the smoking stone that ends your life in the next second.”;
end the game saying “You have died”.

To say get hit with chance (N - number):
if a random chance of N in 100 succeeds:
say “One of the creatures throw a rock at you. Boom.”;
end the story saying “You have died”;
otherwise:
say “A stone whirls past you. The creatures missed.”

To say arrive at the top: move the player to the top of the mossy stairs.

After going up from the bottom of the mossy stairs: say “You’re understandably hesitant about climbing these stairs, yet this time nothing notable happens.”

Before doing anything except going in the sloping heap of stones: say get hit with chance 40.
[/code][/rant]
(As for “the weekly coding tasks”, irregularly-- certainly less often than every week–, on the Getting Started and General Game Design section of this forum, people suggest an appropriately challenging coding task for anyone who likes to realize in the language of one’s choice, just for the fun of it and to learn from how others solve the same problem in different ways from oneself.)

Nice one, Felix - that was clever just using a “one of… Stopping” phrase to model the progressive climbing like that.

I’m up for that! Time to make it official!

It’s now live. You can find it here.

That’s brilliant, thank you so very much.

However, i have twp problems with it:

  1. Staying still doesn’t make it more likely that the creatures will hit you. However, i fixed that by adding:

[code]Instead of waiting when in Sloping heap of stones, end the story saying "You wait for a bit, presenting an easy target for the creatures

YOU HAVE DIED

Why on earth did you think staying still was a good idea?".[/code]

  1. To escape the stones, you have to simply keep going up. I was hoping for there to be a little more of a challenge than that.

Is a fix for that second problem reasonably possible?

Actually, it does.

Before doing anything except going in the sloping heap of stones: say get hit with chance 40.
That line raises the probability of getting hit to 40 percent (you can set the probability to whatever figure you like from 0 to 100).

(By the way, it’s only fair to warn you that IF players probably typically dislike randomized death in interactive fiction games.)

Ah, fair enough, missed that, my bad.

Hence why i was looking for the whole scrambling up the rocks to be a little more skill based than just going up three times and hoping for the best.

Well, this is a pretty broad design question.

IF doesn’t usually have things that are skill-based, in the a certain sense, because… well, there are three things that represent ‘skill’ in games in general, and I’m not quite sure which you mean.

The first one is skill as in reaction time, trained reactions, muscle memory and so on. This obviously won’t work in IF, unless you use a z-code abuse like Textfire Golf. But most of the time it wouldn’t be appropriate to an IF game, even if you could implement it.

The second is skill in the RPG sense: a player has some numerical scores for things like Dodge, and when you need to use Dodge you have a random outcome that’s affected by that score. (Or else having a score above a certain threshold automatically allows you to do something.) The expectation is that a player’s Dodge skill might vary considerably. Most IF games are not RPG-hybrids in this sense, and IF design tends to be opposed to be opposed to randomness – or, at least, to demand very high standards of balance, fairness and scope from random systems. If you want to make this kind of game, be prepared to spend a long time getting it right.

The third is understanding how to tackle a problem, because you’ve done similar things before. (Or, to take a more extreme case, knowing what the solution to a particular puzzle is because you’ve solved it before.) This gets used a lot in IF; so, e.g., if you’ve solved a few Gun Mute puzzles, you probably know that the solution to the next puzzle is going to involve some combination of shooting, taking cover, timing, and taking advantage of the environment. That’s a much bigger design question, though.

I guess I’d count a fourth category, which is a skill that your character learns – not as a numeric chance-based improvement, but a simple flag for “you now know how to do X”. Mechanically this is just a lock-and-key puzzle, but it can work as a way to convey skill as an interactive experience.

I am more interested in the third category, though – probably because it is a big design problem!

Taking this angle requires you to think about what actions might be possible in a rock-climbing scene. Moving one way or another? Hiding behind things? Tricks to distract your opponents?

Then you have to introduce these actions, earlier in the game, in a way that the player can experiment with and learn from. That’s the rub, of course. The results can be great, but you wind up designing a large slice of your game around it – it’s not a question of “now the player has to climb rocks.”

Xachiavelli - I’m just curious: when you asked the question in the first place, what did you have in mind?

I have to agree that just hurrying up the slope and being lucky isn’t the most interesting challenge. But the way you presented there was really nothing else in there - no particular tactics or gadgets involved… Did you have an idea about what it would take?

I’m not really producing much in the way of released works, but I have l have loads and loads of abandoned games… Lately I’m returning to an idea I had years ago, that my preferred way of coming up with these stories is going backwards - not starting with “what’s the first step up the hill”, but starting with the end: “what’s the last thing you do before reaching the top”? And then going backwards: ok, how do you get there? Etc. That way you’ll also end up managing branching storylines in a much more interesting way - rather than ending up with lots of different endings, you come up with different beginnings, or maybe middles. Anyway I find that more interesting.

Sorry if I digress.

Obviously I am not just talking about going that slope of yours, more about a general approach to crafting interactive stories.

The other approach that puzzle-makers often use is ‘how does this sort of thing get dealt with in real life?’ Sometimes this works pretty well and sometimes it’s horribly opaque.

A big reason why this is hard to translate is that while boulder-scrambling is a puzzly kind of exercise, it’s all about quantitative estimates: does that rock look stable enough to push off from? If I put my foot there, is it going to get stuck? If I step-and-touch over to that boulder, will I be able to arrest my momentum and balance there? Combining a dozen or more of those at a glance, is route A better than route B?

Now, you could implement something fiddly like that – presenting the player with a series of mini-rooms, a bunch of rock objects and the need to examine and consider routes. But even if you got this implemented intuitively, this would be a) too slow-paced, and b) take the focus off the interesting thing, which is the monsters.

Although, looking back at your description, it looks as though you’re not really talking about boulders: you’re talking about scree. There’s, uh, not much skill in climbing a scree slope, unless you count being sensible enough not to do it. You could switchback (going, I dunno, alternately northwest and northeast instead of north) but it doesn’t seem as though this is a big enough space for that to be plausible. Or you could kick steps. But neither of those is the sort of thing that a player would be likely to guess, even if they were used to doing this sort of thing in real life: you’d have to give pretty good pointers.

Well, the rock climb isn’t the be-all-and-end-all of the story, it’s just a little bit of ‘excitement’ thrown in there

This particular game basically involves the player exploring this building (and the surrounding property) which is experiencing some creepy shit. It’s mostly a puzzle game but there are occasional brushes with danger, such as this, and a ‘boss fight’ at the end.

I’m not sure how detailed a description you need really but i’m willing to divulge, it’s not a top secret project :stuck_out_tongue:

So it sounds like this is more atmosphere than puzzle. That’s fine, but I think some players may find it unfair to be killed by atmosphere.

Unless they really liked the beginning of Sorceror…