Below is the TypeScript implementation of the voxel memory arena and chunk manager, along with a headless Node.js test script. The code uses a flat Uint32Array per chunk and a VoxelMath utility class that encapsulates all bitwise operations for the 32-bit voxel bitmask. Implementation (voxel_engine.ts) typescript * Voxel Memory Arena / Chunk Manager * * Each chunk is an 8x8x8 grid (512 voxels) stored in a single Uint32Array(512). * Spatial indexing: x + (y * 8) + (z * 64) * * 32-bit bitmask layout: * bit 0 : filled flag (1 = solid, 0 = empty) * bits 1-4 : point type (0-15) * bits 5-16 : texture ID (0-4095) * bits 17-23 : visible faces bitmask (up to 7 faces) * bits 24-31 : unused (reserved for future use) */ / Constants export const CHUNK_SIZE = 8; export const VOXELS_PER_CHUNK = CHUNK_SIZE * CHUNK_SIZE * CHUNK_SIZE; // 512 / Bit positions and masks for the voxel data const BIT_FILLED = 0; const BITS_POINT_TYPE = 1; const BITS_TEXTURE_ID = 5; const BITS_VISIBLE_FACES = 17; const MASK_FILLED = 0x1; const MASK_POINT_TYPE = 0xF; // 4 bits const MASK_TEXTURE_ID = 0xFFF; // 12 bits const MASK_VISIBLE_FACES = 0x7F; // 7 bits .. == How to Run the Test Save the implementation code as voxel_engine.ts. Save the test code as test_voxel.ts. Install TypeScript and ts-node if not already present: bash npm install -g typescript ts-node Run the test: bash ts-node test_voxel.ts The test will output a series of checkmarks and a final success message if all assertions pass. This implementation provides: A flat memory model with one Uint32Array per chunk. Efficient bitwise packing for all voxel properties via the VoxelMath class. A Chunk class that handles local coordinate indexing and voxel access. A ChunkManager (the voxel memory arena) for managing multiple chunks. A headless test that verifies the bitmask operations and chunk functionality.