Tag Info

Hot answers tagged

68

With regards to Java vs C++, I've written a voxel engine in both (C++ version shown above). I've also been writing voxel engines since 2004 (when they were not vogue). :) I can say with little hesitation that C++ performance is far superior (but it is also more difficult to code). Its less about the computational speed, and more about memory ...


51

To generate a voxel terrain (a) A common method is to generate a heightmap using Perlin noise. A heightmap is basically a monochrome image representing different heights by the darkness or lightness of its pixels. You'll look at individual pixels in this heightmap to create "stacks" of voxels up to different heights (z-axis) in different (x,y) locations, ...


35

I'd suggest you start with 2D Perlin-noise. Something like this: Then apply a threshold on the image, so that you get several isolated islands, as shown here: I chose a threshold of 0.04, everything above the threshold would be colored blue. The rest remaining black. Then after that, it's time to determine which "islands" to keep and which to throw ...


35

From a pragmatic standpoint.. If someone isn't going to be playing your game over and over again, but instead is going to play through once from start to end using checkpoints or free saves (like in most non-roguelikes), then why would you spend your time on implementing procedural generation for your world, instead of just making a single, static, ...


32

I think this is good case for using either binary or ternary space partition. On first pass, split house space into halls and {blocks of rooms}. Get next big chunk, split it into {hall and chunk} or {2 chunks and hall between them}. On every step, rotate slicing direction by 90 degrees. Stop when {no more big chunks left} or {total hall area reached limit}. ...


27

The best way to generate interesting voxel terrain is with a Perlin noise density map. Rather than using a 2D Perlin noise map defining the height of a 3D world, use a 3D Perlin noise map. Weight the map so that the values closer to the bottom will be more likely solid, and the values closer to the top will definitely be air. This gives your world height, ...


26

I think I better understand what you are asking now. Noise is not random - it's random-looking but is completely based on a mathematical formula and is repeatable. All the information is encoded in the formula. This means that you can have a formula that potentially covers an infinite area, and just use the formula on the coordinates of the area you need. ...


25

One of the best, and most used, algorithms I've seen out there is generating dungeons using Binary Space Partitioning. The best general explanation I've read is the one found in The Chronicles of Doryen (attached at the end for backup purposes) because explains the procedure without getting into the code, thus leaving the implementation to the reader. Two ...


24

There are two general approaches: The leftmost is termed the uv-sphere and the rightmost an icosphere. GLUT tends to use the uv approach: look at the function glutSolidSphere() in the freeglut sourcecode. Here is an excellent article on producing an icosphere: http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html The uv-sphere ...


24

But why do the first two elements imply a permadeath approach? I don't think character growth or procedural world generation imply permanent death at all. In fact, there isn't a necessarily mechanical connection between any of those three elements (as evidenced by the fact that combinations of a subset of those elements in games exist). I simply think ...


23

Your question leads you into the field of procedural content generation. Tile-based world generation derived from continuous/analog methods By continuous, I means something that is not tiles, something that is analog, an example being a vectorised map. You can use any continuous technique for generation, and then quantise it. For example generate a high ...


22

This tutorial I wrote years ago might give you something like what you want: If you do the island modification in the last step, it tends towards a single landmass that doesn't reach the edge of the map.


22

The term you're looking for is signal processing/analysis There are lots of techniques involved but the fundamental one that those games make use of is Beat Detection. This tries to calculate the tempo of the song and where the beats in a measure are and hence place the obstacles the appropriate distance apart to coincide with each beat. The way that the ...


22

Amit Patel, a user of this site, has created a wonderful resource of information about random world generation that will certainly be of use to you. Further there are some great questions/answers about procedural generation on this site. Road / river generation on 2d grid map Procedural world generation oriented on gameplay features How can I generate ...


21

Whatever format you use for your save games, for goodness sake put a version number in. You'll be able to have backwards-compatiable loads by branching on the version number, or you'll be able to safely recognise saves that are too old to load. You'll regret it if you don't.


21

