finds.dev← search

// the find

cloudwu/aoi

★ 308 · C · updated Jun 2012

Area of Interest Library

A minimal C library for area-of-interest management, the classic MMO server problem of figuring out which entities can see which other entities as they move. Written by cloudwu (also known for skynet), it's meant to be embedded directly into a game server's update loop rather than used as a standalone service.

The API is refreshingly small: create, update (with watcher/marker/both/drop modes), and a callback-based message pump, so it's easy to wrap in any language via FFI. It takes a custom allocator per space, which matters for a library meant to sit inside a hot game-server loop where you want control over memory pooling. The watcher/marker split is the right abstraction for AOI (an entity can care about others without being visible itself, or vice versa), which a lot of naive AOI implementations get wrong.

The algorithm itself is only explained in a Chinese-language blog post linked from the README, so anyone who doesn't read Chinese is adopting this on faith. There's no license file, which is a real blocker for anyone trying to use this in a commercial game server. Last commit is from 2012, and test.c/testmap.c look like manual example programs, not an actual test suite, so there's no confidence the code still behaves correctly on modern compilers/platforms. No documentation on the underlying spatial structure (grid? tree?) or how to tune it for different world sizes and entity densities, which is exactly the kind of parameter you need to get right for this to perform at scale.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →