Storylets and Love2d

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
dusoft
Party member
Posts: 654
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Storylets and Love2d

Post by dusoft »

pauljessup wrote: Thu Apr 20, 2023 12:42 am Sure, I'm using it in Candlebook Island (was originally called Monster Heart), coming out in the Nintendo Switch later this year (and then eventually to PC/Mac/Linux on Steam, itch, etc). It's not going to be complex, I'm still getting used to how storylets work, so using them in this will be a simplified version. Later games I'll try and use them to a greater advantage, and do some cool stuff with it.
Maybe you know about Chris Crawford and his exploration of interactive storytelling, but if not I would highly recommend to read on his games and experiments:
https://www.erasmatazz.com/library/inte ... index.html
pauljessup
Party member
Posts: 356
Joined: Wed Jul 03, 2013 4:06 am

Re: Storylets and Love2d

Post by pauljessup »

tourgen wrote: Thu Apr 20, 2023 7:58 pm I'm very interested to see more about storylets too. decent articles on substack about your candlebook island development - good stuff.

my first project with Lua was a text tokenizer and text adventure game with items, about 10-15 rooms, characters and some branching dialog. I'm interested in a more dynamic, even 'procedural' dialog system and storylets seems like the right direction.
Hey thanks! And that is AWESOME. I love text games, the first game I ever programmed was a text game in Tandy Basic on the Tandy TSR-80. Man, that was a life time ago!
pauljessup
Party member
Posts: 356
Joined: Wed Jul 03, 2013 4:06 am

Re: Storylets and Love2d

Post by pauljessup »

dusoft wrote: Fri Apr 21, 2023 7:37 pm
pauljessup wrote: Thu Apr 20, 2023 12:42 am Sure, I'm using it in Candlebook Island (was originally called Monster Heart), coming out in the Nintendo Switch later this year (and then eventually to PC/Mac/Linux on Steam, itch, etc). It's not going to be complex, I'm still getting used to how storylets work, so using them in this will be a simplified version. Later games I'll try and use them to a greater advantage, and do some cool stuff with it.
Maybe you know about Chris Crawford and his exploration of interactive storytelling, but if not I would highly recommend to read on his games and experiments:
https://www.erasmatazz.com/library/inte ... index.html

OMG I DID NOT. Thanks for this link! THIS IS GREAT STUFF.
tourgen
Citizen
Posts: 53
Joined: Sat Mar 18, 2023 12:45 am

Re: Storylets and Love2d

Post by tourgen »

pauljessup wrote: Fri Apr 28, 2023 4:45 pm Hey thanks! And that is AWESOME. I love text games, the first game I ever programmed was a text game in Tandy Basic on the Tandy TSR-80. Man, that was a life time ago!
alright! I want to pick your brain sometine!

my first computer was a color computer 2. learned basic. first game was a text game too! a simple and bad one, but... wish I still had those old games I made. didnt have the money as a kid for the 6809 assembly cartridge, or even anyone around me that knew what assembly was to help me figure out where to start

I'll drop my Love2D text game in the forums at some point. I want to add a few neat little surprises in it - in terms of story as well as a small 2D gfx puzzle element I've been playing with.

have you seen the AI NPC interactions people have been modding into skyrim? dynamic LLM with individual NPCs. it's neat, as far as a path for dynamic storytelling
pauljessup
Party member
Posts: 356
Joined: Wed Jul 03, 2013 4:06 am

Re: Storylets and Love2d

Post by pauljessup »

Color Computer 2 rocked My uncle actually used to work for Tandy, he did some video games for them, and the paint program and window style os for the CC2.

And you should drop them off! That would be great!

I will say this, doing the storylets in this game...I might use them for another game (Bad Writer 2, it would be a very storylet style game for dynamic narratives), but other than that...they are a lot of work...so I might switch back to linear narratives for a bit...just to give my brain a break, lol
tourgen
Citizen
Posts: 53
Joined: Sat Mar 18, 2023 12:45 am

Re: Storylets and Love2d

Post by tourgen »

pauljessup wrote: Tue May 16, 2023 3:46 pm Color Computer 2 rocked My uncle actually used to work for Tandy, he did some video games for them, and the paint program and window style os for the CC2.

And you should drop them off! That would be great!

