Jump to content
  • Advertisement
Sign in to follow this  
Alatar

RTS Terrain

This topic is 3774 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone! I'm not sure if this is the right forum for this, so if it isn't please tell me. I'm trying to make a simple 3D RTS, and I am a little confused about how to generate the terrain. I tried using Programming an RTS Game with Direct3D, but none of its terrain examples work. So my question is would it be better to load the terrain from a heightmap, or use a program like 3ds Max to make the terrain? If the heightmap is best, does anyone know any good tutorials on RTS terrain generation using a heightmap, or any just on creating terrain from a heightmap? I searched on Google, but all of the examples that I found didn't compile and run. I am using Visual C++ 2008 Express and the August 2007 DirectX SDK. All of the articles that I looked at in the reference section were from several years ago. Would they still be good? Any help would be appreciated! Thanks!

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure of what advantage is given by creating the terrain with a heightmap in code.

I personally use a heightmap in a 3d program (Blender, 3dsmax) etc. and just create the terrain in that program and export it as a 3d model.

Share this post


Link to post
Share on other sites
Ryan,

Terrain is generally done in one of two ways.

1. Created as a mesh in a 3D modeling packages and then rendered as a model within the game.

2. Created as a height map and then rendered in-game either using displacement mapping or generating a run-time mesh which contains Y-values pulled from the height map.

Seeing as this is an RTS game you're working with, you lose the advantages of working with a 3D mesh, because in general, you dont want overhanging ledges or protruding terrain. Assuming the usual overhead/isometric view, this would just lead to units getting lost. So for you, a heightmap is your best bet.

With the heightmap you create a texture, either using a terrain generation tool, or a simple paint program which contains the height information for your map. This is usually done in a grayscale format where the color of the pixel ranges from 0 to 1.

Within your game you then load the texture and then create a grid-mesh which has the same dimension as the image. At this point you can use a number of scaling and smoothing algorithms to make the terrain more natural.

After that you can either set the height values of each vertex to the corresponding value in the texture, or you can push the texture to a shader and do the displacement there.

NOTE: Moving this to For Beginners.

Cheers and Good Luck!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!