Skip to content

feat: grid3d — an optional 3D grid view drawn by Strata - #78

Merged
dmccoystephenson merged 2 commits into
mainfrom
feat/grid3d
Nov 20, 2026
Merged

dmccoystephenson merged 2 commits into
mainfrom
feat/grid3d

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

A new optional subpackage, preponderous.graphik.grid3d, draws a grid game's board in 3D with Strata. Games describe the board once, report their pieces each tick, and Grid3DView draws them, with pieces sliding smoothly between cells. Version 0.4.0.

Why

Several games built on graphik are grids (ophidian, apex, Tic-Tak-Toe). One shared 3D grid view lets each of them offer a 3D window without writing its own renderer, and a future graphik release reaches all of them through a pin bump.

What changed

  • grid3d/scene.py: a plain-Python scene description (shapes, labels, panels, lights, camera); imports neither Strata nor pygame.
  • grid3d/board.py: GridBoard, Theme, PieceStyle, Piece, fitCamera: checkered tiles, a frame, pieces on cells, chained pieces bridged.
  • grid3d/animate.py: Animator slides pieces between cells over one tick; jumps for new pieces, opt-outs, moves of more than a cell, reduced motion, and snap ticks (setPieces(..., snap=True)).
  • grid3d/view.py: Grid3DView.open(...) draws with Strata's Python binding; raises Unavailable with a plain reason where Strata can't run, so a game keeps its 2D view.
  • strata extra (Strata 0.8.0 binding); README section with an example; version 0.4.0.

How it was tested

  • pytest: 216 passed with the Strata binding on the path, including a golden image of a rendered board; everything except Grid3DView.open runs without a GPU.
  • Used by the 3D views of ophidian, apex and Tic-Tak-Toe (their own suites pass against it).

Player-visible changes

None for games that don't import grid3d; the 2D API is unchanged.

drafted by Claude on behalf of Daniel Stephenson

🤖 Generated with Claude Code

dmccoystephenson and others added 2 commits November 19, 2026 20:04
A new subpackage, preponderous.graphik.grid3d, draws a grid game's board in
3D with Strata: checkered tiles and a frame, pieces standing on cells, and a
camera fitted to the board. A game describes the board once (GridBoard and a
Theme of PieceStyles), reports its pieces every tick (Piece, with an id that
stays the same from tick to tick), and Grid3DView draws them.

Pieces slide between cells: Animator moves each piece from where it was
drawn to its new cell over one tick, so motion is smooth at any frame rate
while the game still steps a whole cell per tick. A piece jumps instead when
it is new, opts out (interpolate=False), moves further than a cell (a
teleport or wrap-around; the step is measured cell to cell, so a tick that
comes before the last slide finished still slides), when reducedMotion is
on, or when a tick is a snap (setPieces(..., snap=True), for a restart or a
new level). Chained pieces (a snake's body) are bridged where they are
orthogonal neighbours.

Everything but Grid3DView.open is plain Python and is tested without a GPU;
importing grid3d loads neither Strata nor pygame. The Strata binding is the
optional `strata` extra, and Grid3DView.open raises Unavailable with a plain
reason where Strata can't run (no binding, no library for the system, no
window), so a game can keep its 2D view. Linux and Windows desktops only.
The README gains a section on the view, with an example.

drafted by Claude on behalf of Daniel Stephenson

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYNeuoCqxFpUXrFhxnTg89
The version moves to 0.4.0 and the README's install lines name its tag.
grid3d loads Strata 0.8.0, whose window fullscreen lets games offer F11 in
their 3D windows, and the strata extra installs the 0.8.0 binding.

drafted by Claude on behalf of Daniel Stephenson

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYNeuoCqxFpUXrFhxnTg89
@dmccoystephenson
dmccoystephenson merged commit e938f54 into main Nov 20, 2026
6 checks passed
@dmccoystephenson
dmccoystephenson deleted the feat/grid3d branch November 20, 2026 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant