The demo
Developed in C++ on the NYP graphics framework during 2017–2018, this academic technical demo explored systems that support interactive applications. The project combined spatial organisation, collision handling, scripting and developer tools. My main responsibilities were the quadtree and the Lua wrapper.
Dynamic spatial subdivision
Implemented a quadtree that subdivides the X/Z plane into four child regions. Nodes split when their entity count exceeds a threshold, subject to a depth limit, and merge when the population falls. Entities that leave their current node are queued for reinsertion, keeping the spatial structure responsive to movement.
Collision and visual debugging
Integrated collision checks within leaf entity lists, including projectile and laser handling. Added a visualisation of node boundaries, centres and links to contained entities, making subdivision and membership visible during development. A callback-based debug tool bound keys to lambdas through std::function, including a toggle for displaying the tree.
Template-based Lua bindings
Developed a C++/Lua wrapper using variadic templates, tuples and generated index sequences to adapt function arguments. A Lua closure dispatcher retrieves the registered wrapper, reads supported argument types from the Lua stack, invokes the C++ callable and returns its result. This explored how compile-time function signatures can support a shared binding mechanism.
Script-driven asset setup
Moved model-loading declarations from scene code into Lua scripts. Registering C++ functions with the scripting layer provided a way for scripts to drive asset setup, separating those declarations from the scene implementation.
What I learned
This project deepened my interest in algorithm design and introduced me to more involved template programming. Implementing the quadtree meant reasoning about recursive subdivision, moving entities and changing node populations. Building the Lua wrapper explored a different kind of abstraction: using templates to adapt function signatures and arguments across a language boundary.
Implementation limits
This was an academic exploration. Collision checks operate within individual leaves; objects overlapping neighbouring regions require additional handling. The Lua code contains experimental and unfinished paths. The project demonstrates the implementation and learning process, without claiming complete collision coverage, production readiness or measured performance gains.