Page 1 of 1

Zsenilia (256Kb intro by Resistance)

Posted: Tue Dec 29, 2015 7:23 am
by astrofra
Hello,

it turns out this is my first post on Sprites Mind, but I've been lurking around and playing with the (amazing) SGDK for quite a while :)
Working with the demoscene groupe called "Resistance", we released a couple of days after Christmas a small demoscene intro for the Megadrive.

It is entirely writen in C, using the SGDK with a few (and dirty) tweaks.

Here is a Youtube capture :
Image

Here is the link on Pouet.net :
http://www.pouet.net/prod.php?which=66742

I hope you will enjoy this little prod as much as we did when making it :)

Re: Zsenilia (256Kb intro by Resistance)

Posted: Thu Dec 31, 2015 4:48 pm
by nolddor
Thanks!!

Would be possible to release the src? I'm quite interesting in learning how those balls work.

Anyway, I've uploaded this demo in my Youtube Channel you can use as a mirror If you want.
(Travel Demo it was uploaded as well)

Re: Zsenilia (256Kb intro by Resistance)

Posted: Thu Dec 31, 2015 9:00 pm
by Sik
Sorry for spoiling it for you, but just checked and they're just sprites =P (and like 60% of the table only, 48 sprites). Layer priority is used to make them go behind and in front of the graffiti (which is plane A), if you wonder. (the background is plane B, predictably)

The paths may be more interesting. I know how those are made, they're just sines and cosines added together, but coming up with a combination of those that looks good is the hard part. You can happily spend just a few minutes getting the graphics on screen and hours trying to make a single path XD

Re: Zsenilia (256Kb intro by Resistance)

Posted: Fri Jan 01, 2016 7:09 pm
by KanedaFr
yes, a lot of these demos are "basic" math
the art comes from the ways this math is used...

i made one myself...12years ago :)
http://gendev.spritesmind.net/page-stdream.html
I forgot to release the code, so I added it today !

Re: Zsenilia (256Kb intro by Resistance)

Posted: Fri Jan 01, 2016 7:48 pm
by nolddor
@Sik
I already knew that balls were simply sprites put together but as you said create a sinus/cos line and put together at least for me it's really complicated.

PD: Thanks KanedaFr for the code. I'll check it ASAP

Re: Zsenilia (256Kb intro by Resistance)

Posted: Sun Jan 03, 2016 8:32 am
by astrofra
Thanks for your feedbacks, guys.

As Sik mentionned, this intro is mainly made using a table of sprites, with a separate table of attributes to tell them, individually, when to remain behind the logo's layer.

The sin/cos was the fun part indeed. You might find interesting (or not at all) that the cos/sin tables are mainly precalculated, using a piece of Python code :

Code: Select all

# Classic lissajou
def traj0x(a):
	traj_x_amplitude = 128
	return  scr_x_center + int(traj_x_amplitude * math.cos(3.0 * a * math.pi / (rotation_steps / 4.0)))

def traj0y(a):
	traj_y_amplitude = 64
	return scr_y_center + int(traj_y_amplitude * math.sin(2.0 * a * math.pi / (rotation_steps / 4.0)))

# Pseudo bouncing
def bounce0x(a):
	a *= 2.0
	traj_x_amplitude = 128
	return  scr_x_center + int(traj_x_amplitude * math.cos(a * math.pi / (rotation_steps / 4.0)))

def bounce0y(a):
	s0 = traj0y(a)
	a *= 2.0
	a += (math.pi * 0.353857)
	traj_y_amplitude = 64
	s = math.sin(2.0 * a * math.pi / (rotation_steps / 4.0))
	s *= 1.0 - ((1.0 + math.cos(8.0 * a * math.pi / (rotation_steps / 4.0))) * 0.05)
	s = 1.0 - abs(s)
	s = 2.0 * (s - 0.5)
	s *= (traj_y_amplitude * 1.45)
	s -= 4
	s = scr_y_center + s
	s = (s + s0) * 0.5
	return int(s)

# Alternate Lissajou
def traj1x(a):
	traj_x_amplitude = 128
	return  scr_x_center + int(traj_x_amplitude * math.sin(2.0 * a * math.pi / (rotation_steps / 4.0)))

def traj1y(a):
	traj_y_amplitude = 64
	return scr_y_center + int(traj_y_amplitude * math.cos(5.0 * a * math.pi / (rotation_steps / 4.0)))

# Alternate Lissajou 2
def traj2x(a):
	traj_x_amplitude = 128
	s0 = traj_x_amplitude * math.sin(2.0 * a * math.pi / (rotation_steps / 4.0))
	s1 = traj_x_amplitude * math.cos(9.0 * a * math.pi / (rotation_steps / 4.0))
	s = 0.75 * s0 + 0.25 * s1
	return  scr_x_center + int(s)

def traj2y(a):
	traj_y_amplitude = 64
	s0 = traj_y_amplitude * math.cos(5.0 * a * math.pi / (rotation_steps / 4.0))
	s1 = traj_y_amplitude * math.sin(1.0 * a * math.pi / (rotation_steps / 4.0))
	s = 0.8 * s0 + 0.2 * s1
	s *= 1.15
	s += 4
	return scr_y_center + int(s)

Re: Zsenilia (256Kb intro by Resistance)

Posted: Mon Jan 04, 2016 8:39 am
by nolddor
Too much maths for a stupid guy xDD

I can't underestand nothing, but thanks a lot for sharing these piece of code.

Re: Zsenilia (256Kb intro by Resistance)

Posted: Mon Jan 04, 2016 11:23 am
by astrofra
There's no such thing as a "stupid guy".
It seems complicated once turned into Python, but all you need to know is the basics of parametric equations :

The most basic figure you want to draw using a parametric equation is a circle :
http://mathworld.wolfram.com/ParametricEquations.html

Then, you can start playing with frequencies and draw some wavy figures :
http://mathworld.wolfram.com/LissajousCurve.html

If you want to 'live experiment' such equations, I suggest Wolfram Alpha :
http://goo.gl/Prtrr4

'hope this will make it less obscure :)

Re: Zsenilia (256Kb intro by Resistance)

Posted: Mon Jan 04, 2016 2:40 pm
by nolddor
Much better now!

Its time to learn I guess!!

Re: Zsenilia (256Kb intro by Resistance)

Posted: Mon Jan 04, 2016 5:48 pm
by matteus
nolddor wrote:Much better now!

Its time to learn I guess!!
Dude you'd sail this sort of stuff! I've seen your coding abilities you'll be fine :)

Re: Zsenilia (256Kb intro by Resistance)

Posted: Tue Jan 05, 2016 12:03 pm
by nolddor
Have I got any code abilities? xDDDDDDD

Anyway, It seems to be that you need some math knowledge to reach this kind of movements... It's not related to code ability

Re: Zsenilia (256Kb intro by Resistance)

Posted: Wed Jan 06, 2016 6:51 am
by astrofra
It was one of the courses I enjoyed the most at college :')
Back then I wouldn't have imagined it will help me 25 years later!

It was more or less like this :
Image

Re: Zsenilia (256Kb intro by Resistance)

Posted: Fri Jul 22, 2016 6:07 am
by astrofra
The source code was pushed on Github :
https://github.com/ResistanceVault/demo-Zsenilia