Add the terrain store: region grids and tile cache - #55
Conversation
Coverage Report for CI Build 34997107256Coverage increased (+0.8%) to 98.593%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
d974f1c to
1ea3053
Compare
KurbyDoo
left a comment
There was a problem hiding this comment.
I changed some of the specifications of the original tickets since they don't really match what I'm thinking anymore, could you update this PR accordingly? Thanks
There was a problem hiding this comment.
structure looks good overall!
please remove all comments that are not nessasary, it makes the code hard to read and confusing / misleading for future editors. ideally behaviour should be obvious from variable and function names and comments should only be used for when the reason for doing something is not clear. comments should also not reference issue numbers or talk about things that do not exist in the codebase / are not implemented yet
also add the coverage file to gitignore thanks
Summary
Implements the Terrain Store (#31) — all six sub-tickets in one PR, since
the two halves are small and share a module.
RegionGrids— scratch space for one region. Holds a sum grid and aweight grid, accumulates each window as
value × weightandweight,and divides one by the other in
heights(). Written to only by thesampler (Clean every window and add the results into the region grids #35).
TileCache— finished tiles by seed, LRU-evicted at a fixedcapacity. Touched only by generation orchestration (Generation Orchestration #36).
Adds numpy (2.5.2) as the project's first runtime dependency, per
CONTRIBUTING:
pyproject.tomlanduv.lockare both committed.Validation
scripts/quality-check.shpasses locally/testcommands were run and are passing (e.g./test gpu)27 tests in
tests/test_store.py, covering every assertion listed in#40–#45. The overlap test uses the worked 1×6 example from #31 directly.
Full suite is 68 passed.
Checklist
Additional Comments
Two decisions worth a second opinion:
putcopies the incoming array so the generator can reuse its buffer,but
gethands back the cache's own grid rather than a copy — copyingon every read would undo the point of caching. Callers should treat a
returned tile as read-only. Happy to change this if you would rather it
be defensive on both sides.
sub-ticket, so it is not implemented here.
Closes #40, #41, #42, #43, #44, #45