___ __ _____ __
/ _ \__ _____ / /_ / ___/__ ___ _ ___ ___/ /__ _ __
/ , _/ // (_-</ __/ / (_ / _ `/ ' \/ -_) _ / -_) |/ /
/_/|_|\_,_/___/\__/ \___/\_,_/_/_/_/\__/\_,_/\__/|___/
My curated list of cool/useful crates for game development. Crates often have strange names that are difficult to remember or do not make it obvious what they do. This repository is where I keep track of crates I've found that may be useful for certain problems or projects.
- Graphics
- Serialization
- Bits & Bytes
- Math & Geometry
- OS & Filesystem
- Strings
- Random Numbers
- Collections & Smart Pointers
- Miscellaneous
From windows to graphics contexts to images and fonts.
Crate | Description |
---|---|
ab_glyph | great for parsing and rasterizing opentype fonts and generating glyph sets for rendering |
crunch | space-efficient rectangle packer |
euc | simple and to-the-point software renderer, good for debugging or tooling, and also as studying material |
glow | nice OpenGL bindings/wrapper |
glsl | glsl 450/460 parser, which creates a syntax tree out of opengl shader code, very simple to use and navigate |
image | very full-featured image decoding library with support for lots of common formats |
lyon | very nice path tesselation library, for generating meshes from vector contours/paths |
msdf | generate multi-signed distance fields out of contours, good for generating + baking textures for fast, scalable fonts |
naga | great companion to wgpu, a shader parser that can parse and translate shaders. i've found it useful for evaluating shaders to automate some of the graphics code, as well as validating shaders' compatibility for engines/targets |
palette | provides type-correct color types and conversions (RGB, HSV, LAB, etc.) |
png | the image crate is very large, so for merely PNG support, using this directly makes for a faster compile and smaller dependency footprint |
wgpu | extremely powerful+sophisticated web-gpu cross platform rendering library, can output to metal/vulkan/dx/wasm, has its own shader language. the whole deal, very good |
winit | the de-factor windowing library for rust, quite good compared to what i've used in any other language. feels very much like using SDL |
Crate | Description |
---|---|
bincode | very fast + compact binary serializer, output is nearly same size as in-memory structs, great for simple inline serialization |
kdl | serializer for KDL a small, clean document language with xml-like semantics |
musli | fast, generic binary serialization in the vein of serde (similar to bincode) |
toml | a serializer for TOML files, used by Rust and a nice simple config format |
Sometimes you just gotta buncha bytes to manipulate.
Crate | Description |
---|---|
bitflags | generates flags enums with well-defined semantics and ergonomic end-user APIs |
bytemuck | library with traits/methods for making your structs readable/writable as byte arrays, useful for uploading them into graphics APIs like wgpu or opengl |
byteorder | convenience methods for encoding and decoding numbers in either big-endian or little-endian order (useful for binary encoders/decoders) |
memoffset | nice companion to bytemuck, allows you to get memory offsets of struct fields, useful for setting up vertex attributes or uniform buffers for graphics APIs |
zune-inflate | an extremely optimized inflate algorithm supporting whole buffer decompression |
Sometimes game objects just need to move and touch each other.
Crate | Description |
---|---|
approx | floating point approximation, great for those times where pesky f32's are deciding to be never quite equal. should be used in place of direct equality checking as often possible |
glam | my current favorite of the fast linear algebra (vectors, matrices, etc.) crates, designed for games/graphics, and has some SIMD-support |
mint | interoperability layer between math types of different graphics APIs |
Editors often need to interact with the OS in ways games don't.
Crate | Description |
---|---|
arboard | text/image clipboard support, useful for editors/etc. especially because of the image support |
rfd | rust file-dialogs, useful for native save/load/etc. for editors and tooling |
vfs | file system abstractions that allows using different filesystem implementations (eg. in-memory filesystem) |
camino | utf8 paths and pathbufs, great for those of us who never deal with non-string paths |
Rolling your own implementation of these things tends to go badly.
Crate | Description |
---|---|
compact_str | drop-in replacement for String that stores up to 24-byte strings on the stack |
heck | provide conversions between different naming cases (eg. snake_case to UpperCamelCase or SHOUTY_SNAKE_CASE ) |
strsim | various string similarity implementations (good for editor search fields, etc.) |
unicode_blocks | a list of all unicode blocks and provides some functions to search across them |
Games need random numbers, and Rust has many RNG crates. Here are some I like.
Crate | Description |
---|---|
fastrand | simple, fast random number generator that uses a 64-bit state |
rand_xoshiro | very nice random number generators, i specifically like SplitMix64 for being very simple, fast, and with a simple 64-bit state, but it has more sophisticated generators available as well |
Crate | Description |
---|---|
pared | projected shared pointers (eg. get a "shared" reference to a field of a struct in an Rc ) |
slotmap | provides 3 containers with persistent unique keys to access stored values (basically a hash-map that generates keys for you and has O(1) lookup time) |
Haven't figured out how to categorize this stuff yet, but some of these are extremely useful.
Crate | Description |
---|---|
ahash | very fast, non-cryptographically secure hashing algorithm |
gilrs | gamepad input library, really great API, controller layout/bindings/event handling, and haptic support |
strum | add lots of reflection to enums (names, count, enumerate over their values, etc.), great to remove boilerplate and prepare enums for in-editor dropdown support |
thiserror | my favorite library for creating error structs/enums with nice display implementations (reduces lots of boilerplate and can generate from-impls as well, etc.) |
ulid | i like this for guid generation, which uses the ulid specification to generate 128-bit unique IDs that have nice string representations |
bevy_ecs | A highly ergonomic and fast entity component system with support for parallel scheduling and event propagation |