bencbartlett / screeps-packrat

Lightning-fast and memory-efficient serialization of Screeps IDs, Coords, and RoomPositions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Try this with E90S90

GDennis opened this issue · comments

const num = (quadrant << 12 | (x << 6) | y) + 65;

6 Bits are not enough. Try E90S90. 6 Bits is just enough for 0 to 63.

I suggest using __parsed of RoomPosition. It already encodes world xy and room xy with 8 bits each including the quadrant. 8 Bit is enough for -128 to 127, it includes all rooms of shard0, you can't strip any bit away without information loss.
I suggest to use __parsed >>> 16 directly to encode a roomName.