kitsonlow.
All work/quadtree-lua-demoPROJECT_04
Browse projects
C++ & ALGORITHMSTechnical demo

Quadtree & Lua Systems Demo.

A two-person technical demo built for an Advanced Game Development assignment. I owned the quadtree and Lua wrapper, exploring spatial algorithms and template-based function binding.

Quadtree & Lua programmer · Team of two
C++QUADTREELUATEMPLATES
PROJECT_04 / QUADTREE_LUA_DEMOFeb 2018

NYP · AGDev · 2017–2018

C++ & ALGORITHMS

Quadtree & Lua Systems Demo

Read the project
Quadtree and Lua Systems Demo typography with a recursively divided spatial diagram
Role
Team
Stack
01 /

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.

02 /

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.

03 /

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.

04 /

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.

05 /

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.

06 /

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.

07 /

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.

KEEP EXPLORING

The next project.

05 / UNITY & GAMEPLAY TOOLS

Investigator of Things

An IGCC 2018 first runner-up: a cyberpunk murder investigation built by a Singaporean–Finnish team.