A question was raised about how much programming knowledge is required to use Rez and it’s a good question.
Setting aside that it’s for making parser games, Inform, appears to come at programming from an “authorial” rather than “developer” perspective. To some extent that seems to make it more approachable and easy to use.
As a professional programmer of 30+ years and more than a dozen languages I find Inform code obtuse. I say this not to denigrate it, but to show my biases. I may not be the best person to answer this question. However, right now, I am probably the only person who can.
There are five classes of things I would call “programming” when working with Rez (and, to some extent, Twine).
- Game Design
- Template Expressions
- Event Handlers
- Procedural Generation
- Behaviour Trees
The good news is that all but the first is entirely optional and you can learn as your ambitions grow.
Game design is planning out your game in terms of the scenes and cards (a card is analogous to a Twine passage, Twine has no equivalent to a Rez scene) and how they link together. Rez eschews markdown style link syntax for plain <a> tags.
@game {
initial_scene_id: #scene_one
}
@scene scene_one {
initial_card_id: #first_card
}
@card first_card {
content: ```
<h1>Scene 1 — One</h1>
<a card="second_card">Next</a>
```
}
@card second_card {
content: ```
<h2>Scene 1 — Two</h2>
<a scene="scene_two">Next</a>
```
}
@scene scene_two {
initial_card_id: #third_card
}
@card third_card {
content: ```
<h1>Scene 2 — One</h1>
<a scene="first_scene">Again</a>
```
}
The <a card="second_card"> syntax is a short-hand for <a data-event="card" data-target="second_card">. Similarly for <a scene>.
Scenes allow you to create more structure and use a different layout. You can also interlude to a scene and back (I do that for things like character panels, inventory, and dialog).
Template Expressions are how you make dynamic templates that vary content based on game state.
@actor player {
$global: true %% makes the id 'player' into a global variable $player
money: 100
}
@card first_card {
bindings: [player: #player]
price: 10
content: ```
<p>Money: ${player.money} gp</p>
<p>Price: ${card.price} gp</p>
```
}
Rez supports a number of useful template expressions such as ${}, $if, and $foreach.
It also allows you to build your own HTML components which involve writing a Javascript function to output content. For example a component that changes the colour of a price if it’s more money than the player has:
@component price (bindings, params, content) => {
const {player} = bindings;
const {price} = params;
if(price > player.money) {
return `<p class="red">${price} gp</p>`;
} else {
return `<p>${price} gp</p>`;
}
}
@card first_card {
bindings: [player: #player]
price: 10
content: ```
Price: <.price price={card.amount} />
```
}
You don’t have to learn any of this, unless you want to start using it.
Event Handlers let you respond to events. Some Rez generates as it does its work (e.g. there is an event when you change card, or scene, etc…) and some you can specify yourself.
@card first_card {
price: 10
content: ```
<p>Price: ${card.price} <a data-event="buy">Buy</a></p>
```
on_buy: (card, evt) => {
$player.money -= card.price;
}
}
I’ll leave procedural generation and behaviour trees for another time as they are certainly more advanced topics.
In general the answer is “not much to do simple things” and a little more as you become more ambitious. The main challenge is probably the state of the documentation. I usually just go straight into the source but that’s probably an ask for others.
The language reference has a lot of information but needs an update too often mixes in advanced topics that make things seem more complicated than they need to be.
The authors guide was an attempt to create something more introductory and gradual and focused on making a game. I’m still mulling chapter 2 and would welcome recommendations for where to put my attention.