I've been busy working on my little PCG language...and, so far, have had great success! I've managed to implement basic mathematical expression parsing, which led me to be able to implement extruded primitives! I also threw in transforms, out of necessity.
The language is actually already more powerful than I was anticipating. As a demonstration of this, I was playing around with the freshly-debugged extrusion construct, and I realized that there was nothing stopping me from throwing a "choice" block into the extrusion code, since all of the Welder code is treated equally (as generic expressions). Indeed, the "correct" (and interesting) result ensued: for each call to the radius function, the program chose between the weighted options that I had given it. And there you have it - an unintentional mechanism for probabilistic branching in extrusion!
It's definitely good when nice surprises start cropping up - it makes me feel as though I've done something right. Here's an example scene, slightly more interesting than the last one:
And here's the code for the scene:
Pretty simple! The language seems intuitive to me so far. Note that the extrusion operation operates through pre-defined variable names: it binds the "t" and "y" variables with the appropriate values before calling the code beneath, then returns the value of the "r" variable when the code returns. Right now, all variables are global in scope, and I may leave it that way, but I don't think it would take long to throw in scoping.


No comments:
Post a Comment