PackVector file format and library

Penned on the 24th day of July, 2019. It was Wednesday.


PackVector format reference library – a scalable vector graphics binary format

In 2019, Arqadium has overlooked the development of an unannounced video game title that relies heavily on vector-based artwork and graphics. Because the SVG file format is a web-centric XML (text-based) schema, it is notoriously complex to sift through in development, is inherently subpar for computers to parse, and suffers in storage without a layer of compression applied.

Rather than GZip the data, we attempted to kill two birds with one stone by creating what we call the “PackVector format” (file extension .pv). This is a binary format that not only greatly simplifies the representation of vector imagery, but takes manual control to compact the information as tightly as possible. This is achieved using an 8-bit sentinel for every shape that contains flags marking which metadata is and isn’t present. If a flag is off, the data is discluded from the file entirely. The format also uses a table of gradients, so shapes that have the same gradient will reference the data only once. Paths are represented as an array of Beziér curves, stored as 32-bit floating point numbers.

In a vacuum, vector artwork is notorious for being featherlight compared to raster. However, for complex drawings like those in video games, our experience has shown us that the detail can quickly add up — into the megabytes for a single file, even. Specialising the compression of this data into a custom bitcode provides far greater compression potential than can be offered by even the best general-purpose lossless algorithms, in much the same fashion as native machine code fed to your CPU. Since our games are generally made with the use of lower-level programming, we foresee considerable savings in download and shipment sizes with assets stored this way.