# Tag Info

17

Split the terrain into square "chunks", load those you care about (mostly: Those near the currently active camera) in Update() and - if you are strapped for space (you likely will be), unload the not needed ones far away. Use pre-calculated low-poly models for far-away terrain LoD, unless you don't mind having a low view distance. Also, if you need the ...

14

What is great with images is that they usually embed up to 4 channels (red, green, blue and alpha). As an height map needs only one dimension, you could just use the red channel to store the height informations (you still have 256 levels for the height), and then use other channels for other purposes (like using the green channel to map the roads, blue ...

14

Requirements You want multiple paths from A to B. You want to work in grid space, presumably this is tile space for your side-scroller. You don't want paths to cross, or it will spoil game progression. You want the paths to look reasonably organic. Voronoi Diagrams Voronoi Diagrams are space-filling, planar graphs: One nice thing about them is how ...

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

I have been able to do this using the 3d modeling software Blender. I used UV mapping to map the texture and the displacement modifier to apply the height map. If you need some form of XNA code for this, I cannot supply it. Here it is as a 3d terrain. Surprisingly, it worked best on a uniformly square mesh. The steps required to create the terrain like i ...

10

I don't think you should try converting the entire map into a single height map, exactly because of the problem you described. Maps can have arbitrary complexity which you wouldn't be able to represent in a height map. But you don't need to have a fixed slope for each type of tile either. You could store collision information on a per pixel basis for each ...

9

Displacement mapping and height mapping are two names for "almost" the same technique, they aim to do the same effect but are used in different contexts. To explain more: Displacement Mapping: Is a technique that aims to render bumps as true geometry, in a very fine mesh. Unlike bump mapping, parallax, and relief mapping which tries to "fake" bumps using ...

8

Displacement mapping can mean (but doesn't always mean) a vector displacement at each point on the surface. Height mapping implies only a scalar displacement value, i.e. each point gets pushed along its normal. The term "displacement mapping" can also be used for scalar displacements, though, so when vector displacements are discussed, people often ...

7

This will really depend on your requirements. How many levels of height are there. Just a few? Hundreds?. Top down? First person? Limit of 1 character per tile or can you use several. What is the terminal size 80x23? or is it going to be resizable. On devices with limited CPU power like a graphic calculator or more beefy modern computers. Text in console ...

7

The problem is that you can't use a simple Sample() call in the vertex shader as it doesn't know what mipmap level to sample from, so the data coming back can't really be a float 4 and the call just doesn't really make sense. In the pixel shader, you need to use: float4 offset = HeightMap.SampleLevel(HeightSampler, input.Texcoord, 0); Changing to that ...

6

ASCII games are really nothing more than just tile-based games that use character glyphs instead of pictures of what they really represent. In general, height fields do not work well in tile-based games. Not unless it's in some kind of perspective view. Height fields generally are used for 3D terrain. When your palette of tiles is limited to whatever ...

6

Before Diamond-Square begins, you'll have to make sure the outermost boundaries (and the maximum number of potential midpoints generated therein) are set equal on either side of the map (in x and y). Only then can you begin full generation of the centre with something approaching a seamless wrap. What they meant by "consistent" is "all outermost corners and ...

6

A basic height map can be produced as follows: Generate a set of vertices that form a grid made of triangles in a regular pattern like A -- B -- C -- ... | \ | / | \ | \ | / | \ D -- E -- F -- ... | / | \ | / | / | \ | / ... ... ... Each of A, B, C, et cetera represents a vertex in the grid. It also represents a point on the height; ...

5

At the GGJ '11 in Berlin one team developed a game using a globus that was freely rotateable. They made the game and the entire source available. It was made in C# and even XNA if I am not mistaken, so this might be a good reference for you. Check it out here. The download link is beneath the group's picture.

5

You should end your spriteBatch before doing any 3d drawing. Always keep 2d and 3d drawing separate. By the way, why are you even beginning & ending the spritebatch if you're not drawing any 2d? Within a spritbatch begin/end, XNA sets various renderstates for 2d drawing. Often these aren't best for 3d drawing... especially if you're using XNA 3.1. In 3....

4

Sprite batches tend to overwrite some render states. Try to set device.RenderState.DepthBufferWriteEnable = true; and device.RenderState.DepthBufferEnable; manually. Hope that helps.

4

Look closely at your own illustration. What you've drawn here is a single two-dimensional array. Make an array of size [MapWidth*2+1, MapHeight*2+1] and store everything there. Elements where both coordinates are even will hold corners, where both coordinates are odd will hold tiles, and the rest will hold borders. You'd have to have a common base class for ...

4

You almost have the right idea, but actually it is much simpler than you might think. The simplest way of measuring steepness is by finite differencing: float GetSteepness(float[,] heightmap, int x, int y) { float height = heightmap[x, y]; // Compute the differentials by stepping over 1 in both directions. // TODO: Ensure these are inside the ...

4

In a nutshell, what makes a shallow water equation a shallow water equation is that the water height is not zero and it assumes no variation in the seafloor. Note: No fluid dynamics equation will allow for a water depth of 0, as that would mean you have no fluid. You should read the Wikipedia article on the shallow water equation. Basically, in shallow ...

3

What you have seems like a lot of work to put your avatar on the terrain at a given point. Here's the method I use to calculate terrain height. Simple pass in your X and Z coordinates and it will return the terrain height. In this case, the scaleFactor you pass in should be 150. Given something like this you just pick two pairs of X,Z coordinates, get the ...

3

Maybe I'm not seeing the whole picture, but can't you just the apply the border (by setting those values to 0 / water) after normalizing? And I suppose you're normalizing correctly e.g: [0,1] = ([-1,1] + 1) * 0.5 Some aditional ideas... last time I generated something like this, I used probabilities and a random number generator. I simply choose the ...

3

You'll need to break up the terrains in chunks, ie. several smaller terrains. Yo'll need to 'seam' those agains eachother (with a script) so there won't be 'holes' between them but otherwise you can just start doing them right away. You might want to know too that since Unity3D ~3.0 you can't move items (read terrains and items) too far away (like +/-100000 ...

3

Although it seems others also gave some answer (i don't know why in comments), here's my experience: there is a physics simulation problem known as heat flow/heat equation. That link gives you the whole idea about what you are going to simulate in that problem. and there are many ways to create an optimized version of that simulation (just need a little ...

3

Performance-wise, both options should be equivalent since everything will be converted to a model sooner or later. Heightmaps: +Easy to store and edit +Easy to calculate texture coordinates if they're not precalculated -Poor texturing on steep surfaces -Needs companion models for better detail -Does not allow overlapping terrain (no overhangs). Models: +...

3

Note: I'm gonna use the term "pixel" here to refer to a unit of land in your height map. I'll assume your definition of noise are groups of land pixel are that smaller than certain size and you want these removed (turned into water). In that case, a simple method may be just counting the total number of connected pixels (size) for each group of land pixels(...

3

Basically, they are the same thing. Displacement mapping is a technique for adding surface detail, like bump mapping. Unlike bump mapping, however, displacement mapping is about actually deforming the geometry based on some input height map (essentially a grid of elevation values). "Displacement mapping" is basically another, more technically accurate, ...

3

Here are four options that you can try: A) Scale & threshold existing output You can ensure that the gradient saturates at some maximum value before reaching any of the cell borders. This will tend to make small holes of uniform size, but you can introduce size variation by assigning a random scale factor to each seed point and scaling distances to ...

3

Assuming you have translated this from the original Java code it looks like you have been a bit careless in adding brackets in a few places. For example the original code has: double t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0; while you have: Dim t0 As Double = (0.6 - ((x0 * x0) - ((y0 * y0) - (z0 * z0)))) which if you remove the brackets is actually: Dim ...

3

A hill like this could be created with the following algorithm: Start with a small circle in form of a regular n-gone (the mountain top). Create a larger "blob" on height 0 by taking the corner-vertices of the previous circle and move each one further away from the center by a random distance. every few iterations, interpolate new vertices on straight ...

2

You seems to render without depth test on. This might make triangles further away render on top of closer triangles since they might be rendered afterwards. The solution is to turn on depth testing in your render setup and set the depth compare function to Less or LessEqual. Remember to turn on depth write too if you happen to have that turned off.

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