Hot answers tagged

106

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


43

There are couple of things you can do to increase drawing performance. You said they were pretty far away. You could use LOD to decrease the vertex count of those trees, and thus decreasing time required to go through all the vertices being drawn. Even though this is most likely not the issue at hand (GTX1080 with just 10k trees with 200 tris each, puny ...


40

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


40

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


36

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

I'm actually one of the Don't Starve devs (Kevin on our forums). I don't usually handle the rendering stuff, but I can tell you that the game is in 3D. The ground is just a regular 2D tile map with special transition pieces to make corners look better. There's no special Deathspank-style rounding going on, although we have talked about doing that in the past....


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


23

I think part of it may just be that Blizzard has an amazing number of texture artists. But let's rephrase the question a bit: I have a limited budget and want to make a realtime strategy game without obviously tiling textures. How can I accomplish that? Good question! Here's a few big tools that I'd use: 1) A reasonably large set of interchangeable ...


22

Look at one of the classic-style Zelda games. You can create the illusion of hills by using cliff faces.


15

You want to mix different wave lengths with different levels of intensity. E.G. Have one long wave, that has a high intensity, and a short wave with low intensity. Now add the two(or more) waves together. Black line being long waves and high intensity. Red line being short waves with low intensity. Green being the final result. float getHeight(float x) ...


13

You may be confusing some details. A height map is simply a 2D array of data. Each point represents 3 pieces of information: an x and y location and a number to represent the height at that point. For a simpler example, lets look at a 1D array of data that creates some 2D terrain. Each data point here will contain an x location and a number to represent the ...


13

You are ONLY generating Perlin noise. This is actually the same as using only one octave, at any frequency. You can base yourself to implent FBM (Fractional Brownian Motion), It is actually what all engines use to make Perlin noise more fractal looking. Bringing it down to code, you can use it like this: //pseudo code function fBm(float x, float y, float z,...


13

Ok, so the problem was simply that I wasn't using pre-computed realtime GI. I check that on a little while ago but it didn't have an immediate effect so I left it and forgot about it, and the lighting processing time was so long too. However, it just finished processing it, and my word, my fps has jumped up by 3x. So for now, I'll leave it at that and in the ...


12

In each subdivision level, the "square" step relies on the results of the "diamond step". But it also factors in the diamond-step produced in the adjacent cell, which you aren't accounting for. I'd rewrite the DiamondSquare function to iterate Breadth-first, instead of depth-first as you currently have it. Your first issue is that since you re-calculate ...


12

1 : I can't understand at which point down the Chunked LOD pipeline that the mesh gets split into chunks. Is this during the initial mesh generation, or is there a separate algorithm which does this. It does not matter. For example, you can integrate the chunking into your mesh generation algorithm. You can even do this dynamically, so that lower levels are ...


12

Basic chunking is a good way to start. You can move to more sophisticated data structures like octrees later, if you need. For now, simply divide your terrain into chunks of given dimensions when loading the model from disk. Depending on your data, you might either want to split your terrain into pillars on a plane spanning the full height, or in cubes in ...


11

Castle Story looks like this due to technical constraints: Were there to be a heightmap per each voxel in the entire volume, rather than only a heightmap per each surface voxel, storage cost would be vastly greater, on the order of O(n^3) which can be prohibitive, as opposed to a more favourable O(n^2), where n is the side length of a cubic voxel space ...


11

One simple way is to use something like the midpoint displacement algorithm. It can be used to generate terrain, lightning, clouds, and other things as well. (It's a bit old, but easy to understand.) It would also be possible using a Fourier Transform to add in various frequencies at various amplitudes to generate terrain. Some systems, such as liquid flow,...


10

Due to the sheer volume of data in your average voxel world, it will be challenging to draw much geometry with your approach, before hardware limits are reached, without some kind of spatial subdivision approach. You also need to be highly efficient in packing data at the bit/byte level. Method: RLE Enter Run-Length Encoding (RLE) compression as a popular ...


9

Probably the only way to completely get rid of floating terrain is to test for connectivity. Depending on the size of you map, that might be an option. You can do that by picking base point, like the very bottom of your world. Then ensure all your voxels are either: Connected to the base. Connected to a voxel that's connected to the base. Likely starting ...


9

One way to achieve this is to have an additional layer of noise (2D) that controls the height of your current noise. This second layer should be scaled larger to give slower transitions between terrain types. The noise you have now defines the bumpy-ness, this second layer is kind of like a scale that will flatten out or exaggerate the bumpy-ness.


9

Since you're not looking to create layers, or do Isometric, my best idea would to create something similar to a topographic map. The higher the mountain, the darker it gets, and possibly adds distinct features based on your environment (Eg: Add snow the closer to the top).


9

If I understand right, your map stores whether something is dirt or air, and the simplest thing would be to have dirt and air tiles. However, to make things look better, you have separate images for air above dirt, dirt above air, dirt left of air, and so on. So you're trying to figure out which image to use, given a tile and its neighbors. Is that right? ...


9

Check out Amit Patel's excellent article that I feel is kind of a quintessential resource for procedural generation of terrain... http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/ The key thing he does is use graph structure to model his terrain, not straight up noise maps (Perlin et al). I won't embed his illustrations, ...


8

3D noise becomes mandatory if the terrain needs cave networks and overhangs. To extract an isosurface from density information, the 2 most popular techniques are Marching Cubes (MC), and the newer Dual Contouring (DC). The data structure needed is quite different depending on the chosen method. As previously mentioned, Geiss's GPU Gems 3 article is a very ...


7

Perlin noise and friends are a good starting point but you probably want to take it a step further. Most of the popular noise-based generators will give you a fairly uninteresting results. In order to make terrain realistic, you want to take a look at the algorithms emulating erosion effects. One of the most advanced game-ish world simulators out there - ...


7

That picture looks like they are using an extra prop to create the cliff. If you want to use a plain height map to represent your terrain, this is pretty much the only solution. The good news is it is commonly used and works fine. The simplest solution (from a programming perspective) is to just place extra props as needed in the level editor. If you want to ...


7

Notch posted about this on his blog: I used a 2D Perlin noise heightmap to set the shape of the world. Or, rather, I used quite a few of them. One for overall elevation, one for terrain roughness, and one for local detail. [..] But [it had] the disadvantage of being rather dull. Specifically, there’s no way for this method to generate any overhangs. ...


7

As with most terrain generation, noise functions are your friend - Perlin and/or simplex noise in particular. I've implemented some planetary terrain generation algorithms and although they are in 2d, the resulting height / "texture" map could be projected to a sphere rather easily. I assume conversion to hex format is not an issue either. My technique has ...


7

The general approach is called hysteresis: instead of immediately changing when you cross a border, you change only after you are some distance past the border. For the simplest example, suppose you want to draw a warning on the screen if you are too close to something. The straightforward code is: if distance < 20: draw warning But if you're ...


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