The place to discuss the ADRIFT Interactive Fiction toolkit

Theo's Encounter/Roll system

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.

Theo's Encounter/Roll system

Postby The0didactus » Tue Sep 17, 2019 8:33 pm

Here's an overview of how I implemented my Encounter/Roll system in ADRIFT. In some variation, this exists in all my games: Skybreak, Six Silver Bullets, The Dead of Winter, and Tingalan. It's equally applicable in a parser game and a CYOA, and it lends a nice RPG feel to the game, and is a good "easy" way to implement mechanics like stealth and combat. I've gotten so good at this, over the years, that I can fire off about one of these encounters every ten minutes (obviously, more time is necessary for proofreading).

I don't mind if people steal this system (in truth, it's not really something I "invented"...just a natural extension of simplifying RPGs to their basic elements)

If you follow these steps, you'll have everything you need to put this system in your game:

First create all the following variables
* Encounter (a number)
* Roller or Dice (also a number)(if you want multiple dice, label them as such, IE D4, D10, D20, D100, and so on)
* Challenge (a number)
* a variable for each "stat" you want your character to have. IE strength, dexterity, constitution, and so on. (also a number)

Next make the following changes to the library commands
* add "encounter must be equal to 0" as a requirement to any command you don't want to be used in encounters. Movement is the most obvious one. Now players cannot "move" when an encounter is happening. You don't need to do this for every action (IE looking, opening, etc) but you can if you want to be super strict. I try to make it so encounters only happen in rooms where there isn't much else to do.
* create a task called "roller." Make it set the "roller" or "dice" variable to a random number between 1 and whatever you want the highest number to be (IE 20 for a D20 or 6 for a six-sided dice). Now whenever a player moves, the game will secretly roll the dice.

Next make a simple encounter...
for the purpose of this exercise let's say it's a goblin. You want the player to have to "fight the goblin" using a d20 like in dungeons and dragons. If they roll a 10 or higher, they beat the goblin. If they roll a 10 or lower, they lose. The roll is modified by strength.

* first create a command called "ENCOUNTER: THE GOBLIN" with some flavor text. The actions of this command should be "set encounter = 1" and "set difficulty = 10". Have the command end with "press X to fight the goblin" (or whatever)

* next create 2 commands, representing the results of the encounter. One is "Goblin: win" the other is "Goblin: lose" The actions will have different requirements, but BOTH will have the requirement "encounter must be equal to 1" . Both of them are also triggered by the player typing X.
* Goblin win should have the requirement "difficulty must be less than or equal to %strength%+%roller%
* Goblin lose should have the requirement "difficulty must be greater than %strength%+%roller%

Now when the player types X the game will try to run both encounters. EITHER win OR loss will be triggered. You can expand this system to no end. If you're clever you'll easily see how you can add multiple options (IE "press Y to use magic on the goblin"; "press Z to run away", with "checks" for these as well).

The actions both these commands carry out can be determined by your system: you could make the player lose health points...or lose the game...or lower their score...or whatever you want...but both actions MUST conclude by setting the encounter to "0" (otherwise it will never end and the player will be "frozen" forever)

Now you just need a way to "trigger the encounters.

