TeMPOraL / pure-cl-gamedev-libs

Pure Common Lisp libraries for game development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pure Common Lisp libraries for game development

A list of libraries written in pure Common Lisp - that is, with no foreign dependencies - that may be of particular interest to people developing games and similar interactive applications in Common Lisp.

You won’t find libraries for pushing pixels and playing sounds here (for now). Those tend to require interfacing with a native platform API (or a foreign, usually C, library abstracting native platform APIs). But there’s still plenty you can do without leaving the Lisp world.

The list

Unless otherwise stated in remarks, all libraries are available through the official Quicklisp distribution, as of 2017-11-24.

Image handling

LibraryDescriptionRemarksLicense
pngloadFast library for loading PNG images.Very fast, can use static-vectors for extra speed.MIT
png-readA PNG decoder for Common Lisp.Can be considered obsoleted by pngload, which is faster and supports all PNG chunks.BSD-style
opticlLoading, processing and saving PNG, JPEG, TIFF, PBM, PNM and GIF images.Designed for high performance.BSD 2-clause
imago (GitHub)Loading, saving, manipulating PNG, PNM, TGA and PCX images.Lisp LLGPL
ZPNGSaving PNG images.Does not load PNGs. Also, see limitations.?
gamebox-sprite-packerSpritesheet packer/unpacker. Generates additional metadata for packed sprite atlas.Loads only PNGs as input files. Atlas metadata can be automatically generated in a normalized format (useful for textures).MIT

Fonts and text

LibraryDescriptionRemarksLicense
sdfSigned Distance Field glyph atlas generator.Uses zpb-ttf for TTF processing and opticl for image output. Not available through Quicklisp.MIT
ZPB-TTFTTF parser.Does not render text, but can be used as a base for one (see e.g. cl-vectors).BSD-like

Vector graphics

LibraryDescriptionRemarksLicense
cl-vectors (GitHub)Pure CL anti-aliasing rasterizer for vector graphics.See documentation. Relatively low-level, does not render to bitmaps by itself. Compare with vecto.MIT
vectoSimplified interface to cl-vectors. Can render to PNG via ZPNG.BSD-like

OpenGL helpers

Related to OpenGL, but without foreign dependencies (including cl-opengl).

LibraryDescriptionRemarksLicense
VarjoLisp to GLSL Language Translator.You can use this to write GLSL shaders in Lisp :). Can be optionally used with rtg-math.BSD 2-clause
glsl-specSpecification of all functions and variables from GLSL as data (Lisp objects and JSON).Also contains glsl-symbols system, which exports GLSL names as Lisp symbols.Unlicense

Math

LibraryDescriptionRemarksLicense
gamebox-mathHigh-performance math library for games.Supports 3-component vectors, 4x4 matrices and quaternions, + operations related to them.MIT
3d-vectors (Github)A utility library implementing 2D, 3D, and 4D vector functionality.Suggested to be used in conjuction with 3d-matrices.Artistic 2.0
3d-matrices (Github)A utility library implementing 2x2, 3x3, 4x4, and NxN matrix functionality.Suggested to be used in conjunction with (and depends on) 3d-vectors.Artistic 2.0
rtg-mathLibrary providing vectors (2, 3 and 4-component), matrices (3x3, 4x4) and many math operations useful in games.Optional system rtg-math.vari provides GPU equivalents of rth-math operations for Varjo.BSD 2-clause
mathkitPure math functions useful for games, 3D, and GL in general.Built (partially?) on top of sb-cga. Contains functions for creating GL-style frustrum, projection and viewing matrices.MIT
sb-cga (Github)Computer graphics algebra library. Supports 3D vectors and 4x4 matrices.Portable, but with special optimizations for SBCL x86-64 that utilize SIMD (SSE2) instructions.MIT

Physics

LibraryFunctionalityRemarksLicense
SquirLCommon Lisp port of the Chipmunk 2d physics library.?

Memory and IO

