pouët.net

Go to bottom
Focus v2 (Pouet version)
screenshot added by weatherman115 on 2021-12-12 20:16:39
platform :
type :
release date : december 2021
  • 3
  • 1
  • 0
popularity : 42%
 42%
  • 0.75
alltime top: #48320
added on the 2021-12-12 20:16:39 by weatherman115 weatherman115

popularity helper

increase the popularity of this prod by spreading this URL:

or via: facebook twitter pinterest tumblr

comments

This is my first time posting sizecode anywhere other than Code Golf SE, so if I may, I'd like to highlight some of what I did to achieve a 512 byte file from what was originally 560 bytes of code.

First, some backstory: I made the original game in mid-November for TweetTweetJam 7, where the goal was to get the code of the game to fit within 560 bytes. I made it within a day, and submitted it happy that I got to implement everything I wanted to within the restrictions.

Then, about a week or two ago, I discovered the demoscene, this site, and just yesterday, an empty list of 512-byte PICO-8 carts here. Thinking back to the game, I realized that I might be able to smash down what I'd written down to 512 bytes, upload it here, and fill in the gap.

Of course, I initially didn't realize that it's supposed to be a 512 byte file, not 512 bytes of code. I ended up tearing my hair out trying to golf/reword out 26 more bytes, after already reducing my code as much as I thought I could. In the end, though, I'm glad I managed to do it.

Oh, and one more thing: I have never parsed the words "proper, permanent hosting" as much as I did while trying to post this. I spent several hours last night trying to find literally any file-hosting website that Pouet would accept. Even my Dropbox/Drive links, edited to be direct downloads, weren't being accepted. It made me realize that, unless you know about Discord or the Internet Archive, there's basically no free and easy-to-use services for keeping A File on the internet.

-----------------------------------------

A lot of reduction came from rewording and revising the end-screen:
Code:v=0 ----- if(t==0or l>0)v=l>0and"hit the red"or"won"goto u ----- ::u::?"you "..v.."!\n\nscore: "..t.."\nhigh score: "..h,1,1,7 if((t>h and h>0)or(t<d and h>t))dset(1,t)?"new record!" flip()goto u //182 bytes if(t==0or l>0)goto u ----- ::u::?l<1and"win!"or"time: "..t,1,1 ?"best: "..h if(h==0or(sgn(h)==sgn(t)and t>h)or(t<1and h>t))dset(1,t)?"new best!" goto u //145 bytes (-37)

The goal here was to retain the information you got while retaining the colon-space formatting:

BB Image

There's also a few basic golfs: removing the flip() since nothing's moving,
and replacing an unnecessary variable (fun fact: the v=0 was the very last cut, as I didn't realize it was doing nothing but still being initialized)

I also added some logic that allows the high score system to let you have a high score. See, when I wrote the original cart, I failed to realize that 0 was both the default score AND the score you reach when winning, and as a result the high score functionality was basically useless. I tried several methods of getting it to work, but the only one that would work would require additional savedata commands on top of the ones already there. In the end, I set it so that a high score of 0 will always be overwritten. And here's the irony of the hour: actually winning the game would take about 5+ hours to do, meaning that if someone actually managed to do it without modifying the code, they'd have to present several Youtube documentaries' worth of video as evidence that they didn't cheat.

The idea that initially spurred me on was a new feature in PICO-8 0.2.4: by setting 0x5F54 to 0 in memory, you can use sspr() to move the screen over as if it was on the spritesheet.
Code:for i=1,m do for j=0,m do pset(i-1,j,pget(i,j))end end //54 bytes poke(24404,96)palt(0) ----- sspr(1,0,m,128) //36 bytes (-18)

I love how something so simple managed to free up that much space. So does the vCPU.

I'm particularly happy about this one:
Code:if(btn(2))y-=1 if(btn(3))y+=1 //29 bytes b=btn()if(b>3)y+=sgn(b/4-2) //27 bytes (-2)

This is based on a similar trick for reading the left/right buttons. I think doing 2x-1 would be smaller than sgn(x-2), but given how much it took to get to 512 bytes, any further barrier that could matter, i.e. 500 bytes, would probably be impossible to reach without removing the high score functionality.

And that's all the stuff I wanted to note. There is more optimization that I had to do, but I don't want this post to take up more space than it already does, so I'll leave it for those who are interested.
Great effort and thanks for the detailed post!
Welcome to the demoscene, keep 'em coming!
Btw. there are some demoparties that specialized on sizecoding, check out lovebyte for example - quite a lot of regular parties also have sizecoding compos. And there's also a demoscene discord.
rulez added on the 2021-12-13 06:53:20 by v3nom v3nom
Amazing work for somethin so small!
rulez added on the 2021-12-13 10:21:13 by lumanare lumanare
Great work and platform thumb!
rulez added on the 2021-12-13 14:40:43 by superogue superogue

submit changes

if this prod is a fake, some info is false or the download link is broken,

do not post about it in the comments, it will get lost.

instead, click here !

[previous edits]

add a comment

Go to top