Galaxies

If you have a design you're proud of, share the cfdg file here. It's also a good place to ask for feedback and collaborate.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
nak
Posts: 15
Joined: Tue Jul 01, 2008 10:39 pm
Contact:

Galaxies

Post 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!

Sploopby
Posts: 1
Joined: Tue Jul 08, 2008 4:20 pm

Post 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!

nak
Posts: 15
Joined: Tue Jul 01, 2008 10:39 pm
Contact:

Post by nak »

Thanks sploopby :)

User avatar
askiopop
Posts: 12
Joined: Wed Mar 04, 2009 7:07 pm
Location: Guess

Post by askiopop »

makes me think of the spore intro (when you are intering the main screen)
thank you

Post Reply