Rez v1.2.9 — open source engine for choice-based HTML games

I’ve just committed v1.2.3. The main change is to the @rel (relationship) element. The old syntax forced a specific way to express relationships with an affinity constrained to the range -5.0 … +5.0:

@rel #player #kaspar_gutman -2.5 #{:suspicious}

and I’ve changed my mind. Now @rel works more or less like any other element exception that, as before, you don’t specify an id, rather source & target ids (relationships are unidirectional).

@rel #player #kaspar_gutman {
  affinity: -1.0
}

Of course now you can call affinity whatever you like and use any scale that makes sense to you (e.g. -1.0 … +1.0, or even 0 … 100).

@rel #player #miss_wonderly {
  love: 75
  trust: 20
}

If you want tags just use a tags: attribute as normal:

@rel #joel_cairo #kaspar_gutman {
  tags: #{:suspicious}
}

It’s also worth mentioning that relationships can be specified from any element to any element so:

@actor player {…}
@actor joel_cairo {…}
@faction gutman {…}
@item falcon {…}

@rel #player #gutman {…}
@rel #gutman #falcon {…}
@rel #joel_cairo #player {…}

Are all legal. Express any kind of relationship, between any kind of element, that makes sense in your game.

In game, you can obtain a relationship using the API:

$game.getRelationship(source_id, target_id)

or, if you have a reference to an element:

element.getRelationshipWith(target_id)

If you have a RezRelationship for the relationship A->B you can obtain the inverse relationship B->A using:

rel.inverse

Although I’ve not tested it yet, I am pretty sure that you can add a container: attribute to a relationship and specify an @inventory that could, for example, contain @item elements defined as rumours, facts, or memories. Here I am thinking about the question I was pondering earlier about enabling players to ask NPC’s questions about the world.

2 Likes