From 91eecae78699a970dfe14b2f63015c33463edf07 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Fri, 19 Sep 2025 16:20:20 -0400 Subject: [PATCH] Updated submodule, hopefully clicks and pops are gone once and for all. Added dialogue system for levels that mave more than just a simple 1 line description. --- levels/README.md | 76 ++++++++++++++++++++++++++++++++++++++++++++- libstormgames | 2 +- sounds/dialogue.ogg | 3 ++ 3 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 sounds/dialogue.ogg diff --git a/levels/README.md b/levels/README.md index ca21bd5..86a5d28 100644 --- a/levels/README.md +++ b/levels/README.md @@ -36,6 +36,53 @@ Every level needs these essential properties: If you set `locked` to `true`, the player cannot leave the level until all enemies have been defeated. Drop custom ambience files (e.g., music or creepy soundtracks) in `sounds/ambience/`. Add custom footstep sounds into the `sounds/` directory. +### Dialogue System + +Instead of using a simple `"description"` field, levels can now include interactive dialogue sequences with the new `"dialog"` property. This creates immersive story-driven introductions with character conversations: + +```json +{ + "level_id": 1, + "name": "Story Level", + "dialog": { + "allow_skip": true, + "entries": [ + { + "speaker": "Character Name", + "text": "This is what the character says." + }, + { + "speaker": "Billy Bones", + "text": "This is the player character's response." + }, + { + "text": "A narrative description of what happens.", + "narrative": true + }, + { + "speaker": "Character Name", + "text": "More dialogue with optional sound effect.", + "sound": "character_sound" + } + ] + }, + "player_start": { + "x": 0, + "y": 0 + } +} +``` + +**Dialogue Properties:** +- `allow_skip`: Set to `true` to let players skip the dialogue sequence +- `entries`: Array of dialogue entries that play in sequence +- `speaker`: Name of the character speaking (optional for narrative entries) +- `text`: The dialogue text to be spoken +- `narrative`: Set to `true` for descriptive text entries (no speaker) +- `sound`: Optional sound file to play with this dialogue entry. If no sound is specified, the system will automatically play `sounds/dialogue.ogg` if it exists. + +**Note:** Levels can use either `"description"` (traditional format) or `"dialog"` (new interactive format), but not both. The dialogue system takes precedence if both are present. + ## Adding Objects All objects go in an `"objects"` list. Here are examples of what you can add: @@ -354,7 +401,34 @@ Here's a comprehensive example showing multiple advanced features: { "level_id": 5, "name": "The Witch's Domain", - "description": "Dark magic fills the air as you approach the witch's lair. Beware her minions and the cursed ground beneath your feet.", + "dialog": { + "allow_skip": true, + "entries": [ + { + "speaker": "Ancient Spirit", + "text": "Mortal skeleton, you dare enter the witch's sacred domain?", + "sound": "ancient_spirit" + }, + { + "speaker": "Billy Bones", + "text": "I'm looking for trouble, and I think I found it." + }, + { + "text": "The air grows thick with dark magic as ancient runes begin to glow.", + "narrative": true, + "sound": "magic_ambience" + }, + { + "speaker": "Ancient Spirit", + "text": "Then face the consequences of your boldness. The witch's minions will not show mercy.", + "sound": "evil_laughter" + }, + { + "speaker": "Billy Bones", + "text": "Good thing I don't need any." + } + ] + }, "locked": true, "player_start": {"x": 0, "y": 0}, "boundaries": {"left": 0, "right": 300}, diff --git a/libstormgames b/libstormgames index 8c57afe..a98783d 160000 --- a/libstormgames +++ b/libstormgames @@ -1 +1 @@ -Subproject commit 8c57afe65bee232f082d37dd6cd596c1c76be458 +Subproject commit a98783dbc4cd765eda2e64bd12ccdc7676904dd7 diff --git a/sounds/dialogue.ogg b/sounds/dialogue.ogg new file mode 100644 index 0000000..b06828e --- /dev/null +++ b/sounds/dialogue.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b87909067beaef917a1fb05ca6d5afb7371f927781e952527700481fcce2cb50 +size 8647