Log In  


Cart #bonusstg1k-3 | 2022-09-28 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
8


Bonus Stage 1K: a Pico-8 demake of the iconic spherical bonus stages in Sonic games, in 1024 bytes of compressed lua code. Produced for the 2022 #pico1k jam.

Help Jelpi navigate a spherical maze by turning left or right at the end of each tile, collecting rings and blue spheres while avoiding the lethal red spheres. The game finishes when no blue spheres remain.

8


A lot of shortcuts had to be taken in order to make this fit in 1K. I was originally planning to animate the background with palette cycles, but soon realised I had nowhere enough available colours or space in the sprite sheet to do this. Instead, I had to use precomputed coordinates and include much more verbose code to do the transformation and colour mapping.

Another unsavory shortcut was to replace the back to front sorting of the objects by something approximate which works 'most of the time' (C). I will also submit the original version of the cart, which does this correctly, as soon as I can add some comments to it.


1

what about a tlined ‘mode7’ floor + screen rebase to shift columns as a sphere using sspr?
cart is impressive but super slow (pset)


@freds72: thanks for the suggestion, that would work but we would need multiple sspr calls per column as the scaling ratio will change based on depth.

Alternatively we can render the tiles as quads using lines, which should much cheaper than the pset. Currently the cart was at 151% of a frame (a bit more once I removed a few locals), so 100% should be achievable that way. I will give a try to see how compact I can get quad rasterisation.


1

see the Hexagon cart! I posted a ngon rasterizer ‘patch’


Thanks! I will "take inspiration" ;-p


4

Tried the tline + sspr, it "works", less convincing but clocks at 60% cpu :]

Cart #fanewiduba-0 | 2022-09-21 | Code ▽ | Embed ▽ | No License
4


That's very impressive, and probably enough to push performance over 30fps (object drawing is very light), need to test with the objects to check whether actually their coords would match with a single sspr call per column.


This would need reworking of the object to screen projection, as the cells don't "roll backwards", but otherwise it should work, it is very compelling


So I borrowed @p01's excellent triangle routines from @freds72's snow! and implemented sphere drawing by rasterizing even cells.

With this change there is plenty of room to run this cart even at 60fps, which opens up the opportunity for a very smooth full fat implementation. This lacks the elegance and ingenuity of the tline-based implementation above, but unfortunately that would not provide the spherical distortion as cells fade away in the distance, which is much more prevalent with the perspective used in the reference game.

Please note the cart below is a bit different from the 1K version (it is an earlier version which is easier to edit).

Cart #bonusstgtris-2 | 2022-09-27 | Code ▽ | Embed ▽ | No License


1

ah! this is actually @p01 trifill and suggest you switch to my n-gon rasterizer!
it natively supports quads and won’t have the edge artifacts you now have.
see: https://github.com/freds72/chamboultout/blob/master/carts/polyfill.lua

and shl/shr are ‘obsolete’ - use >> << (+ faster)


1
-- borrowed from   @freds72 >>
function p01_trapeze_h(l,r,lt,rt,y0,y1)
-- ...

:)

Better borrow from @freds72 for real. His n-gon rasterizer will work much better for your use case, and it does sub-pixel precision which allows much smoother movements.

That said, kudos on your 1k entry. It's pretty neat!


Désolé @p01, you can trust me to not get even the attribution right! I will definitely look into the n-gon routines.


And I did replace the trifill calls with polyfill and it worked an absolute treat. Subpixel precission with the same speed. Thank you so much @freds72 and @p01 for your help and encouragement.

Cart #bonusstgtris-3 | 2022-09-27 | Code ▽ | Embed ▽ | No License


yeah! go 60fps now :)

and some input buffer? it is incredibly difficult to turn


The 60fps is smooth as butter:

Cart #bonusstgtris-4 | 2022-09-27 | Code ▽ | Embed ▽ | No License

the irony is that the source material most likely implemented this with palette cycling, and if memory serves me well, it may have been running at 15 fps (even less in PAL). I need to play it again with an instrumented emulator, also to figure out the controls, specifically how many frames before the edge of the tile did it registered the turn. Either it was quite hard or my teenage self was very lame.



[Please log in to post a comment]