The engine's first outing
TEH ROBOT is Limp Ninja's entry in the TUM 2003 console compo. It is the earliest demo on the
“pompom” engine that Harry Boterham, miChera, Polar Bear Alert and Bi-Won were later built on. The parts are
already in place: an Xbox executable with Python 2.2.1 inside it (built 21 December 2003), a script
(script/pompom.py) that wires C++ effect nodes into a graph, 3ds Max scenes run through
Cg-generated vertex shaders, and a joypad performance recorded against the music.
It is two minutes long. A talking commander's head, the robot under a TEH ROBOT overlay, a jittering WATCH OUT poster, a walk down a corridor, goldfish, and a ragdoll tumbling in a dryer. Then the screen turns red, because the script has run out of jobs.
- Linked
- 28 Dec 2003
- Xbox SDK
- XDK 5659
- Demo length
- 2:03.5
- Joypad presses
- 27 A · 88 B
The show, end to end
- BootGreen screen for 4.3 s while
default.xbestarts Python, runspompom.pyand loads the five.pckscenes and four pictures. - First clearOne blue frame. The main loop clears to (0, 0, 1) once, before its first frame.
- Seven jobsWith
wma\deun.wmaplaying, the scheduler runs seven jobs in slotSI_Afrom 0 to 123.5 s. Each one is a node graph of Scene, Overlay, Add and Distort. - RedAfter every frame the loop clears to (1, 0, 0) for the next one. With no job left, nothing covers it, and the demo ends on red.
The script
pompom.py is 120 lines. It loads the scenes with llScene("d:\\…"), subclasses four engine classes for their callback(), connects outputs to named inputs, and schedules jobs. Every callback reads the joypad through getEvent(EC_NOTE_ON, 0, note), where note 0 is button A and note 1 is button B.
- A press
- B press
- 0–14 s
scenehead.pckat 6,000 ticks a second. It has no callback, so the commander talks and the extruded “LIMP NINJA MEGADEMO” sweeps past his mouth exactly as keyed. - 14–34 s
addoverlayAdd(a = scene2, b = overlay).scene2is aRobotSceneonrobot.pck: B cuts to the next camera.overlayis aCustomOverlayoftehrobot.jpgwith opacity fixed at 0. An A press sets the opacity target to 1 and the scale target to 1.3, so the title flashes in, slightly zoomed, and fades within a second. - 34–44 s
distortDistort(in = roverlay).roverlayis aRobotOverlayofwatchout.jpgat opacity 1. A sets the target ofposyto 1, which throws the poster up by half a screen, and it slides back. Distort shifts each of the 480 lines sideways on a product of three cosines. - 44–64 s
walksceneAWalkSceneonrobotwalk.pck: B cuts the camera. Its A branch callsself.offset(7200), but aFixedSlideris not callable. TheTypeErrorends the callback, so A does nothing here. - 64–84 s
add1Add(a = over1, b = visscene): a plainOverlayoffish.jpgat the default opacity of 0.5, over aWalkSceneonvissen.pckat 6,000 ticks. - 84–107.5 s
addoverlayThe robot again, the same node with its state intact. Its clock and camera carry on from where it was left at 34 s. - 103.5–123.5 s
add2Add(a = over2, b = alienscene):enslaved.jpgat 0.5 over aWalkSceneonalien.pck. It overlaps the robot job by four seconds, and the capture shows add2 from 103.5 s, so the later job wins.
A CustomBlur class is defined and never used. RobotScene's self.time=0 sets a Python attribute, because the SWIG proxy has no time property. WalkScene's time=0 sets a local variable. Neither matters, because nextCamera() (0xb75e0) restarts the clock itself.
Inside the 2003 engine
The executable is fxtest.exe (debug path d:\code\xbox\pompom\fxtest\Release\). These pieces show what the later demos grew from:
- Callbacks run only for what is drawn. The scheduler calls the top node's
callback()(0xb2070), andprocessInputs(0xbdca0) calls each input's before pulling it. A scene that is off screen stops: the robot at 84 s resumes with the camera it had at 34 s. - FixedSlider (update 0xc1e50) keeps a value, a target, a fix point, a damping of 0.99 and a fix-point damping of 0.999. Each call does a = d50d, value = (1−a)·target + a·value, then the same with b = 0.99950·0.999, pulling the target back to the fix point. The steps are per call, not per second. The exponent makes 0.96 the faster setting: it keeps 14% of the old value per frame, where 0.99 keeps 61%.
- Scene (draw 0xba010) adds dt × speed to its clock each time it is drawn, with a default speed of 7,200 ticks a second. A fixed slider
offsetis added on top. Camera i of the name-sorted camera list is used, with D3DXPerspectiveFovRH, aspect 1.25, near 0.1 and far 10,000. - Overlay (render 0xcfaa0) updates its five sliders on every render call, then draws its
mapon a plane through scale·rotZ·translate, alpha-blended over a cleared target. Add sums its inputs. Distort (0xcb4b0) is 480 one-line strips. The offset of line y is cos(pₓy+py)·cos(pₓy³+py)·0.02·cos(pwy), and p is driven bytimeGetTime(). - The main loop reads the clock (0xb39a0), collects the frame's events (0xadd70), renders the scheduler (0xb2760) and clears to red. Only the first job of a slot that is active (start ≤ t ≤ end) is drawn.
Scene files
The .pck files have the same chunk layout as the later .lzma exports (SCNE TXTR MATR OBJC KEYS MESH LGHT CAMS SHDR), but they are not compressed. Three things differ:
- Keys are relative to the parent. OBJC's third field is the parent id. The Biped, the ragdoll and the robot's jaw are hierarchies, and they only hold together once each key is multiplied by its parent's world matrix.
- MSHD is
[material, skinned, flags, n, n × (register, object, attribute)]. The attributes are a light's position (0), attenuation (1), spot cone (2), direction (3) and colour (4), a bone matrix world(t)·world(0)⁻¹ (5), and the eye (6). A material has a static and a skinned program. Flag 2 hides a part, which is how the jaw boxes stay invisible. - Skinning uses up to four bones per vertex. Each vertex stores its bone slots, and the vertex program indexes
c[a0.x + 12]with them. The commander's face has two bones. The walking robot has eight, and up to three of them move any one vertex.
The vertex programs are the Cg 1.1 output stored in the files. They run here as they are, translated instruction by instruction to GLSL (js/vsh.js, shared with the Polar Bear Alert reconstruction).
Where the bytes go
One executable, linked on 28 December 2003 at 22:33 UTC. All nine XDK libraries are version 5659. Besides the engine and Python, .text carries libjpeg, libpng and zlib 1.1.4 for the pictures and textures. The release has no dashboard tile.
| Section | Bytes | What it is |
|---|---|---|
.text | 959,356 | engine, embedded Python, SWIG demoscript module, effect classes |
.data (on disk) | 134,936 | initialised data (188,548 in memory) |
.rdata | 114,652 | constants, strings, SWIG tables |
DSOUND D3D D3DX XGRPH | 572,352 | XDK sound and graphics |
WMADEC XPP DOLBY | 174,652 | XDK codecs (WMA plays deun.wma) |
| file | 1,990,656 |
.XTLID (4,256 bytes) is left out. The script and shaders folders are dated 30 December 2003. Most of the data files carry 2008 dates from a later copy. The shaders/ folder holds compiled programs for many more effects than the script uses: blur, ripple, voronoi, RGB mix and others, the beginnings of the later library.
The five scenes, up close
Drawn with the demo's own vertex programs, skinning and cube map, but with a camera you control. Drag to orbit, scroll or pinch to zoom, double-click to reframe. Pick one of a scene's cameras to see what the demo sees. Wire draws every edge on top, through the same vertex programs: light for what the engine draws, red for the bone boxes it skips.
Checked against a capture of the original
The capture (720×576, 25 fps, 2:09) runs from the green boot screen to red. Each pair below shows the capture on the left and this reconstruction on the right at the same moment.

