Posted February 09, 2026 by sloejack
#devlog #gamedev #indiedev #mmo #quest-system #combat #procedural-generation #scripted-dialogue #react-native #threejs
Big milestone today: Riftwake now has scripted encounter sequences — interleaved dialogue and combat that play out like a cinematic scene during gameplay.
The Problem
The quest engine could handle dialogue and combat separately, but weaving them together was a nightmare. Four attempts at using React's useEffect hooks to trigger quest combat kept failing — React's rendering timing and state batching made reactive combat spawning unreliable. Combat would either never fire or fire at the wrong time.
The Solution
Threw out the reactive approach entirely. Combat now triggers imperatively during movement, using the same pattern that already worked for shift-day encounters. Two new async helpers — showDialogueAndWait and spawnCombatAndWait — let encounter sequences run top-to-bottom like a script. A Promise-based ref callback pattern makes dialogue and combat "awaitable" without any useEffect involvement.
First Scripted Sequence
The first use of the system is an ambush encounter during the prologue. The player is sent to investigate a disturbance. When they arrive:
The whole sequence — narrative setup, combat, character introduction, vehicle bestow — flows without any manual intervention from the player beyond dismissing dialogue and fighting.
Technical Bits
sequenceRunningRef gates all other combat paths (map encounters, click handlers) while a scripted sequence is running — prevents race conditions
blueprint type with vehicle data