nsensfel / tonkadur

Narrative scripting/programming tool. Write stories in your favorite editor using a feature-rich language, compile them into a very small and simple language to easily integrate them into your game.
https://tonkadur.of.tacticians.online
Apache License 2.0
2 stars 0 forks source link

Event input handling #13

Open nsensfel opened 4 years ago

nsensfel commented 4 years ago

In games where the narrative isn't what drives the gameplay, the narrative is likely going to be called upon following an event occurring from some other mechanism (e.g. "attacked monster A"). Tonkadur makes scripts that expect its execution to continue until the game engine has to be prompted for an input (prompt_string, prompt_integer, player_choice). Technically, the event instruction can be seen as a way to give back control to the game engine, since it expects the game engine to perform something before continuing. However, games not driven by the narrative are likely to want to have a narrative script running some initialization, keep an internal state, then react to incoming events. To handle this, player_choice can be used, with the events corresponding to labels. However, player_choice labels are text, whereas coding the interpreter to handle incoming events would make the use of string labels more appropriate. Furthermore, these "choices" would not be expected to be seen by the player, making the interpreter more tedious to implement (special text effect that hides a choice, most likely). To make narratives that can be driven, instead of having the narrative being the gameplay orchestrator, player_choice should be modified.

(event_input
   (
      <player_choice_list>?
   )
   <event_list>*
)

TBD: parameter passing for events. For example: "attacked monster A". "attacked monster" is likely to be static, but "A" is an identifier, which is something the narrative needs to be able to retrieve.

nsensfel commented 3 years ago
nsensfel commented 3 years ago

Globally defined events are still not implemented, but the rest has been added in https://github.com/nsensfel/tonkadur/commit/1616f97c8badfcaf0af5f6b8a7c9ebfb5dc44e77.