Linear Progression and Nesting Conditional Branches

As I’m sure I’ve said (read: whined about a lot), I have been putting off my current work in Desiderata for a long time. Ninety per cent of that has certainly been due to pregnesia and malaise (pregmalaisia?) but there’s also the quest itself.

I do like writing Arthur, but he existed in the limbo of concept and future planning for such a long time that I built myself some very unreal expectations. He ought to be likeable, although he is entirely optional if the player doesn’t like him. But his likeability is based on charm and humour. Both of which, especially the latter, have incredibly high standards. To do less than meet them is to fail.

But what I mean to really go on about is the eventing/coding involved.

If people want a novel, they acquire a novel. Linearity is a given in a novel, and it works in a manner similar to film and even television, to some extent. (when you bring the concept of series into it, there are some that can be seen out of order, and some that suffer for it) However, video games are not like any of these things.

Even in an RPG that has a central plot line that is told in a linear fashion, the player has options to do things out of order. The degree of freedom varies.

  • Quest for Glory – Acts a bit like a checklist. Most goals are open to the player immediately, some must be unlocked, and others are time-sensitive or time-specific. But there is not necessarily a mandatory order in which you must complete them. Some are even optional. This is the case for most point-and-click adventure games.
  • Jade Empire – Locks the player into one location or location set. There may be a lot of sidequests within that location, and you don’t even have to bother with most of them, but you only have access to them while you are in that location. Once you have progressed the rigidly linear plot to the next point, you move to the next location and can’t go backwards. This is a decent amount of freedom, but more rigidly structured.
  • Final Fantasy 13 – The hallway. Absolutely no feature of the game is accessible to the player unless the game permits it. From the story progression to options in the menu, everything is dictated by fixed advancement.

Seems I managed a bit of a scale, there. As far as we’ve plotted and carried things out in Desiderata, we have a sort of Jade Empire model for player freedom. Funny to say that though, since this location marks the point where the player can actually begin to backtrack travel, and although the story remains rather linear, you have a game-changing decision to make.

Quests can also vary in freedom and linearity. For example, in the quest that allows you to hire the lady wizard Fienna upon completion, the steps are linear. You accept the quest, retrieve an item, fight a monster, chase a frog, and return to Fienna. There’s more to it in the quest completion sequence, but that’s something else.

For Arthur, you have to talk to a few different merchants to obtain spell components. You can speak to them in any order–and one of them will offer you something you don’t want.

For the player, this should be a given. For me, eventing it, I had to make a way that the characters would inform the player that the task was completed without forcing them to speak to the merchants in a particular order.

The way I did this was to nest conditional branches. A conditional branch checks the information present in the game, and acts accordingly. For example, let’s say you want an NPC to say something to the players, but what he says is different based on whether they chose the sword or the bow at some previous juncture.

There are different ways to do that. Simplest would be if they had to choose one or the other and could not have chosen neither, merely make a conditional branch checking for one of the items (doesn’t matter which) and set conditions for if it is not present. That will get you this:

If SWORD is in inventory:
NPC says, “I see you are a warrior!”

Else:
NPC says, “You must be a fine shot.”

The else branch would be called into play if the sword was not chosen, and you as the writer know that if it was not chosen, the bow will have to be  in the inventory instead.

This is one of the easiest uses of conditional branches. But my problem with the merchants was a more complicated one. There are more items involved.

Luckily, each of the merchants provides one of the three items in question. So I make a nested conditional branch to check for the other two, so that the game can check if they have all been gathered. This means that after I make the first check, the first action made is to make another check. Thusly:

If CANDLE is in inventory:
If MUSHROOM is in inventory:
PC says, “We’re done with this quest!”

This basically means that the game checks for the candle, and then checks for the mushroom. If the candle isn’t there, it doesn’t bother looking for the mushroom and life goes on.

The thing to keep in mind with these nested conditional branches is that they are performed in order. So if you’re doing something more complicated, which I have, you might have to have multiple nests. This is mostly necessary for times when you have to have different combinations of checks, e.g., the first step is the most important and subject to complex change.

Now that I’ve babble on and on about this, I’m still not sure I’ve managed to explain it properly. But I hope it’s a little clearer to people who have never used conditional branches (and actually know something about RPG Maker).

Advertisements

3 thoughts on “Linear Progression and Nesting Conditional Branches

  1. There are ways to short-cut some conditional branches too, if you have one outcome for multiple (but not all) paths. I don’t remember if we got into this, but you can use the Goto command in combination with Labels to jump forward or backward in an event, and even to different parts of a Condition Nest.

    It’s fun! xD

    • Labels are nice (I wish I remembered to use them more often) but I don’t think they work across events. Seems worth testing, though. It’d save a lot of time.

      • Oh, no they won’t work across events — not even across pages within a single event. But they can be used to great effect. :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s