Log In  

Cart #58426 | 2018-10-25 | Code ▽ | Embed ▽ | No License

Trying out an idea.

Cart #58425 | 2018-10-25 | Code ▽ | Embed ▽ | No License

Well, I stand corrected. If you only process the necessary parts of the screen and fake the rest, you can get the effect to take up much less CPU.

Cart #58422 | 2018-10-25 | Code ▽ | Embed ▽ | No License

I was reading the Dank Tombs articles by Krajzeg and decided to see how far I could get with what I know. I cheated and used a smaller screenspace at 30fps, but not even that could save me from CPU overload...I want to get this effect running well enough that a game could be played using it, but I think at some point to go any farther I'll need to delve into more complicated things than what I'm doing.

P#58424 2018-10-25 17:22 ( Edited 2018-10-26 07:24)

Beautiful !

P#58428 2018-10-25 20:38 ( Edited 2018-10-26 00:38)

Hum...looks like you did not get the core ideas of Krajzeg:
(you get the shading right ;) )

  • don’t work on pixel (use peek/poke to work on pairs)
  • precompute shading pairs (for 16x16 color combinations)
  • compute shading area per row (eg don’t do dist(...) for each pixel ), eg find x where xx+yy=radius for a given y (can even be precomputed).
    Alternative: look at circle rasterization to find boundaries.

Known caveat: your version is pixel perfect, the fast version is not (unless you get the extra mile and got per pixel for the outer boundary)

Edit: realized my code is a bit too complex for demo/tuto purposes. Simplified version below (requires mouse):

Cart #58458 | 2018-10-26 | Code ▽ | Embed ▽ | No License

You can have a look at Nuklear Klone level 2 - I used that very technique @60 fps:
https://github.com/freds72/pico8/blob/master/carts/nuke.p8
(I have 3 precomputed lights with different radius to simulate flicker and avoid costly sqrt(...) )

P#58436 2018-10-26 03:24 ( Edited 2018-10-26 20:16)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 13:48:50 | 0.011s | Q:24