Video summary

Easy NPC Dialogue and Cutscenes in GameMaker

Main summary

Key takeaways

Technology

Overview

The video/tutorial demonstrates a simple, “easy” way to implement NPC dialogue text rendering and basic cutscene-style interaction in GameMaker. The speaker frames it as a lightweight “text engine” / “cutscene system” for dialogue, emphasizing that this is the simplest approach (not the only one).

Core interaction flow (feature breakdown)

  1. Detect interaction input

    • In the Player Step event, check for pressed input—specifically the Space bar via keyboard_check_pressed.
  2. Detect an NPC to talk to

    • Starts with instance_place(x, y, objNPC)-style collision testing.
    • The first version checks for exact overlap (player position vs. NPC collision).
    • Later improvement requires the NPC to be in front of the player, not just overlapping.
  3. Provide per-NPC dialogue text

    • Each NPC defines a text variable in its Create event (initially as a single string).
    • When interaction happens, the player reads who is here.text.
  4. Render dialogue UI

    • In Player Draw GUI, draw a textbox (white rectangle) and black dialogue text on top of the game view.
    • Rendering occurs when a state variable indicates the player is currently talking.
  5. Lock player movement during dialogue

    • Uses a “currently talking” state:
      • While dialogue is active, player movement input is blocked.
      • NPCs can still walk around; the player is frozen.
    • The textbox is hidden by toggling the talking state when the player presses Space again.

Improvements / enhancements demonstrated

  • Replace debug popups with in-game rendering

    • Early prototype uses show_message() as a placeholder.
    • Final version draws the UI in Draw GUI, which feels more production-ready.
  • Typewriter / progressive text reveal

    • Uses current_text_index and draws a substring via string_copy(...).
    • Notes that GameMaker strings are 1-indexed, so substring behavior depends on that.
    • Resets current_text_index when starting a new dialogue line so the effect replays.
  • Multiple lines of dialogue per NPC (array-based)

    • Upgrades from a single text string to an array of strings.
    • Adds current_text_line_number to track which line is currently shown.
    • On Space:
      • advances to the next line
      • after the last line, dialogue ends and the textbox disappears
  • NPC must be in front of the player

    • Uses trigonometry to calculate a point in front of the player (e.g., 32 pixels forward).
    • Computes:
      • checkX using direction + distance (via lengthdir_x / equivalent sign/cosine approach)
      • checkY using direction + distance (via lengthdir_y concept)
    • Then uses instance_place(checkX, checkY, objNPC) so interaction only triggers when the player is facing the NPC.

Suggested next steps (analysis / guidance)

The speaker suggests possible extensions beyond the tutorial:

  • Add an NPC portrait and/or speaker name to the dialogue UI.
  • Implement branching dialogue choices (e.g., yes/no, conditions like money). This is doable but requires additional engineering.
  • Add text formatting / fancy effects; because GameMaker text is limited, tools like Scribble are suggested.
  • Show a “press space to continue” prompt when typewriter text finishes scrolling.
  • Improve UI presentation by replacing the basic rectangle with better sprites or nine-slice UI elements.

Product / tutorial resources mentioned

  • A sample project is available.
  • The speaker says the GitHub repository link is in the video description.
  • Mentions other example games on Steam, specifically “Wizard X in the Lost Hat.”

Main speakers / sources

  • Michael (tutorial author/host): includes personal context like “Michael I like Wizards and dragons…”
  • GameMaker engine features/functions used as the underlying “source,” including:
    • input checks (keyboard_check_pressed)
    • collision detection (instance_place)
    • UI rendering (Draw GUI)
    • string functions (string_copy)
    • collision/movement-related logic and events

Original video