Log In  

Cart #tweetcart-2 | 2023-05-06 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
8

Watch and be amazed :)

It was really fun to optimize the code to its limit.

You can just paste this in pico-8.
here is the code:(space is only included in this post)

i=line::h::n=t()/3x=cos(n)*40y=sin(n)*40q=128p=63u=-abs(x)/10for z=0,3do
j=z%2*q
k=z\2*q
i(j,k,x+p,y+p,u)i(j,k,p-x,p-y,u-1)i(j,k,p-x,y+p,u)i(j,k,x+p,p-y,u-1)end
for i=1,999do
pset(rnd(q),rnd(q),0)end
flip()goto h

Im not sure if I can compress it any further, but if you
see anything please comment it.

P#129444 2023-05-06 14:58 ( Edited 2023-05-07 15:16)

Really nice!

I think this cuts about 40 characters off the minified code:

i=line::h::n=t()/3x=cos(n)*40y=sin(n)*40q=128p=63u=-abs(x)/10for z=0,3do
j=z%2*q
k=z\2*q
i(j,k,x+p,y+p,u)i(j,k,p-x,p-y,u-1)i(j,k,p-x,y+p,u)i(j,k,x+p,p-y,u-1)end
for i=1,999do
pset(rnd(q),rnd(q),0)end
flip()goto h

A few things I did:

  • Combined for loops
  • Changed how time was tracked (kept time scale about the same though)
  • Inlined or got rid of unnecessary constants and computations - l could be replaced with unary negation, o was only used once and so took fewer chars to inline, etc.
  • After doing the above, rearranged some things to require less whitespace

I think it's very likely more could be done: I probably missed some things, and I haven't really tried to understand the code in a way that would enable deep changes.

P#129447 2023-05-06 16:22 ( Edited 2023-05-06 16:29)

hey, this is pretty cool!
plus luchaks's code is so small that it maybe will work

P#129469 2023-05-07 14:08 ( Edited 2023-05-07 14:09)
1

thanks, glad you like it.
Also thanks to Luchaks for helping me out with the code.

P#129470 2023-05-07 15:13 ( Edited 2023-05-07 15:14)

guess who? ;)

P#129661 2023-05-12 14:23

Aren't You THE STEAMIST !!???
The Gamedev from Youtube.

P#132695 2023-08-03 16:47

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-02-25 18:37:52 | 0.012s | Q:19