I'd really like to incorporate a very simple procedural content generation language into my project, both for my own interest as well as for a technical feature. To that end, I've started working on a simple language, with the hope that I'll be able to express my scene entirely in the language.
I'm also hoping that it will allow for fast iterating once I start adding powerful constructs into the language. Right now I've just got basic parsing and evaluation working, but I think most of the heavy-lifting is done. Now it should be able to add new constructs into the language. I'm calling the language "Welder" for the time being.
Here's my first scene with Welder:
Currently, the only geometry that I've supported is spheres (not even transformations, but, like I said, the language will be very easy to extend). So here, you can see a sphere of quality 4 embedded in a sphere of quality 50. Here's what the code looks like:
group ship
choice
option 1
sphere 10 10
option 1
sphere 50 50
sphere 4 4
instance ship
Like Python, the program's structure will be encoded in tabs. Simple arguments will be delimited with spaces, complex arguments (nested expressions) with tabs.
This stupid little program basically says "define a ship to be a quality-4 sphere, as well as either a quality-10 sphere or a quality-50 sphere (where both are chosen with equal weight); place a ship in the scene." The key idea here is that the above code specifies a program, not a mesh. Once compiled, the program can be run as many times as desired, and it will output different meshes (although in this case, the options are very slim).
I hope to grow this language into a powerful tool to help me in my quest for great ships!

No comments:
Post a Comment