Video summary
Easy NPC Dialogue and Cutscenes in GameMaker
Main summary
Key takeaways
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)
-
Detect interaction input
- In the Player Step event, check for pressed input—specifically the Space bar via
keyboard_check_pressed.
- In the Player Step event, check for pressed input—specifically the Space bar via
-
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.
- Starts with
-
Provide per-NPC dialogue text
- Each NPC defines a
textvariable in its Create event (initially as a single string). - When interaction happens, the player reads
who is here.text.
- Each NPC defines a
-
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.
-
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.
- Uses a “currently talking” state:
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.
- Early prototype uses
-
Typewriter / progressive text reveal
- Uses
current_text_indexand draws a substring viastring_copy(...). - Notes that GameMaker strings are 1-indexed, so substring behavior depends on that.
- Resets
current_text_indexwhen starting a new dialogue line so the effect replays.
- Uses
-
Multiple lines of dialogue per NPC (array-based)
- Upgrades from a single
textstring to an array of strings. - Adds
current_text_line_numberto track which line is currently shown. - On Space:
- advances to the next line
- after the last line, dialogue ends and the textbox disappears
- Upgrades from a single
-
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:
checkXusing direction + distance (via lengthdir_x / equivalent sign/cosine approach)checkYusing 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
- input checks (