I'm trying to learn how to use context free to make stuff. Still on baby steps at the moment and have made a small script which will generate simple city skylines.
Example and script below
I'm trying to learn how to use context free to make stuff. Still on baby steps at the moment and have made a small script which will generate simple city skylines.
Example and script below
Ravs! That's pretty cool!
Hey, maybe if you could make it generate a circular layout, you could make city markers for maps this way?
Cheers Alfar! My initial plan was to make it generate little city icons for mapping but I got side-tracked!! I'm also thinking that it might be a great way to generate mountain icons too, but getting that 'handdrawn' look will be a bit of a challenge! I think it is possible though.
Well, it's nowhere near perfect, but I thought it was interesting enough to post:
http://www.contextfreeart.org/gallery/view.php?id=1997 - by yours truly.
That looks pretty cool Alfr!! Really nice perspective view!
the problem with using walks in CF is that there's no collision detection - at least as far as I know which is a bit of a pity. Hopefully will have some time today to make a start on my mountains in CF.
I might be missing the point here but I thought that a context was a collection of state and that the idea of it being free is that its stateless. I.e. after its drawn something it doesn't want to know about what its just drawn. Is that the case or not. Anyone care to expand on that ? I am sure that it has some definite meaning - of which I should look up I know...
No idea redrobes! I was thinking more in terms of getting it to do what I want it to do!
Yes, Context Free means that each rule has no idea what has happened before it was called. The only state that is maintained across calls is the transformations, so if you call a rule with a rotation of 15 degrees, everything after that will be rotated 15 degrees, though there's no way for the script to know that.
There's also no way to know how many times a rule has called itself, so you can't (as far as I can tell) do exactly 10 calls to a rule and have them run one at the end of the previous, unless you can predefine in one transformation statement where each is going to end.
10 * { x 1 } rule Line {}
will draw 10 'Line's at 1 unit horisontal distance.
if the rules for Line are like this, though, you've lost (at least if you're hoping for a 10 step walk with random 15 degree turns).
rule Line 0.5 {
SQUARE { x 0.5 s 1 0.1 }
}
rule Line {
SQUARE { x 0.5 s 1 0.1 r 15 }
}
rule Line {
SQUARE { x 0.5 s 1 0.1 r -15 }
}
You can, of course, do something like copying the rules and doing line1 -> line2 -> line3 ... -> line10, but it gets quite tiresome.