Following one man's task of building a virtual world from the comfort of his pajamas. Discusses Procedural Terrain, Vegetation and Architecture generation. Also OpenCL, Voxels and Computer Graphics in general.

Sunday, January 20, 2013

Don't be square!

Minecraft gets many things right, but the top in my list is how easy it is to create. Nothing is simpler than laying out boxes. Since everything is square (even the cows), being limited to boxes does not feel bad at all.

If you are doing some sort of sandbox environment going beyond just boxes is not trivial. One possible approach is to do like Blockscape, where in addition to the classic box you now have a large repertoire of prefixed angular shapes. I do not like this approach as it makes the interface very complex and frustrating. It makes you forehead veins pop.

So I chose a different approach, where you still lay boxes the same as in Minecraft, but then you can go back and alter them. I saw that a single operation was enough to produce both curved and straight angled surfaces. If you applied it gently you would get curves. If you applied it more, it would straighten out.

Here you can see a round hole and a needle, both initially created as boxes. It only takes a few clicks to shift their shapes:

I think this is the right direction. Still it is not simple to implement. While I got this thing working, there are many issues to fix.

With the red fog highlight, isn't it hard to tell what surface you are touching? Perhaps you could adjust the color of it slightly based on the normal of the surface underneath. Red for north, green for south, yellow for west, etc... and weighted average them if the normal is facing diagonally.

I'd guess, that at some point he'll get rid of the red fog altogether, it's not pretty (you can't stare at your amazingly awesome builds without seeing it?) Though he could just add a "hide UI" button, I suppose.

Another quick thought: would it be possible to ghost in the effect of adding stuff so you can see what you are placing? It would be very useful considering the more complicated nature of your environment.

wow wow awesome.you ever thought that the alignment of the blocks around the world can be a serious limitation? imagine a "top view" and then you realize that all buildings of the universe is perfectly aligned.I follow your blog for over a year and see your amazing progress.I saw that you care about the detection of patterns. So I wonder if you care about the problem of perfect alignment.

One thing you might be able to do, is have the selection center around the cursor/targeting reticle, so that instead of selecting squares on a grid, you just have a certain sized square which is that size and that position relative to you regardless of where you are. Sure, this would mean you dont have nice big blocks in how the system works (oct-tree wise), but to the user, it will look a lot less like the system is trying to constrain them. Then you could take it a step further, and have it rotate with the user, so that instead of a smooth square, you have a square made of tiny squares if you are diagonal to the grid.

sculpting rounded corners... I didn't see that coming. Simple, intuitive. Looks dead easy on the example in the video - I wonder how it would work on a complex construction with many intricate faces? Does the selection process work on direct line of sight? I suspect that highlighting the correct square might become tricky...

