• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
  • entries
  • comments
  • views

Density-based Terrain Screenshots mini-post

Sign in to follow this  
Followers 0


Today, in a mini-update, some screenshots of terrain generated by a combination of the Marching Cubes algorithm and a perlin-noise density function.

The images below have 2 parts: a small grid in a 64x64x64 meter cube, sampled at 2 samples per meter, and a large grid in a 512x512x512 cube sampled at 0.25 samples per meter (1 sample every 4 meters). Internally both are represented by the same number of "blocks" - a 4x4x4 grid of "blocks", each block consisting of 32x32x32 samples of the same density function.

The denser grid is suppose to be around the character, however, there's some decisions to make about this method, so no specifics yet.

The whole thing contains something on the order of 80,000 faces.

First an overview of the whole 512x512x512 m cube


And how it looks when the camera is standing at eye-level in the middle of the denser patch:


Note that this method of generating terrain can easily generate overhangs and caves, in difference to a heighmap-based approach. There's still a lot of work to do to make it completely useable, but for now, it's a solid start for my engine's terrain generator.

Sign in to follow this  
Followers 0


Do you generate the terrain in real-time? I'm also working on a marching-cubes terrain, and right now I'm trying to work out a good way to generate new chunks real-time.

Share this comment

Link to comment
I've updated the method for generation quite a bit since this was posted.

Right now I'm generating a 3x3x3 km, with three different levels of detail in about 10 seconds. That's only the startup cost. After that, blocks are generated real-time around the user.
A Block is made up of a number of cells, each cell being a marching-cube cell. (the exact number depends on the resolution). But to avoid repeating samples within the same block, I create a 3d array of samples first, then from that generate each cell, store the triangles in a VBO and erase the samples array.
It works fine for real-time rendering, especially since the blocks are small, and as soon as one gets too far, it's moved ahead of the user to represent terrain there.

Not sure what exactly you need, but that's just a rough outline of what I do.

Share this comment

Link to comment
I'm just trying to find a decent way to generate new chunks in real-time. The plan for my next attempt is to have chunks store 64x64x64 cells, but only generate geometry for one 4x4x4 piece of one of those cells each frame. What block size are you using?

Share this comment

Link to comment
Ok, let's make sure we're talking about the same thing. For me, the most basic unit in my terrain, the little cube that samples the density at the 8 corners, and then creates triangles, is known as '[b]Cell[/b]'. The cells are organized into larger collections called '[b]Blocks'[/b] which get moved around, as necessary. That's just my terminology.

Now here's a diagram of what I use to determine the sizes:


And these is my actual code:

lowResResolution = 10;
lowResBlockSize = 600;
lowResNumBlocks = 7;

midResResolution = 12;
midResBlockSize = 200;
midResNumBlocks = 5;

highResResolution = 20;
highResBlockSize = 30;
highResNumBlocks = 5;[/code]

Edit: the NumBlocks is how many blocks I have per level of detail, on one axis. That means highResNumBlock = 5 makes 5x5x5 = 125 high resolution blocks around the player (with the player being at the center).
I just timed my startup, and to generate all those blocks (high+mid+low ) takes about 6 seconds. This is nothing considering the huge volume generated, and after that you only need to update a fraction of them at a time. Of course this is done all in another thread.

Also, if I'm getting you right, you want to do 64x64x64 samples per block (or chunk, whatever). The point is, if you're using a complex density function that will take a while to generate. (I'm using 2 perlin noise functions, and if I set either to more than 5 octaves it can get pretty slow).

It all depends on what you want to do, but if you don't want long wait times at startup, just create what's around the user, and do the rest at runtime. I also posted a thread on the forums for what 'acceptable' terrain resolution is. After applying texture I found that 1 sample per 2 meters gives pretty good results.

There's dependence on your density source of course - applying the Nyquist rate, if you're density variates greatly every X units, you need to sample every X/2 units for good results. In my case I have control over the source density so I changed it to vary accordingly.

Share this comment

Link to comment
You're right, I was getting my terms mixed up. Sorry about that. And thanks for the info. Like you mentioned, I'm using a fairly complex noise function (ridged multi-fractal, with 6 octaves currently). I'm also doing a pretty high-res sampling so it does take a while. Thanks for your input; I was really just trying to get a feel for the numbers you were using.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now