I will say this, doing the storylets in this game...I might use them for another game (Bad Writer 2, it would be a very storylet style game for dynamic narratives), but other than that...they are a lot of work...so I might switch back to linear narratives for a bit...just to give my brain a break, lol
Neat on the paint and window GUI. do you remember what they were called? I never had a disk drive for the cc2.

I'll drop the game here in the forums sometime soon. I spent a few days working a tiny bit of gfx into it using love (originally it was terminal text using just lua) and also modified talkies.lua from these forums. It's small: 10 rooms and the code is an absolute mess. I learned lua while writing it and so it's a weird amalgamation of data structures and semi-working logic.

I'd really like to see lua examples of storylet-style games. I'm struggling still with what a concrete implementation of storylets look like in terms of data structures and logic. I have dialog entries that look at player state variables and unlock choices or even whole dialog trees based on player state and game world state. maybe it's a hybrid? Totally agree with it being painful on the brain, as there are many code paths that aren't immediately apparent, making testing difficult.
pauljessup
Party member
Posts: 356
Joined: Wed Jul 03, 2013 4:06 am

Re: Storylets and Love2d

Post by pauljessup »

tourgen wrote: Wed Jun 07, 2023 3:57 pm Neat on the paint and window GUI. do you remember what they were called? I never had a disk drive for the cc2.
Oh gosh, no I don't remember. I'll have to ask my Uncle
tourgen wrote: Wed Jun 07, 2023 3:57 pm I'll drop the game here in the forums sometime soon. I spent a few days working a tiny bit of gfx into it using love (originally it was terminal text using just lua) and also modified talkies.lua from these forums. It's small: 10 rooms and the code is an absolute mess. I learned lua while writing it and so it's a weird amalgamation of data structures and semi-working logic.
LOL sounds like a lot of my code! I might start out trying to make clean, well structured code...but in the end...anything to get the game finished and bug free. Which means it starts looking like a house of cards propped up on Jenga.
tourgen wrote: Wed Jun 07, 2023 3:57 pm I'd really like to see lua examples of storylet-style games. I'm struggling still with what a concrete implementation of storylets look like in terms of data structures and logic. I have dialog entries that look at player state variables and unlock choices or even whole dialog trees based on player state and game world state. maybe it's a hybrid? Totally agree with it being painful on the brain, as there are many code paths that aren't immediately apparent, making testing difficult.
I'll let you know when Candlebook Island comes out so you can take a look! It's a hybrid, for sure. At points it uses both trad dialogue trees, and others storylet style events. Code wise, basically, what I have a storylet table that holds a listing of storylets. Each of these have a "trigger" basically, a function that returns true or false. This function can be anything, just has to return true to set off the storylet. This means it can be any variable in the game, any set of conditions, etc. So any bit of world data (time of day, weather, etc) can trigger a storylet, and these can do any number of things, not just dialogue.

For example, it can change NPC's emotional stats, etc. Rain puts this character in a bad mood, which triggers the bad mood storylet. Then when the player talks, it changes the dialogue so that they're angry etc. This can be combined with other storylets, all firing off and changing and responding to data and player input. It's tuesday evening, and so it fires off this one storylet that tells this NPC to be sad, and hang out by a specific pond, because that's where he and his ex girlfriend used to hang out, and then if the player asks the right questions/etc or is on good friendly terms with the NPC, they'll reveal some back story.

That last one is pretty much pulled from Candlebook Island, lol. Anyway, the nest of systems interacting with systems and creating stories interacting with stories is kind of nuts but fun! It takes 10x longer to do it that way than the traditional ways of straight linear narrative or branching. But it can be fun and rewarding.
tourgen
Citizen
Posts: 53
Joined: Sat Mar 18, 2023 12:45 am

Re: Storylets and Love2d

Post by tourgen »

pauljessup wrote: Tue Jun 13, 2023 2:48 pm LOL sounds like a lot of my code! I might start out trying to make clean, well structured code...but in the end...anything to get the game finished and bug free. Which means it starts looking like a house of cards propped up on Jenga.
I used to agonize over writing 'good' code. Now I just try to get things done and then get test coverage over everything. I think that's how people who release actual games do it as well.
pauljessup wrote: Tue Jun 13, 2023 2:48 pm I'll let you know when Candlebook Island comes out so you can take a look! It's a hybrid, for sure. At points it uses both trad dialogue trees, and others storylet style events. Code wise, basically, what I have a storylet table that holds a listing of storylets. Each of these have a "trigger" basically, a function that returns true or false. This function can be anything, just has to return true to set off the storylet. This means it can be any variable in the game, any set of conditions, etc. So any bit of world data (time of day, weather, etc) can trigger a storylet, and these can do any number of things, not just dialogue.

