Hmm. Okay, in this context, an L-system is sort of like a grammar with extra information. Doesn't help much, eh? :-)

Here's a simple example: random models of trees (those big leafy things in the room with the tall ceiling, not graphs). We can describe a (kind of) tree with this L-system:

Tree: Stick . (Branch)+ Branch: Stick . (Branch)+ | Stick . Leaves Stick: <model of a stick> Leaves: <model of leaves>

Basically, a tree is one big stick (the trunk), with a bunch of branches on the end. A branch is a stick with a bunch of (smaller) branches on the end, or a stick with leaves on the end. Sticks and leaves are "terminals": they're well-defined, and we don't make more of the model once we're at a stick or a leaf.

There's a lot of information that we didn't specify for each of these rules. For instance, we don't want to have branches scattered just anywhere on the trunk; we probably want at least one or two of them right at the top. We also don't want them growing at just any angle; probably around 30 degrees of the branch they're growing off of (we pick the exact angle for each branch randomly). But that's the basic idea. (You can find a nice demo of L-system trees here.)

Now, the interesting thing about L-system modelling is that it gives you different results each time, but those results are all related. You won't get the same tree twice (well, okay, up to the period of your PRNG) from this system, but you'll always get trees. So what if you apply this to a different problem? What if, instead of a grammar for trees, you make a grammar for fighter craft in a Homeworld-like game? It might look something like this:

Fighter: Body . Wing . Wing . Engine+ Body: Fuselage . Cockpit . Weapon+ Wings: (Control Surface) . Weapon? | Weapon? Engine: Intake? . Thruster . Exhaust ...

Now, every time the player encounters a new enemy fleet, you can generate a fighter model that they haven't seen before, but still looks something like a fighter. Your player never knows quite what to expect, and gets a slightly different experience every time.

The really hard part is making these models look good....

--
F o x t r o t U n i f o r m
Found a typo in this node? /msg me
The hell with paco, vote for Erudil!


In reply to Re(3): Looking for Suggestions on School Project by FoxtrotUniform
in thread Looking for Suggestions on School Project by Flame

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.