| Timing | Green until 4.32 s, one blue frame, then the demo. A capture frame at c shows demo time c − 4.50. The red screen after the last job, which is driven only by the clock, appears at 128.0 s. The flashes rise within a frame of each recorded press. |
|---|---|
| First frame | The head scene's text runs about 0.15 s (900 ticks) ahead of that clock. The loop's clock starts before its first frame, and that first frame time goes into the scene. The reconstruction starts its clock 0.15 s early. |
| Stalls | The first use of a scene or picture stalls the loop. The head holds for 0.5 s at 14 s, the robot for 0.24 s at 34 s and the corridor for 0.36 s at 64 s. At 103.5 s the first alien frame runs but is never shown: the robot stays up to 103.74 s and the alien appears at 103.76 s, its tumble already 0.26 s along. Each stall reaches the scene clocks as one long frame, and the reconstruction models all four. |
| Frame rate | Split into its 50 fields a second, the capture shows a new frame in every field, except in the corridor. From 44 to 64 s the fields come in identical pairs, so the skinned walk runs at 25 fps, and each frame reaches the screen 0.04 s after its clock was read. The first corridor frame shows at 44.04 s. The B press at 54.052 s is handled at 54.08 s, and its cut shows at 54.12 s. With that modelled, the camera swoops after both cuts to Camera01 match the capture field for field. |
| Presses | At 19.601 s A and B fall in the same frame. The capture shows the A flash and no camera cut. With that B lost, the robot's and the corridor's camera sequences match the capture from the first cut to the last, and both start on their first camera. So getEvent sees only a frame's first note-on. |
| Overlay | The TEH ROBOT flashes fade 26% every 0.12 s, which is the fix-point pull of 0.951 per frame. Their brightness follows the opacity itself, not its square, so the picture is map × opacity. |
| Poster | After the A press at 35.01 s, WATCH OUT jumps off the top edge. It is back to 0.50, 0.34, 0.23 and 0.12 of half a screen after 0.33, 0.49, 0.65 and 0.89 s. The slider (damping 0.99, fix-point 0.999) gives 0.49, 0.33, 0.22 and 0.12. |
Odds and ends
- Recorded events.
recorded_eventsis 808 fixed 20-byte records: f32 time, i32 channel, i32 command (0 note on, 1 note off, 2 pressure), f32 velocity and i32 note. There are no names yet. The later demos add a name and a length prefix. Of the 578 pressure records the script reads none. - A for flashes, B for cuts. A is pressed about every 1.9 s in the robot parts. B is pressed 88 times between 16.8 and 107.3 s, mostly every half second to two seconds. It pauses through the poster, where only A does anything.
- The robot's camera. In the robot and corridor scenes the clock restarts at every cut. The robot's head animation lasts two seconds, so most of what moves in those parts is the B presses.
- The black box.
head.pckhas a third box, Box03: a slab 14 × 99 × 1.4 units with a black material, which the engine draws. It lies over the first part of the text's path, and the text slides at a height inside the slab. So LIMP NINJA MEGADEMO comes out from under a black cover, letter by letter, against the black background. Switch on Wire in the viewer to see it. - “!DUMMY!”.
vissen.pcklists a texture with no data and kind 4. The engine renders a 256² cube map around object 4, the dark ball, with a 90° camera, the same mechanism Polar Bear Alert's mirror sphere uses later. - Texture paths.
C:\3dsmax6\demo\blueish.tga,…\maps\Reflection\REFMAP.GIF, and the 3ds Max 6 feature-demo filesconcrete_wall.tifandReactor2\fun_in_a_dryer\LightBrownOfficeCarpet.jpg. The exporter stored them all as PNG.
Method
Static analysis. The XBE was parsed with tools/xbeinfo.py and disassembled with Capstone. FixedSlider, Scene, Overlay, Distort, the texture stages, the scheduler and the main loop were read from the code. The Python side is a line-by-line port of pompom.py (js/sim.js). The scene format and shader bindings were decoded from the files (js/scene.js, js/sceneshader.js). Timings come from frame-by-frame measurement of the capture.
Keys: space pause, ←/→ 5 s, R restart, L 640×480. URL options: ?skip starts at the demo, ?t= freezes at a demo time, ?show= at a show time, ?scene=robotwalk&cam=1&tick=3600 draws one scene from one camera.