15 Mar 2022

SquidLib!

SquidLib, that behemoth of a roguelike library

SquidLib

It’s a library originally intended for roguelike and other strategy games.

It has become much, much more. In addition to standard code for strategy games, such as top-down field-of-view, line-drawing, path-finding, and so on, it has code specialized for roguelikes (that is, dungeon-crawling RPG-like games, which used to primarily use text-based interfaces). This code includes a lot of dungeon and cave generation code, as well as support for rendering grids of colorful (animated) glyphs efficiently using libGDX. There’s a fair amount of math-y code, such as random number generators of various types, some common distributions for random number sampling, data structures for storing groups of points efficiently and altering them in bulk, and more. There’s actually a lot of data structures here, maybe too many, but they all seem to find uses – there’s indexed maps and sets in OrderedMap and OrderedSet, and those have some nice and uncommon traits. There’s a monstrous and gigantic file that has over 1000 predefined color instances. There’s randomized flood-fill code for creating uneven pools or other areas in a map. There’s some world map generation code, able to get the elevation, average moisture, average temperature, and a biome that combines all of those, for any given point on a globe.

So in general, it does a lot of things. Many users will only want to copy out the parts of SquidLib that they want, which is a perfectly legitimate usage of the library. Or, you could swallow the library whole and use all of it; it’s up to you!