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.

P#117749 2022-09-21 05:42 ( Edited 2022-09-28 16:32)

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.

P#117754 2022-09-21 07:00 ( Edited 2022-09-21 07:01)
1

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

P#117759 2022-09-21 10:20 ( Edited 2022-09-21 10:20)

@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.

P#117761 2022-09-21 11:01
1

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

P#117762 2022-09-21 11:12 ( Edited 2022-09-21 11:13)

Thanks! I will "take inspiration" ;-p

P#117763 2022-09-21 11:19
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

P#117768 2022-09-21 18:24 ( Edited 2022-09-21 18:24)

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.

P#117773 2022-09-21 21:00

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

P#117774 2022-09-21 21:04

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

P#118029 2022-09-27 06:31 ( Edited 2022-09-27 17:09)
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)

P#118031 2022-09-27 07:04 ( Edited 2022-09-27 07:31)
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!

P#118034 2022-09-27 08:06

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

P#118060 2022-09-27 17:10

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

P#118062 2022-09-27 17:24

yeah! go 60fps now :)

and some input buffer? it is incredibly difficult to turn

P#118069 2022-09-27 18:08 ( Edited 2022-09-27 19:04)

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.

P#118073 2022-09-27 20:16

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 18:13:15 | 0.032s | Q:46