Skip to main content

Automating Attributes with Logic

As described in Intro to Attributes, attributes are variables assigned to entities like characters. Every character has its own copy of attributes which can be controlled from its sheet.

When playing a TTRPG with pen and paper, players are expected to manually update the attributes on their character sheets, erasing and rewriting values as they change. Sheets in Quest Bound give the same control to players. For every attribute in your ruleset, you can add a field to a sheet which allows players to manually update the value of that attribute.

Derived Values

Suppose you have a number attribute called Max Health. In your game, Max Health is always the value of another number attribute, Vitality, multiplied by a third attribute, Level.

Max Health = Vitality x Level

In this example, Level and Vitality are controlled by the player based on the rules of your game. Max Health, however, is derived from the values of Level and Vitality. It's not something the player should need to change manually.

You can build this automation directly into the Max Health attribute using its logic.

caution

Logic can quickly become complex! For best results, keep it simple and only add logic when automation will greatly benefit your players. Remember, we’re making tabletop games, not video games.

Visual Programming

The logic editor of an attribute is a type of node editor which allows for visually programming simple instructions. While there are only a handful of operations available, chaining them together allows for very complex instruction sets.

tip

If you’re new to programming concepts, logic can feel overwhelming. Keeping it simple and experimenting will help.

Add a Quest Bound official ruleset to your shelf and check out the logic of several components to get an idea of how it works.

Key Points

There are a few key points to understand about the logic editor before wiring up your first attribute.

  1. Every logic node takes an input and produces an output
  2. Outputs are passed down a chain of connected nodes, with operations applied to the accumulated value
  3. The last node in a series of chained nodes provides the result of that chain’s calculation

img

  1. Mathematical order of operations is not recognized. Operations flow down the chain of connected nodes left to right
  2. Logic connected to the Default Value node update this attribute. Logic connected to Side Effects update other attributes.

Logic Nodes

Below are the types of logic nodes available

Primitives

  • Number
    • Provides a single number
  • Text
    • Provides a word or string of words
  • Boolean
    • Provides a boolean value, true or false

Operations

  • Set
    • Applies the result of its connected chain to its input (i.e. the default value)
  • Add
    • Passes the sum of its input and output to the next node in the chain
  • Subtract
    • Passes the difference of its input and output to the next node in the chain
  • Multiply
    • Passes the product of its input and output to the next node in the chain
  • Divide
    • Passes the quotient of its input and output to the next node in the chain
  • Round
    • Considers its input, modifies it with the below rules, then passes it to the next node in the chain
      • If its a number with a floating point decimal greater than or equal to 0.5, it will round its output up to the nearest whole number.
      • If its a number with a floating point decimal less than 0.5, it will round its output down to the nearest whole number.
  • Round Up
    • Rounds its input up to the nearest whole number and passes that to the next node in the chain
  • Round Down
    • Rounds its input down to the nearest whole number and passes that to the next node in the chain

Comparisons

When comparison nodes are attached to a condition, they will evaluate the nodes in their chain to be either true or false.

info

Any chain with a comparison node can be considered a comparison chain.

Comparison chains always resolve to either true or false. This chain includes an equality comparison node. It evaluates if one is equal to one, which is true. The result of this chain is true.

img

  • Equal
    • Resolves to true if its input and output are the same value
  • Not Equal
    • Resolves to true if its input and output are not the same value
  • Greater Than
    • Resolves to true if its input is greater than its output
    • This only works for number types
  • Less Than
    • Resolves to true if its input is less than its output
    • This only works for number types
  • Greater Than or Equal
    • Resolves to true if its input is greater than or equal to its output
    • This only works for number types
  • Less Than or Equal
    • Resolves to true if its input is less than or equal to its output
    • This only works for number types

Conditions

  • If
    • Splits logic into two possible branches based on the result of a comparison
    • If the comparison chain resolves to true, it passes its input to the true branch
    • If the comparison chain resolves to false, it passes its input to the false branch img
  • And
    • Connects multiple comparison chains
    • Resolves to true if all connected chains resolve to true img
  • Or
    • Connects multiple comparison chains
    • Resolves to true if any connected chain resolves to true img

References

  • Attribute

    • Reads the default value of another attribute and provides it as output
    • Inserts a field in the test panel to change the value of the attribute
    • On a sheet, this will take the value of that entity’s (character, creature, etc) attribute, not the default value img
  • Chart

    • Reads a value from a chart and provides it as output
    • Read more about how this works on the chart page. img