For example, it can change NPC's emotional stats, etc. Rain puts this character in a bad mood, which triggers the bad mood storylet. Then when the player talks, it changes the dialogue so that they're angry etc. This can be combined with other storylets, all firing off and changing and responding to data and player input. It's tuesday evening, and so it fires off this one storylet that tells this NPC to be sad, and hang out by a specific pond, because that's where he and his ex girlfriend used to hang out, and then if the player asks the right questions/etc or is on good friendly terms with the NPC, they'll reveal some back story.
I look forward to Candlebook Island. Thank you for describing the code and data strategy. It's always very interesting to here how others tackle these types of systems. I always learn so much.

I like the trigger concept and how it collects the logic of the storylet all in one place, which seems a best-case situation. What I have now are player commands (like 'use') that do logic checks for various items and what I call 'slots' (which are attached to rooms, other items and npc/actors). It's a bit of a mess. It's not a real signals/slots messaging system either. Some of this logic also switches out existing text entries and it's all grown into a massive hairball with just 12 rooms, 2 actors, and a handful of items.

writing descriptions for everything, 'search' text entries for everything, including notable features in rooms, actors, items. On top of that, text for the puzzles and how various player commands affect the world, and text entries and logic as the player progresses through the story and puzzles .... It's so much writing! It's scattered everywhere in the code! I really was not prepared for how much writing I've had to do and didn't think about how to organize it well. Trying to keep it all consistent, and then trying to establish some sort of atmosphere/mood and general story too.. not a workable system really.

For instance, I have a room feature that has 6+ different variations of its description text based on world state. So that's 6+ entries to write. The logic of which to present to the player was buried in the 'look' player function. But yes, I did move it to the 'fountain' table entry with an anonymous function to read world state and return the proper text entry. Thanks for the tips and help there. I think if I was writing C++ I would have done this instinctively but for some reason with Lua I did not.

anyway, best of luck with Candlebook Island.
pauljessup
Party member
Posts: 356
Joined: Wed Jul 03, 2013 4:06 am

Re: Storylets and Love2d

Post by pauljessup »

Thanks for wishing me luck! It should be on the Nintendo Switch soonish, so that's exciting.

As for the method I'm using...it actually wasn't the first method I used for something like this. Back with the game I made last year (Bad Writer) I used a storylet style system, though I didn't call it a "storylet" cause I had no idea what those were just yet. I just called them events, but they were pretty much the same thing. And I did it the way you mentioned above...and it got so messy so fast! The game was short (about a 1/2 hour worth of gameplay), but all the little things added up so quickly.

I realized, doing this with Candlebook Island would be even worse, so I had to figure out a new way. That's when I read about storylets, how other people implemented, and thought really hard about how it would work, and how I waned it to do what I needed to do. The system in Candlebook Island was better than Bad Writer, but still not perfect. I was still kind of figuring the whole thing out, and the way I handled text boxes/message boxes for conversations made it a bit more messier than it had to be.

So, I learned a lot from that! I'm going to refine the idea for my next game, for sure. Figure out a better way to trigger events and signals to create the storylets. I know there are a few modules already in love and Lua that handle signal/event sending, and I'll see if I can kind of get these to work with how I want this to work. Though, in the end, it might be quicker to write my own, since it's just a simple idea that should hopefully make complicated storylets far easier to write and maintain. We'll see!
tourgen
Citizen
Posts: 53
Joined: Sat Mar 18, 2023 12:45 am

Re: Storylets and Love2d

Post by tourgen »

I'm trying another method - putting a function inside the 'object' such as a room or an item or a room feature description that can return a table of integers. These integers reference fragments of text for the object. This allows to build up a description based on the logic of the function: time of day, state of a puzzle (fountain filled with water or not), etc. It keeps the logic right next to the array of text entries.

I think I've built my first storylet too. When the player has seen a certain collection of rooms and inspected certain key items, additional text is shown and a few world state variables are set. This can happen anywhere and isn't part of some dialog chain or player command event. Is this what a storylet is? Building this little text adventure has been so much fun. Also frustrating.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 4 guests