I usually use adrift's "event" system for this. Make an event where whenever a player enters room X, your encounter triggers. If you want randomized encounters, like a fantasy map where there's always some chance of running into a goblin, you can make the event run each encounter, and randomize them. (I'll explain how to do that if you want)

Skybreak uses options, listed in each "room", to trigger encounters. If there is more interest in this system I will explain how I randomized Skybreak's encounters. It is very easy.

General things you MUST do to build a whole RPG out of this system

* Keep very careful track of which numbers correspond to which encounters. I use a spreadsheet. Every action associated with an encounter must have the prerequisite "encounter must be equal to [whatever the encounter number is]."

* Decide early on what actions the player is allowed to take during encounters. I usually make it so the player can't walk, open or close things, take things off and put things on, and "look"...the important thing is to COMMIT to whatever you do. It's a mess to change later in the process.

* Decide early on how big you want the "roller" range to be. In a RPG where there are lots of small bonuses (IE armor that gives +1 to strength and +1 to dexterity, and a ring that does the same thing) you want a big range, like 20 or more. Encounter difficulty is determined the same way. In a RPG where bonuses are important and rare, you want a smaller range. Skybreak uses a D10, with most encounters having a difficulty of 5. This means even a +1 bonus is super important.

You will encounter three common sources of bugs

* The first is commands that don't have the requirement "encounter must be equal to [whatever]." if an encounter result is triggering in a weird place, that's what's happening.

* The second is commands that don't have the result "set encounter to 0" . If an encounter "never ends" and you can't get out of it, that's what's happening.

* The third is both, or neither command, triggering when the player presses "X" (or whatever). If this happens, the most likely result is the "roller" is not working. Either you forgot to set one of the two to "less than OR EQUAL TO" or you have them both set to either "greater than" or "less than" %roller%+%strength% (or whatever).

I'm expecting at least some interest in how I made skybreak, especially from new players who want to make a game like skybreak. I'm happy to show you how it's done. post your questions below if so.
Posts: 286
Joined: Sun Mar 30, 2014 8:20 pm
Points: 150

Re: Theo's Encounter/Roll system

Postby Lumin » Tue Sep 17, 2019 10:03 pm

You are supposed to guard your secrets better than this.
User avatar
Posts: 2115
Joined: Fri Aug 06, 2004 5:48 pm
Points: 49

Re: Theo's Encounter/Roll system

Postby The0didactus » Wed Sep 18, 2019 12:21 am

Lumin wrote:You are supposed to guard your secrets better than this.

Eh, I'd rather have people realize how flexible ADRIFT is.

Another way to look at this system: this system comes about by removing things I don't like about role-playing games, especially ones that tend to thrive in a text-based environment:

* No "hit point trading": This system works best when a single roll is determinative. You don't make attack rolls that miss or hit, and do X damage subtracted by Y points of armor. These systems are fun to design, but they tend to be murder to play.

* Leaning into the RNG: RPGs fundamentally work by giving some power over to a random number generator or RNG. One downside of this system (and corollary to the above) is that you can often fail simply by rolling poorly. This is often frustrating when it happens, but it also makes victory fun. Systems where many many rolls are used to determine an outcome "average out" the good and bad rolls, making the system fairer, but it's important to note that you can never get away from the randomness. In my opinion, papering over the fact that the system is at rock bottom at least partially luck based makes them less fun.

* Consequences should matter but not too much:* For this reason, it's usually bad to have a failure result in "death" or the end of the game. There are lots of ways to deal with this: In Skybreak I used an adventure point system where if you have an adventure point, you lose that point and suffer what is basically a "near death experience" rather than death. In Tingalan I basically gave you hit points, and failing encounters stripped them away. In our goblin example, you can make the loss "the goblin knocks you out and takes your gold" or "the goblin hits you, drains some hit points, and runs away."

*Most importantly, and this is where the above system diverges from many others: encounters should be final, and end by returning the player back to the normal game . In the system outlined above, there is no result "between" you winning or the goblin winning: there's no situation where you get injured and so does the goblin and the goblin runs away. This decreases player freedom, but it has a significant upside...

* If your encounters are simple, you can make more of them: Instead of implementing a system that tracks the Goblin's HP, your HP, your will to keep fighting, the goblins, an AI for where the goblin runs to, an AI for whether the goblin attacks or blocks, can make 15 more encounters: an Ogre which has a difficulty of 15 rather than 10 for the strength check; a demon that you need to use a magic check to beat, rather than a strength check...etc. Ultimately, I think this results in a rather more varied play experience.

In short, this system is good for producing a lot of small, simple encounters with interesting variations but bad for producing a real simulation. Good IF can do both, but the more detailed the simulation, the less you'll ultimately be able to write. My favorite games (Sunless Sea and morrowind) tend to use very simple systems in order to leave more time for designers to build a large world.

* of course, Six Silver Bullets breaks this rule pretty badly, but that's because you're supposed to die and start over hundreds of times in Six Silver Bullets.
Posts: 286
Joined: Sun Mar 30, 2014 8:20 pm
Points: 150

Return to ADRIFT 5.0

Who is online

Users browsing this forum: No registered users and 7 guests