Not for now. There are many things to consider to make this right. For instance it would be nice if you could choose to smooth only in one direction (horizontally let's say) or over just one material, etc. These things are possible with the algorithm, the challenge is devising an intuitive UI.

Line of sight may be useful for selecting some of this behavior. Thanks for the suggestion. I will see if there is a way to bring it in.

looks great- i have a question regards how this increased visual fidelity (curves, holes, spikes) etc feed through to other systems - player collision,physics,flowing water that kind of thing. i assume this all get proportionally more 'expensive' ,is this something you allow to be a concern as you design this or do you worry about those constraints later?

- as you were building the 4 pillars with a roof- i wondered if you could red select the whole (set of blocks ) and smooth them all together- i guess depending on the smoothing/averaging method used you would get different results -including geometry floating in air?

Well you would never get floating geometry from smoothing because it happens over the surfaces. The topology of the mesh never changes.

As to adding complexity, it adds zero. For the engine square blocks are no different that smooth ones. For instance the terrain and trees are already smooth, also the procedural geometry already had aches and weird angles.

i see -it smooths the surface only.re complexity- so if shot an arrow through the hole in the wall in the above video would if know how to collide with the wall bit of that block and not the hole bit ?(Not a great example perhaps but best way i can think of asking.)

Looks impressive, and it's probably really easy to use. In fact, this reminded me of a little 3D-modeling tool called sculptris, that is a real pleasure to use, even for someone with no experience and no talent (like myself).

But, comparing this with my expereince in sculptris, I see one problem: it's very hard to smooth two different places in exactly the same way. In Minecraft, if you want to make your house simmetric, you just place the same blocks on both sides. But with smoothing in the equation, you'd also have to smooth them in exactly the same way... and I don't see any easy way to do it.That's probably not a "deal-breaker" problem, but something worth thinking about, i guess.

I was wondering the same thing, but was hoping you would come up an intuitive UI to let you copy+paste features. Make an arch, somehow select JUST the arch, then copy and paste it wherever you wanted. Repeat for other geometry features.

Like you said, it appears to be mostly in the UI at this point.

Awesome, awesome work in any case. May I say that I predict you will become a millionaire soon? I mean, if Notch can do it with his engine...your engine absolutely can.

I'm not sure of what kind of game you're aiming to do but a copy/paste feature would be awesome indeed. May i add a possibility to save such copied content into a custom brush list for later use ? ( ctrl+c/ctrl+v/ctrl+s functionality )

If you're looking for tools to implement, i think boolean operations would add a lot to the more creative users with an add/substract function but i can't seem to figure out how it would work in-game as in 3ds Max we get to use the gizmos (arrows and circles centred on the objects pivot point).

How about AI-Minions who carry out the players building blueprints (like in Dwarf Fortress)? So the player can lay out entire cities (using powerful tools like copy&paste) without placing everything himself or beeing too overpowered (a problem Minecraft never solved).

O.O I am amazed at the support for subtitles.I personally love subtitles (Grew up with them, Im Dutch =3, its how I learned English) But I always thought English speaking people were pretty much completely against them XD.

<3 i believe you work could benefit from the building system used in starforge.. upon selecting a face as-long as the mouse is held you can draw in that plane horizontal/vertical ... to reiterate .. selecting a front panel allows you to draw left and right and up and down to create a wall that's the same plane as the panel that was selected. so long as the mouse is held down its not possible to miss click on the air or blocks behind/in-front of the wall.. this makes for fast intuitive building. <3

I have only recently stumbled on to this and find it very very nice! Is this something you're working on to release as a game later on or is this more of a proof of concept and just something for you?

I think you have something very good here and potentially as popular and innovative as Minecraft was. I'm hoping you are planning on going further with it and then letting the rest of us enjoy your hard work!

I have a somewhat unrelated suggestion: In Minecraft, I find it quite annoying how you put down a block, and that block then occupies your view in the exact spot you want to continue. It requires one to make micro-adjustments to the crosshair (see at 2:50 in your video) to keep it pointing on the correct block's correct side when building long lines. I suspect this could be improved with some optional snapping: Make the crosshair leave the center of the picture, and automatically stay on the equivalent side of the new block as the last side you targeted, as long as the mouse is not moved too much. To clarify: If I look at the west surface of a block, and place a block, then I want my cursor to automatically aim at the west center of the placed block. While not always good, that is a usecase that comes up very often.

wow this looks amazing, if it would also feature a MC style Gameplay (mining, mulitplayer) then i would definatly buy it.smoothing is good too, only problem i see, is that if your for example making a hallway of pillars, its hard to smooth out all those pillars in the same way. maybe there could be some numbers or another indicator, so you can see the grade of the smoothing/thickness ?

How about using numeric values to represent curves. Assuming we use one of the mouse buttons to apply curves to an object, just use this equation:

duration of button pressed (or mouse clicks) = numeric value.

I know next to nothing about programming but shouldn't there already be a numeric value involving how much curvature is being applied to the object? Just give us a way to copy/paste the numeric value and you could replicate any curve that's possible in the engine.

The problem with numeric values is rarely the programming side, its usually the user side, because users look at numbers and go WHAT THE HELLOUTA HERE! And run for the hills =3. Some of the biggest problems software developers encounter when creating tools, is making it easy and quick to use for users, while still retaining the correct amount of control.

Fair enough, I didn't think of it from a game's viewpoint. A standard point+click+copy+paste system would be far easier on the brain. Though the only way I can think of to get extreme detail is with numbers lol but its not like your trying to build a spaceship (where extreme detail really makes a difference).

Well, it can still be done like its done with the cubes: Have it scalable, but rather than scale in size like the selection square, have it sizable in terms of how fast it rounds.

By the way, it might be easier as a tool if there is a copy paste function, but if its going to have multiplayer support (thinking way ahead again XD), then it would be interesting to see people with skill actually getting asked to do rounding etc. (Thats something I miss in Minecraft multiplayer, people dont really need eachother that much, because they can do it themselves just as well).

That way, youd actually have masons, so perhaps have the copy paste function in, but if/once you add in multiplayer, make an option for the server started to disable it =3.

This is great. Well done, your work will surely add a great deal to the industry and games of the future. I do want to advocate for a paid alpha structure. This is obviously working to a degree that many would pay you just to play with it, and I know some would already pay you for a development license. I'm sure there's alot more coming, many bugs, and other things 'wrong' with it. However since you like the Minecraft analogy, please consider strongly the early access-highly buggy-low price alpha release. This does have to perfect to put out to us, and if it's that bad, lower the pricetag accordingly. Income,testing,joy --failing to see a downside here. Anyhow, thanks again, this is awesome.

The downside of a payed alpha, is that it sort of undercuts the purpose of an alpha test.In any test, be it alpha test, beta test or play test, you want all manner of people, people who will like your game, people who dont, people who are good at your game, people who arent, rich people, poor people, people who never touched a pc etc. etc. (especiailly with the playtest), that way, you get as much feedback as possible, and you get all manner of bug reports. If you make it payed, only the people who are willing to pay for it will play the game, limiting the amount of people playing it. Those people will mostly play the game anyway, as they payed for it, so they want to play, and might not bother actually submitting a bug-report as they might think *Oh, I already payed for that, I dont need to do more effort*. Besides, as his previous blog posts pointed out. Sometimes the least likely bug-tester can find the most bugs (2 year old daughter finding camera bugs most other people wouldnt find or report).

Also, yes, I do kinda make this post partially because I am a cheap bastard =3. But Im not making up stuff!

I'd really enjoy some more tutorial like posts on certain topics. Not step for step tutorials but with more detail, like some pseudo code or stuff like that.

For example how you choose the right parameters for the noise. I'm struggling with perlinnoise3d at the moment.

Or something else would be how to generate the position for the trees? Do you extract the surface from the 3d array? I'm a total newbie on that stuff and it's difficult, at least for me, to figure it out on my own.

I didn't find a good book on that stuff either.

I don't want you to share all your "secrets" just some basic procedural generation stuff to get one going. :)

I have to say that i am clapping behind the screen. This is the far most impressive i've seen when it comes to game engineering.

Though just some questions about details which makes me curious.1. While the game is generated inside the GPU, Are any plans of physics tests (PhysX or Bullet Physics GPU) planned?

2. I haven't seen any oceans or rives in the engine yet.I assume you use some kind of clay-mesh creation.

3. Perhaps far distanced terrain would be faster to render with some kind of heightmap raytracing, which they use in Just Cause 2?

4. How much CPU is left out for game logic in general? Does most games with this engine require more than 2 cores if they are impleting heavier algorithms (such as physics, Mass flocking and that) or is the CPU rarely used in the engine?