~ecs/scrapple

Bad Apple!! rendered in Scratch 3
Add variable monitor output as well
Rework build system

refs

master
browse  log 

clone

read-only
https://git.d2evs.net/~ecs/scrapple
read/write
git@git.d2evs.net:~ecs/scrapple

You can also use your local clone with git send-email.

#scrapple

Bad Apple!! in Scratch. Using the blocks as a display.

Abandon all hope, ye who enter here.

https://p.d2evs.net/3417454307.webm

#How?

In Scratch, blocks are highlighted while they're run. Naturally, the only reasonable thing to do is to use that highlighting as a pixel in a display. In addition, variables can be programmatically hidden and shown, which is basically the same thing as them being pixels.

Each pixel is of the form:

when I receive [$x,$y] {
    show variable [x,y]
    wait until [pixel x,y of the current frame] == 0
    hide variable [x,y]
}

With each variable [x,y] initially hidden and placed at (x * n, y * n) on the canvas.

The driver is morally equivalent to:

for (int f = 0; f < len(frames); f++) {
    for (int x = 0; x < resolution; x++) {
        for (int y = 0; y < resolution; y++) {
            if ([pixel x,y of the current frame] == 1) {
                broadcast("$x,$y")
            }
    }
    while (f < $(seconds since start) * $FPS) {
        f++
    }
    wait until f / $FPS seconds have passed since the start
}

#What?

This should work for any video, not just Bad Apple. Stick your desired video in build/badapple.mkv (does not need to be Matroska) before building.

#Usage

To generate the sb3, you need a POSIX system, ffmpeg, Go, and (unless you provide your own video) curl. make dumps an sb3 at build/project.sb3. make RES=... to change the resolution, 10 is the default. make OFFSET=... to change the offset, 50 is the default. make FPS=... to change the FPS, 10 is the default. After changing the resolution, you'll need to make clean.

#Performance

It's not great. I suggest using TurboWarp, enabling turbo mode, using the small canvas, zooming out all the way, and shrinking your browser window as much as possible. With all that and the default fps/resolution, I get ~3 dropped frames on my T420 with nothing else running.