pitbottom

Roody2d

Blueprint Format

Blueprints are stored in a similar format to the player’s inventory or pieces of procedurally generated buildings, a set of {key}:{value} pairs. This string of {key}:{value} is zlib compressed (level 9), given a 8-byte prefix with total length, then base-64 encoded. This base-64 string is given a short prefix.

This will be the example blueprint. It is a chest holding a punchcard with this pattern

This is its string

r2dbp0bJAIAAAAAAAB42m1R7W7DIAx8oUoLXbWs+9d1fYqpQg54CRohEZCtEeLdZ4emWqfxhzt/cGeTWm90fkkpGotSzw56o6SGCBR8T6oD36KWHXqkQJXXSCGjHxpo7CwVOHmJftJcJXJasHFtKfsAhfIbrZYmSOMiege2pP6TTes9Tk51GNhJtR5xvmFR3bCobphgdV58OoeWm3eZnA7BRDM4Vt2sunEe2e8io8Brqgt2iBLJPsgQQX1KNUwuFq9L7n4yDhHaPotdvdvXT/t6uxePd3LirxyPFDNZ7OFSRMrOtOnRBWriHQX0kTbL9duNKA/wLKmZI54IPLSHQ17Y2x07FnYq7JWZOV5zB2ad/cq/xa4KOdEfsBxeoB/JbWMnHD39Vv4BUrbR4Q==

The prefix is r2dbp0b. You can probably see the size has a lot of zeros: JAIAAAAAAAB. After base64 decoding and using the first 8 bits as the size to zlib decompresse with level Z_BEST_COMPRESSION, this is the string.

.rsv Format

Motivation

Roody:2d has infinite procedural generation, so the world is split up into 64x64 tile chunks.

Before version 0.7.0 alpha, the data for each chunk was saved into a .sac file. Each tile was 4 bytes, so the files were each 16 KB (4 * 64 * 64 + some metadata).

version 0.6.1 alpha
main menu background world

16K     c-1_-1.sac
16K     c-2_-1.sac
16K     c-3_-1.sac
16K     c0_-1.sac
16K     c1_-1.sac
16K     c2_-1.sac
16K     c3_-1.sac
4K      world.ssd

This was very simple to implement, but had 2 problems:

Inspiration

Context for what Roody:2d is and why it was created

Roody:2d

A factory puzzle-sandbox game