How would you go about implementing story in a game?

To give a little more context - I’m developing a short point and click adventure game with different rooms and characters one can interact with. I’m not sure how I should implement the story and player interaction.

What comes to mind is creating a story.lua with a table full of lines that the characters say and choose according to how far the player progressed in the (linear) story. However, I’m pretty lost on how to do this and if there is a better approach.

If you have implemented a story into your games before, how did you do it? Examples, repos or other resources would be cool.

Thanks in advance ^^

Check out these projects for some ideas.

They may be too advanced for you currently but do not be discouraged, keep learning and trying!


I can also add here my Defork - a module to integrate Twine (easy tool to create branching dialogs) into Defold game and also display them (using RichText or Defold-Printer (example)) :wink:

I’m also using a custom script and story modules containing cutscenes and quests, it’s game specific, so I didn’t make something such generic, however, if you will need some help or tips, feel free to ask :wink:

I think, the general important advice is to keep trying to encapsulate as much as you can - so if you decide to have dialogs - keep them in a separate module/file and refer to them by some generic hashes - this way you could easily change them (or translate in the future) in that file or modify the flow/branches/options in the separate file that refers to those using hashes. If you decide to have cutscenes, divide them into small scenes and put into separate modules too.

If you plan to work in a group it would be good to have them in some other file, that people could access without Defold - Twine, Google sheets or Excel. And use the same rule - hash to index rows and modify values in each field of each row, then convert it to Lua table and access them by hashes. This is an example of what I’m talking about: Library and pipeline for game localization


I’d also add my progression module from Crit to this list. It’s a coroutine library that we used with Interrogation to piece the game’s story together. It handles the “high-level choreography” of the game.

Here’s some example code: