From f8def361fae7437417e591dee79cc2a162027f2c Mon Sep 17 00:00:00 2001 From: grabowskil Date: Fri, 14 Aug 2026 13:58:07 +0200 Subject: [PATCH] refactor scaffolding to Scenes and Characters for intuitive writing with yarn --- .../Assets/Dialogue/Characters.meta | 8 ++++ .../Assets/Dialogue/Characters/Bouncer.yarn | 45 +++++++++++++++++++ .../Bouncer.yarn.meta} | 2 +- NightclubArcadia/Assets/Dialogue/Common.yarn | 21 +++++++++ .../Assets/Dialogue/Common.yarn.meta | 10 +++++ NightclubArcadia/Assets/Dialogue/Scenes.meta | 8 ++++ .../Assets/Dialogue/Scenes/Entrance.yarn | 26 +++++++++++ .../Assets/Dialogue/Scenes/Entrance.yarn.meta | 10 +++++ .../Assets/Dialogue/TestDialogue.yarn | 21 --------- 9 files changed, 129 insertions(+), 22 deletions(-) create mode 100644 NightclubArcadia/Assets/Dialogue/Characters.meta create mode 100644 NightclubArcadia/Assets/Dialogue/Characters/Bouncer.yarn rename NightclubArcadia/Assets/Dialogue/{TestDialogue.yarn.meta => Characters/Bouncer.yarn.meta} (86%) create mode 100644 NightclubArcadia/Assets/Dialogue/Common.yarn create mode 100644 NightclubArcadia/Assets/Dialogue/Common.yarn.meta create mode 100644 NightclubArcadia/Assets/Dialogue/Scenes.meta create mode 100644 NightclubArcadia/Assets/Dialogue/Scenes/Entrance.yarn create mode 100644 NightclubArcadia/Assets/Dialogue/Scenes/Entrance.yarn.meta delete mode 100644 NightclubArcadia/Assets/Dialogue/TestDialogue.yarn diff --git a/NightclubArcadia/Assets/Dialogue/Characters.meta b/NightclubArcadia/Assets/Dialogue/Characters.meta new file mode 100644 index 0000000..14b3e6a --- /dev/null +++ b/NightclubArcadia/Assets/Dialogue/Characters.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3148b8572d5194e449b23abaac9e717f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/NightclubArcadia/Assets/Dialogue/Characters/Bouncer.yarn b/NightclubArcadia/Assets/Dialogue/Characters/Bouncer.yarn new file mode 100644 index 0000000..4dc4965 --- /dev/null +++ b/NightclubArcadia/Assets/Dialogue/Characters/Bouncer.yarn @@ -0,0 +1,45 @@ +// Everything the bouncer ever says. +// +// These nodes share a title, which makes them a node group. Callers just +// `<>` and Yarn runs the most specific variation whose +// `when:` conditions pass. Adding a new variation later means adding a node, +// not editing a growing <> chain. +// +// Each variation sets $went_inside so the calling scene knows the verdict. + +title: Bouncer_Talk +when: once +--- +Bouncer: Evening. Name on the list? +You: Depends who's asking. +-> I'm on the list. + <> + Bouncer: ...you're not on the list. + Bouncer: But it's slow tonight. Go on. + <> +-> Actually, I'll head home. + Bouncer: Smart choice. + <> +=== + +title: Bouncer_Talk +when: $is_vip +--- +Bouncer: Didn't even see you there. Go on in. +<> +=== + +title: Bouncer_Talk +when: $claimed_to_be_on_list +--- +Bouncer: Still not on the list, I assume. +Bouncer: Go on, before I change my mind. +<> +=== + +title: Bouncer_Talk +when: always +--- +Bouncer: Back again. +<> +=== diff --git a/NightclubArcadia/Assets/Dialogue/TestDialogue.yarn.meta b/NightclubArcadia/Assets/Dialogue/Characters/Bouncer.yarn.meta similarity index 86% rename from NightclubArcadia/Assets/Dialogue/TestDialogue.yarn.meta rename to NightclubArcadia/Assets/Dialogue/Characters/Bouncer.yarn.meta index 06f25a1..001560a 100644 --- a/NightclubArcadia/Assets/Dialogue/TestDialogue.yarn.meta +++ b/NightclubArcadia/Assets/Dialogue/Characters/Bouncer.yarn.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e1b092662c3154b80b7e9207e2879c60 +guid: 582cd3b2ab9274b8ca0737660a0d6b1a ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/NightclubArcadia/Assets/Dialogue/Common.yarn b/NightclubArcadia/Assets/Dialogue/Common.yarn new file mode 100644 index 0000000..52db3dc --- /dev/null +++ b/NightclubArcadia/Assets/Dialogue/Common.yarn @@ -0,0 +1,21 @@ +// Shared declarations for the whole project. +// +// This node is never played. Declaring every variable in one place means the +// compiler catches typos ("$reputaton") instead of silently creating a second +// variable at runtime. + +title: Declarations +--- +// How much the door staff likes you. +<> + +// Set when the player has tried the "I'm on the list" line at least once. +<> + +// The bouncer's verdict, read by the scene that called him. +<> + +// Smart variable: derived, not stored. Can never drift out of sync with +// $reputation, so there's nothing to remember to update. +< 10>> +=== diff --git a/NightclubArcadia/Assets/Dialogue/Common.yarn.meta b/NightclubArcadia/Assets/Dialogue/Common.yarn.meta new file mode 100644 index 0000000..398317f --- /dev/null +++ b/NightclubArcadia/Assets/Dialogue/Common.yarn.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 29774b2adf9214b77a6d280d2e604353 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 94073015eacc34c1d8fc6786e43d60ca, type: 3} diff --git a/NightclubArcadia/Assets/Dialogue/Scenes.meta b/NightclubArcadia/Assets/Dialogue/Scenes.meta new file mode 100644 index 0000000..8772729 --- /dev/null +++ b/NightclubArcadia/Assets/Dialogue/Scenes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3c89177cea38e403eb2f13330e1245be +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/NightclubArcadia/Assets/Dialogue/Scenes/Entrance.yarn b/NightclubArcadia/Assets/Dialogue/Scenes/Entrance.yarn new file mode 100644 index 0000000..1f9b302 --- /dev/null +++ b/NightclubArcadia/Assets/Dialogue/Scenes/Entrance.yarn @@ -0,0 +1,26 @@ +// The door. Scene files stay thin: they set the stage, detour into character +// nodes for the actual talking, then branch on the outcome. +// +// `Start` is the DialogueRunner's entry node (set on the Dialogue System +// prefab), so this is where the game begins. + +title: Start +--- +Narrator: Neon bleeds across wet asphalt. The queue hasn't moved in ten minutes. +<> +<> + <> +<> + <> +<> +=== + +title: Entrance_Inside +--- +Narrator: The bass hits you like a wall. +=== + +title: Entrance_Outside +--- +Narrator: The night swallows you back up. +=== diff --git a/NightclubArcadia/Assets/Dialogue/Scenes/Entrance.yarn.meta b/NightclubArcadia/Assets/Dialogue/Scenes/Entrance.yarn.meta new file mode 100644 index 0000000..b27b2c4 --- /dev/null +++ b/NightclubArcadia/Assets/Dialogue/Scenes/Entrance.yarn.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: cb0faaa47fe2440d78e49de30f921218 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 94073015eacc34c1d8fc6786e43d60ca, type: 3} diff --git a/NightclubArcadia/Assets/Dialogue/TestDialogue.yarn b/NightclubArcadia/Assets/Dialogue/TestDialogue.yarn deleted file mode 100644 index 4b85d33..0000000 --- a/NightclubArcadia/Assets/Dialogue/TestDialogue.yarn +++ /dev/null @@ -1,21 +0,0 @@ -title: Start ---- -Bouncer: Evening. Name on the list? -You: Depends who's asking. --> I'm on the list. - Bouncer: ...you're not on the list. - <> --> Actually, I'll head home. - Bouncer: Smart choice. - <> -=== - -title: Inside ---- -Narrator: The bass hits you like a wall. -=== - -title: Outside ---- -Narrator: The night swallows you back up. -===