Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

Development Info Pathfinder: Wrath of the Righteous Kickstarter Update #26: Reactivity Scripting


I post news
Staff Member
Jan 28, 2011
Codex Year of the Donut Serpent in the Staglands Dead State Divinity: Original Sin Project: Eternity Torment: Tides of Numenera Wasteland 2 Shadorwun: Hong Kong Divinity: Original Sin 2 A Beautifully Desolate Campaign Pillars of Eternity 2: Deadfire Pathfinder: Kingmaker Pathfinder: Wrath I'm very into cock and ball torture I helped put crap in Monomyth
Tags: Owlcat Games; Pathfinder: Wrath of the Righteous

Owlcat have another Pathfinder: Wrath of the Righteous technical update for us today. This time it's about a topic that's near to the Codex's heart - reactivity and choice & consequence. In Pathfinder: Kingmaker, reactivity was implemented by means of a simple array of flags. For Wrath of the Righteous, Owlcat have switched to a more sophisticated tree-based data structure, which is not only more efficient but will also be easier to debug later on.

In our games, we put a lot of effort into the world’s reactivity to the player's actions, and how the world changes in relation to those actions. Events that happen for one player may not happen at all for another, or they may happen but in a slightly different way, or with different characters. The possibilities are vast, and every one of them has got to work. One of the writers at Bioware once joked about the complexities of writing for games by saying: “Imagine that you have to write a scene where one potentially dead character talks to another potentially dead character about an event that might have happened or might have not.” It sounds absurd, but this is our reality. Events are non-linear and all of the player’s actions need to be taken into account and provoke an appropriate response in the game world. The addition of mythics adds another layer of complexity when developing the world’s reactivity.

We have our own scripting engine to work with the game world, which operates under the “Event–Condition–Action” principle. This means that we can set a list of events for every map, and we can assign a set of actions and conditions for every event, e.g. the “Monster killed” event, with the condition “Amiri in party,” and the action “Amiri says she could have handled it easily on her own.” Conditions and actions are also used in other contexts, such as when determining which dialogue options to display.

Whenever the player makes any kind of choice, the game has got to somehow remember this choice for future reactions. In Pathfinder: Kingmaker, we used something called “UnlockableFlags” to do this. These are special flags that are saved as the player makes choices, and each flag can have a number value assigned to it. For example: when talking to a merchant, the player can get lower prices on goods in one of three ways: trick the merchant (1), persuade the merchant (2), or threaten the merchant (3). If the player has the “PricesLowered” flag with the value 2, that means the player persuaded the merchant to lower their prices. In situations where there is an opportunity for the world to react to this flag, we check to see if the flag is there and its value, if any. For instance, if you return to the same merchant, they will compliment you on your haggling skills. Many game projects use similar tools to our flag system, it’s a good and intuitive way to handle reactivity.

Flags can be used in many different ways, such as for quest objectives or for lines and responses in dialogues that the player has seen and selected.

With our scripting system, we can check various moments in the game and assign flags to them, changing the world to reflect the current state of things: characters will appear and disappear, someone will change their position, or an animation will be triggered. We can change the position of objects, the lighting, the music, and much more. All this usually takes place in the final few seconds of loading an area. Dialogue options are unlocked or hidden in real time as you talk to characters.

There were a total of 2,103 flags in Pathfinder: Kingmaker. Keeping track of so many variables was a real challenge. When we started working on Wrath of the Righteous, we thought a lot about the best way to structure our presentation of game conditions, and how we could simplify working with all these variations. Our thought process led us to create our “Etude System” (if you’re wondering why it’s called that... it’s a long story). The system is already up and running, but we still need to add some of its functionality.

In Pathfinder: Wrath of the Righteous, the state of the world at any given moment won’t be presented as a set of unrelated flags, but as tree of “etudes,” where events branch off and lead to various conditions for the world. Every etude in the tree represents a minor or major event or condition of the game world. Unlike flags, etudes can monitor entire scenes and events within them. For example, the “Meet new companion” etude can be responsible for characters and starting cut scenes and dialogues that are triggered by this meeting. Previously, this meeting would have been entirely separate, and each time the player visited the location, a check would have been run to see if the “Meet new companion” flag was present in any of several areas, in order to start the whole process. Now, you just need to trigger the “Meet new companion” event and the event itself is already configured within an etude. If the etude is triggered, the event can take place (the player can meet the companion), if it is not triggered, the event can’t take place (the meeting can’t happen).

This also means we now also have a tool for visualizing the player’s path through the story. When we load a save in the editor, we can clearly see the player’s choices and the state of the world in the current moment: what chapter the player is in, what important information they gained in previous chapters, which companions the player has and how each companion’s story is unfolding, what locations the player has visited, etc. It’s hard to overestimate the value of being able to grasp all of these different elements at a glance, and this will be doubly true when we reach the bug testing stage of the project.

Of course, etudes are much more complex that what we’ve described here, but going into detail would require a whole separate article. Our etudes system is an experiment, and some of our greatest hopes are riding on it. We are confident that our experiment will be successful, and our team will gain a powerful tool for creating non-linear events, and you will get a more vibrant and responsive world to explore.
We know that game designers are more likely to do something if they think it won't become a bugfest, so hopefully this will ultimately result in deeper choice & consequence in Wrath of the Righteous.


Mar 4, 2018
Grab the Codex by the pussy Pathfinder: Wrath
This obviously got overshadowed in the BG3 hype, but it was a very informative and interesting update. Honestly, I haven't even played Kingmaker yet, but everything about this game is looking great.

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Top Bottom