Our R&D, 2011
A Kinect gesture engine for casting spells in the air.
ZEngine was a small C++ engine whose game idea was casting elemental spells by drawing shapes in the air in front of a Microsoft Kinect: a triangle for fire, a square for earth, a "w" for water and a "z" for air. We wrote the gesture recogniser, a tolerant matcher and a training mode that let anyone record their own versions of each shape.
- Owner
- Our own R&D
- Industry
- Games and natural user interfaces
- Services
- Gesture recognition, sensor input, real-time engine design
- Platforms
- Windows; C++ (Visual Studio 2010), SDL, OpenGL and the Kinect for Windows SDK beta
- Our role
- We designed and built the engine, its platform layer, the recogniser and the training mode.
The challenge
In 2011 the Kinect could track a person's skeleton in a living room, and the first Windows SDK put that in the hands of anyone with a PC. It gave us about twenty joint positions per tracked person, many times a second, with jitter. It did not give us "this person just drew a triangle".
Turning that stream into meaning meant solving four problems at once: deciding when a gesture starts and stops when there's no button to press; reducing noisy, continuous motion to a few symbols; matching those symbols tolerantly, because no two people draw a square the same way; and doing it fast enough that the spell felt immediate. Deep learning hadn't yet reached everyday gesture work, so we wrote the rules ourselves.
Our approach
We built on the direction-sequence idea from our 2005 mouse gesture recogniser and added what a camera needed: a way to mark the start and end of a stroke, more tolerance in matching, and examples recorded from real people instead of patterns written by hand. Skeleton tracking was Microsoft's; the recogniser, matcher and engine were ours.
What we built
Pen down, pen up, with the other hand
Air drawing has no button, so we used the other hand. While the left wrist was raised into the top third of the frame, the right wrist was drawing; lowering it ended the stroke and passed the points to the recogniser. Points were snapped to a 10-pixel grid, and a new point was kept only once the hand had moved more than one grid step, which threw away most of the jitter before recognition began.
From points to directions
Each pair of points became a heading, and each heading became one of eight compass directions, recorded only when it changed, so a long, wobbly stroke to the right became a single "east". The windows weren't equal: straight directions got a narrow 22.5° window and diagonals a wide one, so a stroke had to be close to straight before it counted as straight. A triangle in the air came out as something like north-east, south-east, west.
Matching with room for error
The matcher asked whether the pattern's directions appeared, in order, within what was drawn, and allowed up to three extra directions for the wobble at the start of a stroke or a corner taken in two steps. Patterns were tried longest first, so a square was checked before a simpler shape that might be hiding inside it.
A built-in training mode
Switch on record mode, draw each shape five times, and the engine wrote what it saw to the pattern file. The file ended up with nine variants of the square and seven of the triangle, started from different corners or drawn the other way round. We didn't try to write rules for every way a person might draw a triangle; we recorded people drawing triangles.
A sensor you can swap
The engine was built on interfaces for windows, rendering and pointing devices, with Windows implementations created through a factory. The Kinect and the mouse were two implementations of the same point-input device, so the recogniser never knew which it was listening to, and we could develop and test at a desk without standing in front of a camera all day.
Architecture
- Kinect or mouseA stream of points with timestamps
- StrokeLeft hand raised: right hand is drawing
- DirectionsPoints become eight compass directions
- MatchIn order, with up to three extra directions
- SpellFire, earth, water or air
Results
- 4spells: fire, earth, water and air
- 5recordings per shape in training mode
- 3extra directions tolerated in each match
Under the hood
Perception from rules and recorded examples, before deep learning.
- C++
- Kinect for Windows SDK
- Skeleton tracking
- SDL
- OpenGL
- Platform abstraction
- Direction quantisation
- Template matching
What it taught us
The record mode was really a data-collection tool: rather than guess what a gesture looks like, gather real examples and let them define it. That's how we approach computer vision and speech now, except the examples train a model instead of filling a text file. Making a system teachable by people who didn't write it, and abstracting the sensor so the logic can be tested without the hardware, are habits we use on every device project.
Gestures and sensors later led to wearables. Our Edge AI smart-glasses R&D prototype runs Gemma 4 E2B on the device paired with Ray-Ban Meta glasses, through Google AI Edge LiteRT-LM, with no cloud. It's a very different machine asking the same question: what can a device understand about the person in front of it, quickly and locally? See wearables and Edge AI.
What we'd do now
Principles we'd carry into any sensor-driven product.
- Make the system teachable. If the people using it can record examples, the system adapts to them rather than the other way round.
- Abstract the sensor. Today's equivalent is a recorded sensor stream that replays in tests, so the logic can be developed and checked without the hardware in the room.
- Keep thresholds in configuration. Grid size, tolerance and timing belong in settings, so tuning on site needs no rebuild.
- Pick rules or learning on evidence. A tolerant matcher with recorded examples was right for four spells. With dozens of gestures or many users, we'd train a small model and run it on the device.
Questions
Did this use machine learning?
No. Skeleton tracking came from Microsoft's Kinect SDK. Our recogniser was rule-based, matching direction sequences against shapes recorded from real people.
How did it know when a gesture started?
Raising the left hand into the top third of the frame meant the right hand was drawing. Lowering it ended the stroke.
Could it be trained with new gestures?
Yes. In record mode you drew a shape five times and the engine saved those versions to its pattern file. No code changes were needed.
Related
The services behind this work, and more stories like it.
Services
Case studies
Our R&D, 2005Gestures as compass directions. A C++ mouse gesture recogniser that turned strokes into eight directions and matched them against a library of shapes.
Our R&D, 2012A lap timer that watches the track. One camera, frame differencing and colour to time RC cars and speak each lap aloud.
Knowby R&DHands-free help, with no cloud. An R&D prototype: Gemma 4 E2B running on the phone paired with Ray-Ban Meta glasses, reading work instructions aloud.
Bring us the hard problem.
A 45-minute discovery call with the engineer who'll build it.