This has been more or less answered before. Your first stop place should be http://pcg.wikidot.com/ Since I was accused of this not being a helpful answer at all (really? Someone asks for a resource and I post a link to a wiki dealing with the subject?), this page on the wiki deals with Dungeon generators specifically and links to various articles on the ...


20

You can take advantage from the fact that your desired design lumps the rooms in rectangular rooms surrounded by corridors. With that in mind, I would do this: Design the corridors and the "big spaces" for rooms Fill in each "big space" with rooms Filling up the big spaces with rooms can be done easily if you start with the rooms at the borders - they ...


19

Presumably all you need to save is the random seed, which is generally just an int. You could encode the int to base64 if you wanted to make it a bit more opaque, but thats probably not needed.


18

First of all, I'm not sure why you want to implement a height map (i.e. geometry displacement) if people won't be able to land, it just seems more efficient to normal map it or something. With that said, what you want is to convert from an arbitrary (x, y, z) to a (u, v) coordinate, which is trivial. No cubemap needed. Every (u, v) texel has a height ...


18

For the base land, make two 2D continuous noise fields (Perlin, Simplex, Wavelet, a combination thereof - whatever works for you), one with mostly low frequency. low amplitude parts for the upper limit of the land, the other with both high frequency, high amplitude parts and low frequency, high amplitude for the lower limit of the land. Where the lower limit ...


18

To get something like this: Create an icosahedron (20-sided regular solid) and subdivide the faces to get a sphere (see code below). The idea is basically: Create a regular n-hedron (a solid where every face is the same size). I use an icosahedron because it's the solid with the greatest number of faces where every face is the same size. (There's a ...


18

Back when I experimented with this type of thing (late 1990s), I read some papers and books to learn about water flow, but I didn't keep a record of which ones I looked at. I ended up doing my own thing because I wanted to handle erosion. I wanted rivers to produce canyons and floodplains. I wanted dam reservoirs to fill up with sediment. I wanted rivers to ...


17

You could use perlin noise, which is normaly used for heightmap generation. Perlin noise in games Then you could use the heights as an adviser, how high the chance of grass/dirt occuring in one region of the map is. Example (Perlin noise values from 0-256): If the value is over 200 the chance that grass is placed is 80% (dirt 20%). If the value is between ...


16

The textbook definition of "procedural" is something that's generated from some kind of algorithm instead of predefined, i.e. from a level editor or image editing program. See also this question, specifically for procedural textures: http://gamedev.stackexchange.com/questions/327/what-happened-to-procedurally-generated-textures For procedural maps, there ...


16

The midpoint displacement algorithm is exactly what you want. That link can generate something like this: Or like your image, depending on what parameters you use. There's C source available here.


16

I travelled in a lot of "hot" countries in the 10 last years and each time I went to elevated areas it was cold or very cold even when I was close to the equator. In fact elevated areas are semi-arid to arid. Vegetation is small (except some special species like cactus) and burned (by sun and cold). Most of the time, there is very little snow except at ...


15

This is a non-trivial problem. I spent a fair amount of time delving into it last year. You will want to look into the implementation of the first ever dynamic storyteller program, TaleSpin. This was written in 1976 and still things have not progressed much further in terms of dynamic story generation. TaleSpin will give you an idea of the basic elements ...


14

There are a lot of various ways of making mazes. There's a huge list of them and their descriptions here: http://www.astrolog.org/labyrnth/algrithm.htm I think I used the one described under "Perfect".


14

Amitp suggests using watersheds to define various regions, as explained in his post on polygonal map generation. The watersheds are best seen by generating a map using his demo. The advantage of using watersheds to help subdivide continents is that it provides boundaries perpendicular to the shoreline, while mountains usually provide parallel boundaries. If ...


14

How do you generate random X from a seed? a seed value is the initial state of a random number generator. In most programming languages, you can set this seed. For example, C uses srand(). If you don't specify a specific seed to start with, usually a timestamp value is used as the seed. That way, each time you run, the random numbers are different. // C ...



Only top voted, non community-wiki answers of a minimum length are eligible