mhgolkar / Arrow

Game Narrative Design Tool
https://mhgolkar.github.io/Arrow/
MIT License
905 stars 42 forks source link

Feature: Array variable type #55

Closed frigvid closed 10 months ago

frigvid commented 10 months ago

Given that you've mentioned in #52 that you try to avoid adding gameplay- or runtime-specific functionality, I suspect this may be the same. However, I'd still like to ask if array variables could be added. It's mostly for more complex logic chains, because it'd significantly reduce the amount of nodes and variables I'd need to use, but I understand if you don't want to add such a thing.

Also, thank you for the help in the other issues.

e: Though, given that the description mentions that Arrow is also for "interactive nonlinear storytelling," I hope it's within scope enough, because that's what I'm testing around for. :)

mhgolkar commented 10 months ago

Yes here too, that is part of the rational behind not adding Arrays, besides keeping the runtime implementation [too] easy. But I also have never found them needed enough (in the narrative design context) to go into the hassle of implementing them and accept what comes after. You should consider that it is not about just adding array variables. It is also about all the new nodes, UI, and functionalities to be implemented as well, so they are going to be really working and useful. Many times, you can handle things (even easier) by overusing (e.g. str as array-like) variables, or when some kind of encapsulation is needed Character tags for arbitrary entities as characters. For example _hero_inventory being a character itself and tags representing the items. I see character tags more as nice general-purpose dictionaries/maps. Array (-variable) may be a welcome feature (specially if someone comes forward with a perfect PR); but until a real universal need is justifying it, I think we should focus on much more needed and long-awaited matters.

frigvid commented 10 months ago

That's fair, I expected as much. Amusingly enough, I've also gone the route of having a Character act as storage in my test setup. Literally just a regular storage chest. Though I've not been able to think of a good way to present the user with the contents of the "inventory," so to speak. At least not in a less or not cumbersome way. Any ideas? You don't need to answer, of course, it's just if you have time.

mhgolkar commented 10 months ago

Character tags can be injected/printed in the main content nodes using the {Character.tag_name} placeholders, similar to the {variable} placeholders. Aside from that, other ways to represent them, go into the game-play/runtime -specific category. For example, our official HTML-JS runtime provides some basic helpers exposing them as attributes. In a full-fledged runtime or game, you may listen for changes in your character's tags map/dictionary and update a visual representation of your inventory according to the changes in that. It really depends on what kind of game you're going to make at the end of the day.

Also take a look at Tag-Edit, Tag-Match and Tag-Pass nodes to update, check and branch on your inventory items.