Handmade Hero»Forums»Code
3 posts
None
Z cleanup - ChunkPositionFromTilePosition bug
I believe one of the causes of the missing entities seen at the end of Day 71 is a bug in ChunkPositionFromTilePosition.

When this function computes the hadamard product, it's using chunkDimInMeters instead of tileSideInMeters & tileDepthInMeters. Since this function is only used currently by the world gen code (which is still operating on the concept of tiles), the abs values passed in are counts of tiles. By multiplying by chunkDim, I believe we're ending up with a single entity per chunk, and they're spread thinly across the world.
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
Z cleanup - ChunkPositionFromTilePosition bug
Cool! I haven't looked at it yet, since I'm waiting for tonight's stream, but that sounds reasonable. We'll be stepping through that stuff in the debugger so we should be able to spot it quickly.

- Casey