Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Complete Examples and Explanations

After learning so much, let’s look at real examples!

This chapter contains three progressively advanced examples:

📝 Writing Simple Dialogue

The simplest introductory example, suitable for:

  • Just starting to learn Mortar
  • Want to see results quickly
  • Creating a simple NPC dialogue

You’ll learn:

  • Basic nodes and text
  • Simple event binding
  • Basic choice jumping

📖 Creating Interactive Stories

A complete interactive short story, suitable for:

  • Want to create branching narratives
  • Need multiple choice layers
  • Making text adventure games

You’ll learn:

  • Complex choice structures
  • Conditional logic
  • Multiple ending design
  • String interpolation

🎮 Integrating with Your Game

Complete process of actual integration with game engines, suitable for:

  • Planning to use Mortar in projects
  • Need to understand JSON output
  • Want to implement your own parser

You’ll learn:

  • Compilation process
  • JSON structure parsing
  • Function call implementation
  • Runtime execution logic

We recommend reading in order, each example is a bit more complex than the previous one.

Ready? Start with Writing Simple Dialogue!