Sunday, June 21, 2015

Gash - Everything Serialized

Today I finished the ToFiles method of NextGenGraphics, essentially completing the back-end of Gash. All I had to do today was add code to serialize texts, miscellaneous already-binary data, tiles, and small tiles. The trickiest part was the small tiles because of the way they're all stored in one chunk. The routine for saving them looks something like:

  • Are there any small tiles cached? (This will be true if any have been requested or set.) If so,
    • Get the decompressed version of the small tiles' chunk.
    • Is it null? (DecompressChunk returns Nothing if that chunk is not present.) If so,
      • Create a new one, with appropriate length, and use it instead.
    • Figure out how many bytes an individual small tile takes.
    • For every cached small tile,
      • Serialize the small tile like any other image.
      • Figure out (from the length of small tiles) where it should go in the chunk.
      • Jam it into the main small tiles chunk, overwriting whatever was there.
    • Assign the chunk into the appropriate index of the raw chunks list.
Tomorrow I will test the new additions, then I'll be ready to start working on Gash proper.

No comments:

Post a Comment