DYSTOPIANPIXEL
PHASELOCK / NEXTBASIC / DYSTOPIAN PIXEL

About this tutorial

Build a top-down phase puzzle game, one hardware-tested development stage at a time.

MILO in the Blue and Amber Phase Grid
Concept artwork · PHASELOCK development tutorial through v0.13.

PHASELOCK is an original top-down, single-screen puzzle game being developed for the ZX Spectrum Next in NextBASIC. The central mechanic is a global Blue/Amber phase state: movement, floor tiles, barriers and later puzzle objects can react to the currently active phase.

This tutorial does not attempt to design the entire finished game in advance. Instead, it follows the actual development process. Each major stage is added only after the architecture or behaviour has been agreed and, where hardware behaviour matters, tested on a real ZX Spectrum Next.

The current document covers the major stages completed through v0.13: the game foundations, the player character and native sprite assets, one-press tile movement, the lean/travel/recover animation, the logical 20×16 tile grid, permanent-wall collision, the first working Blue/Amber phase-floor rules, and scoring/backtracking with visit-generation tracking. Versioned test builds are preserved separately and mapped to the tutorial stages rather than being treated as chapters in their own right.

Before you begin — what you need

This tutorial assumes that the reader already has a small amount of general BASIC experience and access to an environment capable of running ZX Spectrum Next software. It is intended to teach how PHASELOCK is being designed and implemented, rather than to teach programming from first principles.

RequirementWhat the tutorial assumes
ZX Spectrum Next environmentAccess to a real ZX Spectrum Next is ideal. A sufficiently compatible emulator may also be used for following the tutorial, provided it supports NextBASIC, NextZXOS and the Spectrum Next hardware features used by the project, including hardware sprites. Real hardware remains the reference for final behaviour and timing checks.
Basic BASIC knowledgeYou should be comfortable with variables, IF/THEN decisions, FOR/NEXT and REPEAT/UNTIL loops, simple arithmetic, arrays and calling procedures. The tutorial explains the PHASELOCK-specific architecture, but does not teach these BASIC fundamentals from scratch.
Basic NextBASIC useYou should know how to start NextBASIC, enter or load a program, run it, stop it and save or replace files. No prior knowledge of Spectrum Next sprites, palettes or game architecture is required; those concepts are introduced as they become relevant.
File accessYou need to be able to copy the supplied stage files to an SD card or emulator filesystem and preserve the project folders used by the examples, particularly ASSETS/GRAPHICS/SPRITES.
Stage packagesFor the closest reproduction of each completed stage, use the definitive reference ZIP identified in the tutorial. Historical builds are useful for studying development decisions but are not prerequisites for following the main tutorial path.
Plain-text source conversionWhere a stage is supplied as .TXT rather than as a native tokenised .BAS, you should be able to use the NextZXOS .TXT2BAS dot command. The tutorial gives the required command when this applies.
InputThe development builds currently use Q, A, O and P for movement, so a keyboard or equivalent mapped input is required for these stages.

How future chapters will be added

At the completion of every major development stage, this tutorial should be extended with a new numbered chapter. Each chapter should record the same core information so that the document remains useful both as a learning resource and as a technical history of the project.

  • The goal of the stage and why it is needed.
  • The design decisions made before coding.

• Any stage-specific implementation assumptions or dependencies.

  • The relevant NextBASIC architecture and important source code.
  • What was tested on real hardware and what the observed result was.
  • Any problems or discarded approaches that teach a useful lesson.
  • The stable baseline created for the next stage.

Tutorial stages and development builds

A tutorial stage represents a meaningful concept that the reader needs to understand. A development build records an iteration of the real project. Several builds may therefore belong to one tutorial stage.

The tutorial should use one definitive reference build for each implementation stage. Earlier builds remain available as historical snapshots and are discussed only when they explain an important design or debugging decision.

Tutorial stageBuild historyDefinitive reference
Stage 1 — Game modelDesign decisionsNo programme build
Stage 2 — Movement languageSprite-design iterationsAccepted V8_DOTS MILO artwork
Stage 3 — Native sprite assetsAsset conversion/refinementAccepted PHASELOCK_PLAYER.SPR / .PAL
Stage 4 — One-press tile controlv0.1–v0.6PHASELOCK_STAGE_V06.zip
Stage 5 — Lean/travel/recoverv0.7–v0.9PHASELOCK_STAGE_V09.zip
Stage 6 — Logical 20×16 gridv0.10PHASELOCK_STAGE_V010.zip
Stage 7 — Permanent wallsv0.11PHASELOCK_STAGE_V011_FINAL.zip
Stage 8 — Blue/Amber phase tilesv0.12PHASELOCK_STAGE_V012_FINAL.zip
Stage 9 — Scoring and backtrackingv0.13PHASELOCK_STAGE_V013_FINAL.zip

Contents

• Before you begin — reader prerequisites

• Project conventions and implementation assumptions

  • Stage 1 — Define the PHASELOCK game model
  • Stage 2 — Choose a player movement language that suits 16×16 sprites
  • Stage 3 — Build the native player .SPR and .PAL assets
  • Stage 4 — Establish one-press, one-tile player control
  • Stage 5 — Add lean, travel and recovery animation
  • Stage 6 — Separate logical tile position from sprite position

• Stage 7 — Add permanent walls and map collision

• Stage 8 — Add Blue/Amber phase tiles

• Stage 9 — Add scoring and backtracking

  • Current baseline and next development stage
  • Appendix A — Current v0.13 NextBASIC listing
  • Appendix B — Development build history and tutorial mapping

Tutorial topics