Repository navigation
feat: grid3d — an optional 3D grid view drawn by Strata - #78
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, andGrid3DViewdraws 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:Animatorslides 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; raisesUnavailablewith a plain reason where Strata can't run, so a game keeps its 2D view.strataextra (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 exceptGrid3DView.openruns without a GPU.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