Page 1 of 1

Galaxies

Posted: Wed Jul 02, 2008 5:44 pm
by nak
Hi, my friend linked me to context free a few days ago, and I just had to start playing around with it!! The gallery is beautiful.

Also, this takes a long time (compared to my first) to render, I don't know if I have some inefficient code or if there is a way to set a loop instead of an "infinite" recursion. (I thought I read something that loops were included in the beta)

ANYWAY! Here's the file *edit* I added some more:

Code: Select all

startshape FINAL

background  { b -1}

rule SPIRAL {
	CIRCLE { y -1 s .05 }
	SPIRAL { y .1 x .9 r 70 size .99 b .99 h 15 }
}

rule GALAXY {
	SPIRAL { }
	GALAXY { x 1.5 y 1.5 size -.99 r 17 skew 5 10 }
}

rule NEB {
	CIRCLE { s 5 sat .5 h 10 a .5 }
	NEB { y 1 r 30 s -.90 b .01 h .5 }
}

rule NEB {
	CIRCLE { s 5 sat .5 h 278 a .5 }
	NEB { y 1 r 30 s -.90 b .03 h .5 }
}

rule STARFIELD {
	CIRCLE { s .1 b 1 }
	STARFIELD { s .90 x 8 y 4 r 70 }
}

rule STARFIELD {
	CIRCLE { s .15 b 1 }
	STARFIELD { s .90 x 4 y 8 r 34 }
}

rule ANOTHER{
	GALAXY { }
	NEB { z -1 x -2 y 4 s .5 }
	ANOTHER { x 2 y 15 size -.75 r 17 }
}

rule ANOTHER{
	GALAXY { }
	ANOTHER { x -1 y 20  size .90 r 30 }
}

rule ALL {
	ANOTHER { }
	ANOTHER {  x 5 y -4 r 95 }
	STARFIELD { z -2 x -2.5 }
}

rule FINAL {
	ALL { r 90 }
}
And thank you in advanced for any pro-tips!

Posted: Tue Jul 08, 2008 4:32 pm
by Sploopby
Cool! I'm also new to Context Free, but I'm really liking it.

To do a simple loop, the syntax is integer* {adjustments} name {adjustments}, where integer is the amount of times you want to loop. Another way to prevent infinite recursion (you might already know this) is to make an exiting case, and weight the odds so that it doesn't come up very often. So, in your case, you could have:

rule ANOTHER 0.01{}

And that would eventually end the recursion. The reference card really is handy for remembering stuff like that. Hope that helps!

Posted: Tue Jul 08, 2008 5:17 pm
by nak
Thanks sploopby :)

Posted: Wed Mar 04, 2009 8:48 pm
by askiopop
makes me think of the spore intro (when you are intering the main screen)