You can get Voxel Farm now. For more information click here.

Monday, May 5, 2014

Grammar Time

Yes, grammars. The last update had a hint of this, but here you can see them in more detail. As you probably know, we are building a repertoire of architectural grammars. The following video shows a few of them:

This set is geared towards medieval, fantasy settings, but I suspect most of these grammars would hold for a different theme.

This system becomes very interesting once you consider ending building blocks could be replaced by elements that tie closely to your project's vision. At any time you could replace the arches, columns, ornaments, even bricks, by custom components you may have sculpted earlier. What the grammar gives you is the order and structure of these prefabs, but the final look and feel can be pretty much up to you.

As you can see for the moment we are focusing on smaller grammars. You can think of these as smart brushes that will allow to lay walls, floors, bridges, even towers in the locations you choose.

While grammars are able to express entire buildings (even cities), I believe we need to start small and allow you to place these smaller elements following your imagination. Also there is little point in generating an entire castle if the building elements are not interesting enough. So we are making sure we have a solid repertoire of grammars before we take on larger things. Even something as simple as a basic stair tool can save you a lot of time.

As usual let me know what you think. I'm in particular interested in how many of these do you think we would need for a particular theme, how generic or specific they should be, what kind of parameters would you like to have as inputs.


  1. This concept of Grammar that you are building is amazing.
    It's my childhood dream becoming true, good job Miguel. It's an incredible work, what you show to us. I follow your work for years, since your first post about octree in 2010, since then, I read all you have placed available here. And I learn too much with that. Now all I can say is Thank You.
    I had already tried something similar, spawning pre build meshes and a procedural texture, to avoid a repetition very evident. You beleave it is possible to do something similar the new Allegorithmic tools. Maybe dynamic aging of the buildings. Or procedural edge mapping, in shape edges materials, like stone, or old painted metal, that scratch it on the edge.

    1. Thanks, keep in mind these techniques and the theory behind them were developed by other people who came before me: Lindenmayer, Chomsky and mostly the work of Pascal Müller and his group (btw, meeting him in person was the highlight of my trip to GDC 2014)

      Yes, applying damage and weathering effects is very much possible once you have the resulting structures in voxel form.

  2. I would start with the physical necessities and spiral out, especially since it appears you are going with a medieval theme.

    So start with grammars that can be used to make the essentials, like wells, storage barns, animal fences, and roads. Then expand out to the common buildings. A stable, family-sized houses, a meeting hall, a hospital. (Really, those are all variants of the same building.) Then get into the bigger picture structures, like castle walls, gates, lookout towers, etc.

    Something to consider: at least in my part of the world, most houses are poorly planned. They belong to one family, and then a bigger family moves in and adds a bedroom in a convenient direction, and then another family moves in and decides they need a workshop, and so on. A lot of houses make no sense if you look at their blueprints, and it gives them a very organic feel. I find that a lot of video game houses have repetitious layouts, because they weren't generated over time the way that many real-world houses are.

  3. Are you familiar with Introversion's city generator?

  4. Can you add snap points to grammars? When using grammars as brushes to create larger worlds it would be very useful if there were smart mates/snap points that could be coded into the grammars. This would allow a user to rapidly align adjoining grammars. Building road/rail ways quickly with a set of smaller track pieces. Or even creating buildings in a room by room fashion with custom floor plans.

    1. Not yet but definitively we want to go there.

  5. I have mixed feelings about it.

    It's an awesome tool for sure, but who is it for? If we have in mind a player in a voxel world where resources have to be gathered, this tool is counter-productive as half of the pleasure is in placing bricks, not in programming walls. If a castle can be created in 10 minutes and perfected in an hour then all castles are meaningless - you just stop noticing them after the first 20.

    If it's for game developers on the other hand, there is no point in using a voxel engine, because players will almost always leave these objects unmodified, like they do in any other game.

    I can see it being used in something like Worms Forts, where you had a voxel world you were destroying, but there's not much else you can do, is there?

    1. Game devs can totally use this system. Remember, this has a mesh output system.

    2. I see your point, but I don't judge the castle by the effort that went into it. I judge it by the results. I think this will enable players to give more focus to detail. For developers I think it's more about generation than building.

      It all depends on how easy it is to use. As a player, I think two grammars (one for basic tesselation, and one for axial symmetry) would go a long way.

    3. You would not be programming walls, you would be placing them. If you want to place individual 1x1x1 voxels you can still do it. I remember a similar argument around the use of copy & paste and templates (including your concern about material use). I do not think it has taken any of the pleasure in building, quite the opposite, it makes it possible to take on larger projects.

      As to how original the creations can be, it is really up to the creators. This system allows a great degree of personalization without any programming. Yes, maybe this will allow a player with no skills to create a generic castle in 10 min. That may still be preferable to whatever this player would have created if we didn't have this kind of tool.

    4. I agree that the hands-on aspect of building is fun, but I also like to have powerful tools to save me from drudgery. Part of why I never went far with Minecraft was because I didn't like having to place every element and I was too lazy to look for tools to automate the process.

      And I agree with zeuljii that for me the result is more important than the path. Not that the path isn't important, it's just not as important to me as the art itself.

      But I also think you speak for a lot of other people. It's a good point to keep in mind when designing an end product (game or otherwise).

    5. Absolutely, these mixed feelings are justified. But the potential alone is worth the exploration. I feel I have no choice but to find out where does this lead. Also my gut feeling tells me it will be awesome.

    6. Have you tried taking it to the extreme? I'm thinking about randomization. How usable are random grammars? If we randomly generate a 1km x 1km x 1km labyrinth (corridors are too high level, just random "buildings"), how would it look? If it's a complete gibberish then can we restrict the set of grammars easily to make it produce a more usable results? Imagine a sphere this big in a naturally generated landscape!

      Such a generator with some simple game mechanics is a finished game that will have a cult following.

    7. Presumably the system could calculate how many resources are needed to construct a particular building part and build it as you add resources. You could even have a "ghosted" part visible and place the component bits bit by bit if you wanted to do it that way, "filling up" a predefined wall or whatever.

  6. It would be nice sometimes to have a "references" section on each technical post like this so we can check out your inspiration.

    From the first comment, it looks like some persons think you invented all this stuff sometimes.

    1. He may have not "invented" this in the strictier sense but VoxelFarm undoubtly is pushing very hard on the boundaries of all this technology and "discovering" at least how to implement a buch of theoretical equations into hard-ground code.

      Miguel already listed a lot of articles that inspired him in (much) earlier posts and I dare say that currently VoxelFarm is innovating.

    2. Yes, it bothers me too. But note this is not a technical post. These references do appear where these things are introduced and discussed at depth. For practical reasons I cannot include a list of credits on every bit of info I publish.

  7. My initial observation is that I saw mostly external elements, outside walls and such. I hope you also have a wide selection of interior elements: hallway sections, room sections, niches, church spaces, attic spaces, rafters, floors, ornate ceilings, grand foyers, etc.

    I'm as excited to build for insides, grand mansions and sprawling underground lairs, as I am for outsides and suspect in fact that interiors may take up more building time & space than the exteriors, and special brushes should be proportional to that.

  8. You touched on my biggest thought in your blog already:

    Seeing how these grammars are constructed, it would be extremely powerful if we could use the layout of a grammar as a template and replace elements of it with things that we construct.

    That way you get the personalization and individuality of your own creation, but combined with the power and flexibility to make something that scales like these do.

    In other words, it would be cool to specify the building blocks that the grammars are made of. Say I like the bricks in the wall, but I want the top to be a little different, so I specify a selection of voxels to go on top. Then maybe it needs something as a base on the bottom, that could be specified.

  9. These are very nice and spur the imagination. Are they modifiable once set into the world? That would be my biggest concern. I wouldn't mind using them as starting points but would like to make them look different if I so choose, otherwise it is probably best to just build my own to begin with.

    1. Good question. I think (according to the previous videos) that this acts like a paint brush. Once placed into the world, it's transformed to actual voxels so you would have to cancel the creation with a Ctrl+Z, edit the grammar and paint again.
      I believe the grammar editor has a preview function anyway but I guess it would be nice to preview in-engine with instances of the object to be voxelised.

    2. Depends on how you do it. In the demo for the April's update you preview the results and tweak them, when you are ok you write them as voxels. You can proceed to copy/paste the results, delete, smooth, paint, etc. They are now voxels, no different from the ones you place manually.

  10. Greetings,

    As always, i'm amazed by the work you've done. Congrats, I can't wait to try this !

    Since you asked, here are some things that I'd like but it's probably already possible :

    - The ability to define textures/materials to parts of the objects so that we could define for example rock/brick/wood/slate for the various parts like of the tower with a roof at the 1:18 mark of this video.

    - The ability to set more varied and random values to the fillers like the wall bricks that seem too much identical in shape and size, it looks too "clean" right now. I think it should allow for random column and row merging where up to 3 or 4 bricks could merge to form a larger rock and some rows would colapse from one side to the other. This could depend on other factors such as terrain slopes.
    This could be under some sort of "mutant" parameters if you know what i mean.
    Here is an example :

    - The ability to define parts of the grammar as being optional or to define the operation (boolean ?) to be done on such parts so that if there is something you'd like to keep on the terrain or to merge with some parts of your new construction, the part of your new construction that collides would be omitted or they could merge the way you want (keep a specific tree in the middle of a new tower), build a wall that keeps specific terrain features intact (rock formations, rivers...).

    On a side note, what are your projects concerning the texture tiling ? I'm not sure but on the last video i still noticed repetition on the wood and stone and after reading a bit on the subject, there are quite a few techniques that are best suited for either natural materials or human made materials (patch based / wang tiles).
    Do you think it would be possible to choose between any of these for a given material or is it best for an engine to stick to one technique for the entire textures ?

  11. "I'm in particular interested in how many of these do you think we would need for a particular theme, how generic or specific they should be, "

    My guess is I'd want a dozen generic multipurpose grammars that come prepackaged and a few specific representative examples. On the high end I'd create a dozen custom grammars specifically for the build I'm working on and tweak them as I go (a house, a staircase, a couple types of furniture, a couple inlays).

    Do you think grammars could be used to more efficiently represent voxel data?

  12. This is great. I've been playing around with EQ Landmark over the last month or so. What grammar will allow is a transfer of creative energy to decor, interiors, story elements , and themes within a build. Currently simple building takes a lot of futzing and tinkering in Landmark. That is great for individuals looking for a block style builder, I used to love to make wood block towers as a kid... and knock them down in creative ways as well. =)

    However, all that futzing and tinkering in Landmark erodes away at creative energies that could be applied to interiors, props, themes, and hopefully npc setup / dungeon building later on.

    No doubt grammar based builds could be used in a number of ways. They appear detailed enough to be dropped into place. Or, the way I view them, they can also be used as the wire frame sketch for the rest of the art. Once in place we can tweak and edit them to personalize the build.

    Players will not loose any creativity with this tool. It will allow individuals to better prioritize where their creative energy is invested. Without a grammar system individuals have fewer choices for their creative investment.

  13. Let's not mistake creativity with tediousness.

    The faster you can prototype what is in your head to "e-tanglible" assets the better. This is where this system will shine.

    It is not for sculpting and detailwork.

    For no-lifer an idea of slowly, brick by brick building a city might seem fine. For those that understand value of time - not so much.

    Also- it follows established architectural practices. Would like to see more fachwerk style assets though. Staircases of any shape and form (esp. spiral ones) are incredibly usefull. All in all - if you are familiar with Revit, well that's kind of functionality to be desired. Actually you can turn that into architectural tool.

    Great update!

  14. It would be interesting to somehow add some terrain data as input to the grammar, so the output would be different depending of the position it's going to take in the world.
    I'm not sure to be clear so let's add an exemple, it would be amazing if we could get a "road grammar" that could automatically output bridge and tunnel. in the right circumstances.
    Did you guys think about it ?