Log In  
Follow
NPO

(He/Him)
I enjoy low level programming and maths.

[ :: Read More :: ]

Bad Apple on Pico8

Link to github here
Note this works by dragging and dropping a frameData.bin onto the running cart so it dose not work on BBS.

Drawing Function Used by Cart:

--main
print("dropfile")
repeat
until stat(120)
cls()
polys={{}}
i=0
p = 1
size=0
function _update()  
    byte=0
    while byte!=0xff do
    if i>=size then
        size = serial(0x800,0x4300,1000)
        if size==0 then
            stop("done")
        end
        i=0
    end
        byte = peek(0x4300+i)
        if byte!=0xff and byte!=0xfe then
            add(polys[p],byte)
        end
        if byte==0xfe then
            p+=1
            add(polys,{})
        end
        i+=1
    end

end

function _draw()
    cls()
    for poly in all(polys) do
        line(poly[1],poly[2],poly[1],poly[2])
        for i=1,#poly,2 do
            if poly[i]==0xff then
                stop("here")
            end
            line(poly[i],poly[i+1],7)

        end
    end
    polys={{}}
    p=1
end

How it works

frameData.bin contains all the video data, every 2 bytes is an x,y coordinate for the endpoint of a line, an 0xfe byte represents the end of a polygon, a 0xff byte represents the end of a frame.

The pico8 cart reads this data 1,000 bytes at a time, and draws the outline of each polygon (filling them in would be a challenge).

Shout Out

Shout out to this project here which did the initial work of turning the original video into a list of polygons, which this project is based on.

Follow Up

I'd like to investigate the possibility of compressing the frame data into a single cart, which might be difficult at full scale resolution. I'd also like to investigate algorithms for filling in the polygons efficiently. Any ideas / advice is most welcome!

P#130387 2023-05-31 23:53