# Module Dependencies in Luprex

Modules are listed in dependency order — each module's dependencies
all appear earlier in the list. Where a dependency comes only from
the `.cpp` file (not the `.hpp`), it is marked **(cpp-only)**.

- **eng-malloc** — custom deterministic memory allocator
- **enginewrapper** — pure C interface for driver/driven boundary
- **spookyv2** — hash function
- **util** → spookyv2
- **luastack** → util
- **luavector** → luastack
- **traceback** → luastack
- **debugcollector** → util
- **streambuffer** → eng-malloc, luastack, util
- **table** → luastack
- **keywords** → luastack, util(cpp-only)
- **pprint** → luastack, table(cpp-only), util(cpp-only)
- **json** → luastack, util
- **invocation** → enginewrapper, streambuffer
- **drivenengine** → enginewrapper, invocation, streambuffer, util, animqueue(cpp-only)
- **luasnap** → luastack, streambuffer
- **serializelua** → luastack, streambuffer
- **sched** → luastack, streambuffer
- **idalloc** → debugcollector, luastack, streambuffer
- **animqueue** → debugcollector, luastack, streambuffer, util
- **printbuffer** → debugcollector, invocation, streambuffer, util
- **source** → debugcollector, luastack, streambuffer, util, luasnap(cpp-only), table(cpp-only), traceback(cpp-only)
- **planemap** → luastack, util
- **http** → drivenengine, keywords, luastack, streambuffer, json(cpp-only), util(cpp-only)
- **world** → animqueue, debugcollector, http, idalloc, invocation, luasnap, luastack, planemap, printbuffer, pprint(cpp-only), sched, serializelua(cpp-only), source, streambuffer, table(cpp-only), traceback(cpp-only)
- **lpxclient** → drivenengine, invocation, printbuffer, util, world
- **lpxserver** → drivenengine, luastack, printbuffer, util, world
- **unit-testing** → drivenengine(cpp-only), streambuffer(cpp-only), traceback(cpp-only), world(cpp-only)

## Observations

### http depends on drivenengine (header-level)

`http.hpp` includes `drivenengine.hpp` because it uses
`SharedChannel` (defined in drivenengine). Meanwhile, `world`
depends on both `http` and `drivenengine`, but `drivenengine` no
longer depends on `world` (that circular dependency was broken).
The remaining concern is that `SharedChannel` is an I/O concept
from the driver boundary. Moving `SharedChannel` and `Channel`
into a smaller, lower-level header (perhaps `enginewrapper.hpp`
or a new `channel.hpp`) would let `http` drop its dependency on
`drivenengine` entirely.

### world is a mega-consumer

`world` depends on nearly every other module. This is expected for
the central game-state container, but it does make `world` hard to
test in isolation. The `world-*.cpp` split into multiple files
helps readability but doesn't reduce coupling.
