Mini writeup for Microlair

Introduction:

We've been wanting to visit Lisbon and go to Inercia Demoparty for a while. However, travelling to Portugal can be a challenge especially if you don't want to fly. But finally in 2022 we were able to visit Lisbon. We had a great time visiting the city, botanical gardens, artist village and ofcourse Inercia Demoparty. On the monday after Inercia we had a personal tour through Almada by our guide psenough :D Thanks to whole of the Inercia Association for organizing the event!

Development:

This intro was my attempt to get my the cave structure from my semi-final 'Doom' raymarch bytebattle from Lovebyte Battlegrounds down to 128 bytes. After several attempts in TIC-80 and PICO-8 (and even an early attempt at Picotron),

Technically the intro works by scanning all the different pixels on the screen and setting up a basic raymarcher to calculate the color value. For this to work in smaller sizes, both the camera movement, SDF function and final color calculation have to be small and simple enough. For this particular intro I used basic domain repetition deliberately cut vertically to get the sandy floors (px=mod(u,10)-5 py=(v,20) pz=(z,10)-5) , then calculate the squared sphere distance and feed that into a cosine function to get those nice arches.

Most of the default colors on MicroW8, despite being thought about are somehow never cutting it (no white top color, hues either too candy or too codercolored, etc.) except for the sandy colors around 96 which I liked and used for the intro.

I wanted to have a bit of a dynamic camera, so within the sizebudget I managed to just about have the camera position move from side to side in such a way that they would go through different arches.

After many hours of optimizing the code I was finally able to get working within the sizebudget. As a compromise I didn't have enough space to add a nice texture to the arches, which is why the arches look a little flat. I think with the new knowledge gained since the release of the intro I could have probably included a little more (like proper texturing).

Optimisations:

So here are the different optimisations tactics I used on the intro to get everything within the size limit:

* Have a single label to jump to with branch_if for all 3 loops (x,y,z).
* Both the x and y loops use a modulo structure to automatically reset the value. ( branch_if x:=(x+1)#%320:drawloop; )
* Both the x and y loops have the same iteration counter ( 320 ), so technically its overdrawing.
* Using the same divider for extracting u,v ray directions from the x,y loop.
* If possible use as few different float values as possible.
* If possible use as few different i32 values as possible.
* If possible use 'intvalue as f32' to represent float values.
* Use floats with the smallest IEEE bit representation possible.
* Use inline variables/code as much as possible.
* Don't initialise any variables unless you really have to.

Conclusion:

We had a blast exploring Lisbon and visiting the Inercia 2022 Demoparty, where I was finally able to release this intro. You should come to Inercia Demoparty!

For more information, you can check out the intros at Inercia 2022 here

Return to blog overview