Video Game Design and Coding · PLECK lesson

PLECK lesson 126 · suggested week 26, day 1

Represent a room as a grid

Objective. Map cell coordinates to pixel positions.

Godot Engine Standard desktop editor 4.7.2-stable, GDScript (Godot 4), Compatibility renderer. Headless Godot 4.7.2.stable.official.ed1daf0bf passed 106 assertions on the supplied scaffolds, including malformed JSON saves. Audio used the Dummy driver and a synthetic WAV, not a speaker. The visual editor, browser export, and signed-in submission were not tested. The desk still does not run a student's own upload.

About 55 minutes. The due date is chosen by a parent.

Seeded randomness, grids and guaranteed playable routes

Suggested pace: Recall and predict 5 min; Read instruction and scaffold 12 min; Build or design the assigned artifact 25 min; Run acceptance tests 8 min; Explain and checkpoint 5 min.

Materials: Paper and pencil or a private text document, Local course folder and prior checkpoint, No paid assets or public account required.

Comes after VGC-L125.

A grid turns a room into indexed data. C-GRID uses six rows and eight columns, with zero for open and one for blocked. The array is accessed as cells[y][x], not cells[x][y]. At forty pixels per cell, the center of cell (3,2) is (140,100). Rows increase downward. Draw the data first, then render it. The grid’s visible rectangles are not colliders until you explicitly create matching physics geometry.

Worked example

A four-cell corridor reserved before random walls guarantees a required path. Other open cells may still be isolated, so the guarantee must be stated narrowly.

Represent a room as a grid — evidence task

  1. 1. Draw a six-row/eight-column map and label three cell centers.
  2. 2. Compute centers for (0,0), (3,2) and (7,5).

Deliverable. Grid worksheet and coordinate calculations.

Acceptance checks

Understanding question. Why add half a cell when placing an actor at a cell center?

Submit readable text or photos/scans of each numbered design page. Audio explanation may supplement a diagram or text, not replace requested artifacts.

If this is still shaky. Use the fixed 8 by 6 grid in C-GRID. Keep the guaranteed top-row/right-column path empty before adding any random walls. Start with the first assigned task and re-run its acceptance test before adding the remaining feature.

Optional extra. Compare three integer seeds while checking the same route invariant. Document one changed parameter, your prediction, and the observed effect; optional, not required for completion.

Name ____________________ Date ____________________