Log In  


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!



Based on your description, it sounds like frameData.bin is a list of polygons with frame separations. If you want to use filled polygons instead, I would recommend converting the data into keyframes (or perhaps key-polygons?) and adjustments so that you're not redrawing things that don't need to be redrawn.

If that turns out to be viable, you could then also consider taking advantage of the fact that the video is entirely black and white to compress the keyframes more easily. If you can find a way to store keyframes as full images, then you can unpack and copy them into upper memory a little at a time beforehand and then just shove the whole image onto the screen memory when the time to show them comes. That would completely eliminate the need for an efficient filling algorithm, replacing it instead with the need for an accurate representation of each non-key frame.

Edit: Also just remembered, if your reason for wanting to use a single cart is to upload to the BBS, then it may be worth considering using a few data carts and loading data into upper memory as well. That would still allow playing it from the BBS.



[Please log in to post a comment]