Introduction:
This intro sort of came about as side-product of my preperations for the Byte Battles at Lovebyte Battlegrounds in 2021.
The general idea was to get a 3D rotating groundplane and i figured that instead of making it a plasma-type landscape, I would use a binary logic operations for the height, expecting to get some 'smaller planes' at different heights. What I got was this 3D Sirpinski Fractal Object!
After its initial release, the intro got eventual ported to PICO-8 and MicroW8 as part of our effort to port over our older Fantasy Console intros to the different platforms.
Visuals:
To get our '3D' fractal shape, its really a very simple 4 step process, which I will explain using pseudo code. Feel free to implement this in the language and/or on the platform of your choice.
Step 1:
We'll start by drawing a grid of N by N points around the center of our screen:
scale=4
for y=-15,15 do for x=-15,15 do
xx=x
yy=y
color = x^y
circle(xx*scale+centerx, yy*scale+centery, 1, color)
end end
Step 2:
We'll be rotating these points around their center point with a default 2D rotation:
s=sin(angle)c=cos(angle)scale=4
for y=-15,15 do for x=-15,15 do
xx=y*s-x*c
yy=x*s+y*c
color = x^y
circle(xx*scale+centerx, yy*scale+centery, 1, color)
end end
Step 3:
We'll add some fake perspective by flattening the vertical scaling (scale/4):
s=sin(angle)c=cos(angle)scale=4
for y=-15,15 do for x=-15,15 do
xx=y*s-x*c
yy=x*s+y*c
color = x^y
circle(xx*scale+centerx, yy*scale/4+centery, 1, color)
end end
Step 4:
From here, all we need to do is subtract some height from the y-position. In our case we'll be using a XOR-pattern, but you can ofcourse use any height formula for your desired shape.
s=sin(angle)c=cos(angle)scale=4
for y=-15,15 do for x=-15,15 do
xx=y*s-x*c
yy=x*s+y*c
height = (x^y)*2
color = x^y
circle(xx*scale+centerx, yy*scale/4-height+centery, 1, color)
end end
From here you can add some depth coloring, scaling and/or circle-sizing as needed, and thats really all that is to it.
Sourcecode:
So to help people with exploring different platforms, I've decided to share the sourcecode for the original Sharded, as well as its PICO-8 and MicroW8 ports here:
TIC-80 Version:
t=0TIC=load'cls()t=t+.03 for a=-31,31 do for s=-31,31 do i=s*math.sin(t-11)+a*math.sin(t)circ((a*math.sin(t-11)-s*math.sin(t))*math.sin(t/9)*9+120,(i-(a//1~s//1))*math.sin(t/9)*9+31,math.sin(t/9)*i/4,i/9)end end'
PICO-8 Version:
::f::cls()n=t()/9s=sin(n)c=cos(n)z=s+3for o=0,960do u=o%31-15v=o/31-15pset(u*c-v*s*z+64,(u^^v)+v*c+u*s*z+64,u/6)end flip()goto f
MicroW8 Version:
export fn upd() {
cls(0);
let inline t: f32 = time();
let inline ss: f32 = sin(t/9 as f32);
let v: i32 = -31;
loop vloop {
let u: i32 = -31;
loop uloop {
let inline scale = ss*9 as f32;
let inline x = (u as f32 * cos(t) - v as f32 * sin(t));
let inline y = (v as f32 * cos(t) + u as f32 * sin(t));
circle(x*scale + 160 as f32, (y-(u^v) as f32)*scale + 63 as f32, ss*y/8_f, -(y/5 as f32) as i32 -32);
branch_if (u:=u+1)<31 : uloop;
}
branch_if (v:=v+1)<31 : vloop;
}
}
Conclusion:
I remember Lovebyte Battlegrounds was quite hectic to organise as I was also participating in the Byte Battles in between compos, but I had great fun!
I'm grateful for the experience for the intensity of these byte battle matches that allowed me to get extremely comfortable with on-the-spot TIC-80 livecoding, as well as providing us with this intro a byproduct! I still think that its a nice little intro for its size.
For more information, you can check out the intro and its subsequent ports right here