LibraryDescriptionRemarksLicense
static-vectorsAllocate SIMPLE-ARRAY in static memory.Allows to explose Lisp-allocated buffers directly to foreign code. Useful for saving performance on moving bits beteween Lisp code and foreign dependencies.MIT
fast-ioFast octet-vector/stream IO.Improves performance of octet-vector and octet-stream IO. Can optionally use static-vectors for extra performance in passing buffered data to foreign code.NewBSD
bitioProcessing octet streams as bit streams.Supports (and recommends) working with fast-io.MIT
parsleyA toolset for parsing binary data formats.MIT
chipz (Github)Decompressing DEFLATE, ZLIB, GZIP, and BZIP2 data.MIT-like/BSD 3-clause
USerial (Github)General-purpose binary serialization/unserialization.See provided example (Github) of implementing a networking protocol for a game on top of USerial.MIT

Filesystem

LibraryDescriptionRemarksLicense

See also UIOP under Miscellaneous.

OS

LibraryDescriptionRemarksLicense

See also UIOP under Miscellaneous.

Architecture of game/engine

LibraryDescriptionRemarksLicense
gamebox-frame-managerManager for frames within a game loop.Wraps the code for doing fixed timestep updates. Also computes an interpolation coefficient useful for blending frames together.MIT
gamebox-ecsImplementation of Entity-Component-System pattern.MIT

Grids and tilesets

LibraryDescriptionRemarksLicense
grid-generators (Github)Generate points on arbitrary (and multidimensional) grids.Includes GRID-ITERATE, which allows to walk multidimensional grids with ITERATE. Not available through Quicklisp.Unlicense
gamebox-gridsCreate and manipulate tiles in a 2D grid.Currently supports 4 different square and 8 different hexagonal grids.MIT
cl-tiledLoader for tiled maps generated by Tiled, in TMX/TSX and JSON format.zlib

Randomness

LibraryDescriptionRemarksLicense
cl-variatesPortable Common Lisp Random Number Generation.Seems to have more capabilities than are exposed by current ASDF system. A bug?MIT Style
genieA simple wrapper around cl-variates to generate portably seedable pseudo-random numbers.MIT
cl-pcgPermuted congruential generators.MIT
gamebox-dgenA procedural dungeon generator.Generates random 2D dungeons with rooms, corridors and entry/exit points.MIT

Data structures

LibraryDescriptionRemarksLicense
doubly-linked-listDoubly-linked list with key/value nodes.MIT
cl-speedy-queueA portable, non-consing, optimized queue implementation.MIT
graph (Github)A simple graph data structure and algorithms.Additional systems GRAPH-JSON and GRAPH-DOT can be used for serialization and visualization.GPL 3.0

Algorithms

LibraryDescriptionRemarksLicense

Logging

LibraryDescriptionRemarksLicense
log4clPowerful logging framework, modeled after Log4J.Ships with Log4Slime, that lets one interact with library through log output in SLIME.Apache 2.0
simple-loggerSimple message logging system.MIT

Miscellaneous

LibraryDescriptionRemarksLicense
UIOPUtilities for portably handling things, including filesystems and OS specifics.Ships with recent ASDF, so you might already have it.MIT
track-best (Github)Track the N best of some series of items.A simple yet potentially useful building block for solving variety of problems.?

Motivation

Foreign libraries involve working with, and shipping, foreign dependencies. Doing that correctly, for all important platforms, is a quite tricky and painful process. It can be done (see e.g. this article by borodust), but the less foreign libraries you have to deliver, the less hassle you have. Moreover, the developent process itself can get tedious - even though projects like cl-autowrap do a great job at making things easier, you might still hit a library wrapper that will require you (or people you share your code with!) to have a whole LLVM environment to even build the ASDF system.

Unlike many popular dynamic languages, Common Lisp is actually performant, with implementations like SBCL generating code that can compete in speed with C (if properly written and instrumented). This opens the possibility of using pure Common Lisp code for interactive applications without taking a huge performance hit.

Contributing

If you see a library that a) can be useful in game development (or closely related areas), and b) is pure Common Lisp, i.e. has no foreign dependencies that need to be managed through FFI, feel free to include it and send a Pull Request.

Corrections to any information in this list are welcome too. I have only so much patience to check e.g. licenses :).

Also, I’m considering starting a section with usage examples for libraries that are meant to be used with typical foreign gamedev dependencies - e.g. how to use pngload to load a texture for cl-opengl. Any such examples are welcome too.

About

Pure Common Lisp libraries for game development