107

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 management. ...


58

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, ...


51

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 away. ...


50

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}. ...


49

Here's a rough idea using image processing transformations to isolate the features of interest: Apply a flood fill from an ocean cell to make a mask of all ocean cells. Depending on how your rivers are set up, you might need an extra elevation or clearance criterion to keep the ocean mask from flowing inland. ;) Apply a local smoothing to the edge of this ...


44

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, well-...


39

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 ...


39

In the real world, those provincial borders will often be following geological features like rivers. So maybe a good approach would be to model the geology of the island and have the borders fall out of this? Red Blob Games has some good articles on this subject, with nice looking results. His approach seems to involve using Voronoi tessellation, and ...


35

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 ...


35

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 ...


34

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 ...


34

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 ...


33

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, ...


31

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 proof ...


30

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 that ...


29

The way Dragons Abound identifies bays is to walk along the coastline and find two spots on the coastline where the straight-line distance between the spots is less than the distance along the coastline between the spots. This is the sinuosity of the coastline between the two spots. By selecting a sinuosity limit and limits for the straight-line distance ...


28

By way of analogy A circuit does not generate power. A light bulb does not generate power. A battery does not generate power. None of the things which use or store generated power, are power generators. A gasoline-driven generator is a power generator. A solar panel setup is a power generator. They can be expected to spontaneously generate when they are ...


27

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 ...


27

I would solve this problem with two passes of Voronoi diagrams: First Pass: Region Partitioning The first pass would use a somewhat sparse distribution of points (i.e. the distance between the points should be relatively large) in order to roughly divide the island into regions (see the note below regarding point generation). Next generate a Voronoi ...


26

To briefly answer your main question first, the main advantages of a procedurally generated game world are that: The world can be huge, much larger than any manually designed game world could possibly be. The world (or at least parts of it) can be regenerated for each game, potentially increasing replay value, since the player will always have something new ...


26

Personally, I find symmetry in level design to be boring, and I don't think it's necessarily the case that it's needed for fair levels; symmetry is a way of ensuring that everybody has access to the same resources and the same bottlenecks by virtue of the level literally being mirrored for each player in some fashion. I think the important part is access to (...


24

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 have ...


24

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 ...


23

Use a slice of higher-order noise. If you used 2d noise for a height-map before, use 3D noise with the last coordinate fixed instead. Now you can slowly change the position in the last dimension to modify the terrain. Since Perlin noise is continuous in all dimensions, you'll get smooth transitions as long as you smoothly change the position where you sample ...


22

"Procedural" means that some algorithm made the content. This is opposed to content being created manually by a human. "Dynamic" means that the content changes over time. This is opposed to "static" content that does not change after being created, or only changes in predefined ways e.g. key-framed character animation. You can also have in-game player-...


21

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 ...


21

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 ...


21

A good place to start with procedural city generation is Parish and Müller's Procedural Modeling of Cities. Their paper presents an L-System in which rules concerning population density & road patterns (rectangular grid, radial & least elevation change) are combined and then fixed to accommodate local constraints such as water fronts & road ...


20

L-Systems, from what I can tell*, are a set of grammar-like substitution rules that you can apply recursively to get interesting, "organic" results. Plants are where L-Systems are often used, as they show a lot of recursive growth (i.e. branch splits off into more branches). For a simple example, I'll show a "lollipop" tree generated using an L-System: ...


19

Cloud generation is fun! I'll cover both offline and runtime methods. Pre-rendered clouds If you want to pre-render your cloud textures offline, look no further than Photoshop (or Gimp, if you prefer). Both programs can easily generate cloud patterns. Menu items tend to move around between releases, but as of Gimp 2.8.2 the core command you're looking for ...


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