Results 1 to 8 of 8

Thread: Context Free City Skyline

  1. #1

    Post Context Free City Skyline

    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
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Guild Adept Alfar's Avatar
    Join Date
    May 2009
    Location
    Denmark
    Posts
    276

    Default

    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?

  3. #3

    Default

    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.

  4. #4
    Guild Adept Alfar's Avatar
    Join Date
    May 2009
    Location
    Denmark
    Posts
    276

    Default

    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.

  5. #5

    Default

    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.

  6. #6
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,251
    Blog Entries
    8

    Post

    Quote Originally Posted by ravells View Post
    the problem with using walks in CF is that there's no collision detection
    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...

  7. #7

  8. #8
    Guild Adept Alfar's Avatar
    Join Date
    May 2009
    Location
    Denmark
    Posts
    276

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •