Toggle Menu

Introduction

The inspiration for the tech comes from the demo tool of the Logicoma group, Demotivation. Ferris did excellent streams on how the tool works (Ep.002 stream and notes), and breaking down the 64k demo Elysian produced in the tool (Ep.003 stream and notes).

Motivation for a Tool

A large number of steps are involved in producing even simple graphics: typically you load or generate content, move a camera around while calculating matrices and variables for the scene, render the scene to a framebuffer, use that framebuffer as a texture for post-processing and so on.

This is organized in the CPU code, and if you know what is going to happen already, you can design and code these steps, then compile and run.

Demoscene graphics is very inventive though, you just make it up as you go along, and that’s more fun too – not to mention that you will probably change between rendering pipelines from one scene to the next in the same demo.

Compiling just the see the result…

Waiting for the build

(“Waiting for the build”, Juan Manuel Blanes, 1875 / 78, classicprogrammerpaintings.com)

Instead of hard-coding the sequence of these operations, it is better to generate some code which will produce the graphics in real-time, and tune the code while you are looking at the result as the code is running.

Just-In-Time compilation (JIT) is one way to do this.

There is one function which we call at every frame, this does all the drawing. This function is assembled in the memory at runtime from a custom byte-code sequence which describes the operations to execute. This way, as soon as we change the byte-code, the function can be re-built in the memory and at the very next frame it can draw something completely different.