Bark.h header

#include <ew/core/Bark.h>

Namespace ew::core

Bark struct

struct ew::core::Bark

A single line with no branching, triggered by game state – a guard's "Halt!", a merchant's "Mind the step".

A node graph is the wrong surface for a thousand of these. A large share of a game's lines are barks, authored in volume, and drawing each as a box with no outgoing links makes a canvas nobody can read and an author nobody can keep. Studios that use ink or Yarn for branching almost always keep barks in a spreadsheet instead; this is what replaces that spreadsheet, which means it has to be at least as fast to fill in and better connected to everything else.

Members

ew::core::foundation::ContentId ew::core::branching::Bark::id

Stable identity: what a recorded take, a translated string and a comment all point at.

By id rather than by the line's own text, so fixing a typo does not throw away the take somebody recorded against it or the translation somebody paid for.

QString ew::core::branching::Bark::text

The line, as the reader hears it.

ew::core::foundation::ContentId ew::core::branching::Bark::speakerId

The codex entity saying it; null for a line nobody in particular says.

The same rule the graph follows (2.10): by id, never by name, so renaming a character does not orphan the six hundred barks they own.

QString ew::core::branching::Bark::delivery

How the line is delivered – "shouted", "muttered". Reaches the voice list, where a director reads it.

QString ew::core::branching::Bark::condition

When the game may play it, as an expression over the story's variables – alerted, gold < 10. Empty means whenever its trigger fires.

The same language a branch condition uses, deliberately: an author who has written one knows how to write the other, and the same validator reports both.

bool ew::core::branching::Bark::onceOnly = false

Whether it may play only once for a given reader.

The difference between a line that colours a place and a line that lands once – a reveal, a warning, a joke. A runtime with no way to tell them apart plays the joke forty times.

int ew::core::branching::Bark::cooldownSeconds = 0

How many seconds must pass before it may play again; 0 for no wait.

Separate from onceOnly because they solve different problems: a cooldown stops a line repeating in the same breath, and once-only stops it repeating in the same lifetime.

std::vector<QString> ew::core::branching::Bark::tags

What the game keys on to fire it – "combat/start", "enter/tavern".

Free text, and several of them, because the trigger vocabulary belongs to the GAME and no list written here would survive contact with one. They are what an author filters by when the collection has two hundred lines in it.

bool operator==(const Bark &, const Bark &)=default

Barks compare equal when every field matches.

BarkCollection class

class ew::core::BarkCollection

A named set of barks – "Town guards", "Combat", "Idle chatter".

Several collections, not one global list, for the reason a project holds several recording scripts: a collection is the unit an author works through in a sitting and the unit that stays reviewable in Perforce, instead of one file every bark change touches.

Modelled on VoiceScript and BranchScene deliberately – a ContentObject owning a vector of its own items with stable per-item identity – so the store, the undo command and the panel all work the way the branching ones do.

Members

ew::core::branching::BarkCollection::BarkCollection(ew::core::foundation::ContentId id, QString title)

Creates an empty collection with identity id and title.

const QString & ew::core::branching::BarkCollection::title() const

The collection's title.

void ew::core::branching::BarkCollection::setTitle(QString title)

Sets the title.

const std::vector< Bark > & ew::core::branching::BarkCollection::barks() const

The barks, in the order the author arranged them.

void ew::core::branching::BarkCollection::setBarks(std::vector< Bark > barks)

Replaces every bark.

const Bark * ew::core::branching::BarkCollection::findBark(ew::core::foundation::ContentId id) const

The bark with id, or null when the collection has none.

Functions

std::vector< QString > ew::core::branching::barkTags(const BarkCollection &collection)

Every tag used by any bark in collection, sorted and without duplicates.

What a filter offers. Derived rather than declared, because a tag vocabulary an author has to register before using is one they route around by typing it into the text instead.