inkle / ink-unity-integration

Unity integration for the open source ink narrative scripting language.
http://www.inklestudios.com/ink
Other
570 stars 99 forks source link

Why isn't the parent ink file attached to the data of the knot? #202

Closed WolvenBard closed 2 months ago

WolvenBard commented 3 months ago

Context:

We've broken up the structure of our ink story so that there is one ink file that includes a handful of other ink files which each represent a chapter in our game.

However, I've just noticed that when the ink unity integration compiles the file into a json, there's nowhere in the json data to track which knot belongs to which (sub) ink file so that I can figure out what chapter that knot belongs to.

Is my only option to rename all knots so that their corresponding chapter is included in the name? This isn't ideal as it solutes the already descriptive knot names. Is there another way to achieve what I'm trying to do?

Any help would be greatly appreciated.

tomkail commented 3 months ago

Hey! Yeah I’m afraid you can’t do what you’re after - included ink files are really just for organisation - they’re essentially turned into a single file for compilation. You could consider: use stitches inside knots, set a variable when you enter your knot, or build a database pattern. Try the discord too, I’m sure there’s people on there with other ideas!

On Thu, 30 May 2024 at 15:33, Shervin Mortazavi @.***> wrote:

Context:

We've broken up the structure of our ink story so that there is one ink file that includes a handful of other ink files which each represent a chapter in our game.

However, I've just noticed that when the ink unity integration compiles the file into a json, there's nowhere in the json data to track which knot belongs to which (sub) ink file so that I can figure out what chapter that knot belongs to.

Is my only option to rename all knots so that their corresponding chapter is included in the name? This isn't ideal as it solutes the already descriptive knot names. Is there another way to achieve what I'm trying to do?

Any help would be greatly appreciated.

— Reply to this email directly, view it on GitHub https://github.com/inkle/ink-unity-integration/issues/202, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJR3UAO4O2FHI6KZTTPM4DZE42CVAVCNFSM6AAAAABIRBW6I6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGMZDKOBTGI3TQNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

WolvenBard commented 3 months ago

Hey! Yeah I’m afraid you can’t do what you’re after - included ink files are really just for organisation - they’re essentially turned into a single file for compilation. You could consider: use stitches inside knots, set a variable when you enter your knot, or build a database pattern. Try the discord too, I’m sure there’s people on there with other ideas!

Tom! Thank you for such a quick reply. That's good to know, thank you.

I'll for sure checkout the discord. Do you have a reference to what you mean by database pattern? Would love to learn more about that.

One thought I just had: I might just mark all the include files as master files as well so that I can get json structures for them too. From there, I can reference each knot from the top level compiled master file and see if it belongs to any of the other chapter json structures, and cache that in my custom knot data structure. A bit tacky, but since this would only be initialization code that is run at edit time, I figure that could work.

Do you see any knock-ons/issues with marking include files also as master files? Especially any runtime performance issues?

WolvenBard commented 3 months ago

Oh I guess one problem would be that compilation would fail on any of the include files if they reference variables from other files :(

tomkail commented 3 months ago

Hmm I’ve never done that and it sounds hacky, but hey maybe it’ll work? Database pattern: https://www.patreon.com/posts/tips-and-tricks-18667641 Path references are variables so you can basically build a dictionary that maps knots to arbitrary data

On Thu, 30 May 2024 at 15:54, Shervin Mortazavi @.***> wrote:

Hey! Yeah I’m afraid you can’t do what you’re after - included ink files are really just for organisation - they’re essentially turned into a single file for compilation. You could consider: use stitches inside knots, set a variable when you enter your knot, or build a database pattern. Try the discord too, I’m sure there’s people on there with other ideas! … <#m-8223226290172261029>

Tom! Thank you for such a quick reply. That's good to know, thank you.

I'll for sure checkout the discord. Do you have a reference to what you mean by database pattern? Would love to learn more about that.

One thought I just had: I might just mark all the include files as master files as well so that I can get json structures for them too. From there, I can reference each knot from the top level compiled master file and see if it belongs to any of the other chapter json structures, and cache that in my custom knot data structure. A bit tacky, but since this would only be initialization code that is run at edit time, I figure that could work.

Do you see any knock-ons/issues with marking include files also as master files?

— Reply to this email directly, view it on GitHub https://github.com/inkle/ink-unity-integration/issues/202#issuecomment-2139799620, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJR3UDBXTBUJWZBUCP4HJTZE44RJAVCNFSM6AAAAABIRBW6I6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZZG44TSNRSGA . You are receiving this because you commented.Message ID: @.***>