Saturday, March 9, 2019

Rule Processing

Rule Processing

In the last post I used an after rule and I wanted to spend the next few posts talking about rules since I've spent a bit of time on the subject.

Here's an example of using an after rule from the last post.

After going to The Employee Break Area:
    Now concealment of the player is none;
    Continue the action.

Rule processing follows a specific order for processing. The below graph shows the path that rule processing follows for each action.

Rule processing diagram

Rule processing diagram

From this you can see six main processing stages for each action.

  • Before - These are the rules processed before the action actually takes place. This would include things like setting up variables, checking if certain conditions exist, and so on.
  • Instead - These rules are exceptions to the case. Here you would enumerate one offs that would block the rule from succeeding. If an action matches an instead rule, the action stops being processed.
  • Check - These are the basic premise rules that constituent the actual action. In other words, the before rules sets things up, but should something in the before rules stop the action, then the action isn't ever really carried out. However the checking rules, you've committed to the action whether it succeeds or not.

Quick Example: Like let's say your action is rob a bank. If you aren't near a bank then you really can't commit to the action so there is no success or failure, but if you are near a bank but forgot your disguise, you can still commit to robbing the bank just with an unsuccessful outcome. So before rules might be are you near a bank? vs a check rule being did you bring a disguise?.

Also Note: During the check rules, it might be tempting to use something like say "Something, Something, Something". However, you must not say anything or change any values in the story during a check action. Doing so signals to Inform that the action has failed. So in order to indicate success, you must not say or change any values in a check rule.

  • Carry out - These are the rules that change all of the values within your game based on a success. Again if it was robbing a bank, then you'd want to give the bags of money to the player and setup an event that will happen in X turns when the police show up if they are still in the bank. However, you must not say anything during this phase, that is what the report rules will do.

Note: If you do use say actions within a carry out rule, you will break the try silently action. Which if you don't use try silently in your story, then well it honestly doesn't matter then.

  • After - These are actions that happen after the action has definitely happened. As you can see in my example, I update the concealment of the player after the going to another room action has already taken place. Do note that the after rules stop the action from reaching the report rules, just like the instead rules.

  • Report - This is the last phase of rule processing. Basically this is everything that will be said as the outcome of the action, UNLESS we are try silently the action. In that case, report rules will not be ran.

I will note one more thing before ending here for now. NPCs in your story have two additional phases in the rule processing that apply to them only. I'll cover that later.

See Also

For additional information about rules see Chapter 7 and Chapter 12 from the Writing Inform book.

No comments:

Post a Comment

Implementing Help in a Story