Archived

This topic is now archived and is closed to further replies.

ANSI2000

How to create a large scrolling terrain.

Recommended Posts

ANSI2000    122
Hi I am trying to create an over head action shooter like Raiden but in 3d, I want to create a scrollable terrain that will give at least 4-5 mins of scrolling game play. The terrain is square OS I must simulate it to be rectangualr and longer. SO the height map has to be split up in several pieces. Once the camera reaches one certain level, the camera must be repositioned back down to the next piece. The programming should not be to hard, I am trying to figure out a good camera angle and terrain scalling values any body have any ideas? Or better way of doing so?

Share this post


Link to post
Share on other sites
Don't mess with the camera's position; have it steadily scroll up (or down, or whatever). Let's say the terrain should be a 32x1024 array of vertices: 32 vertices wide, 1024 vertices long. The heightmap bitmap may be a 128x256 bitmap. When you load the heightmap, if the heightmap bitmap is a 256-color (8-bit) grayscale image, do this:


      
#define HEIGHTMAP_WIDTH 32

#define HEIGHTMAP_LENGTH 1024

#define HEIGHTMAP_MAXHEIGHT 4.0 // Change to whatever looks best



// Image is the 128x256 array of bytes

// Width is 128, Height is 256

void LoadHeightmap ( BYTE* Image, int Width, int Height )
{
BYTE Pixel;
float Height;
int XMap;
int YMap;

Heightmap = new float [HEIGHTMAP_WIDTH*HEIGHTMAP_LENGTH];

for( int Y = 0; Y < Height; Y ++ )
{
for( int X = 0; X < Width; X ++ )
{
Pixel = Image[(Y * Width) + X];
Height = float(Pixel) * HEIGHTMAP_MAXHEIGHT / 255;

XMap = X % HEIGHTMAP_WIDTH;
YMap = Y + (Height * int(X/HEIGHTMAP_WIDTH));
Heightmap[(YMap * HEIGHTMAP_WIDTH) + XMap] = Height;
}
}
}

I believe that will work.

~CGameProgrammer( );



Edited by - CGameProgrammer on March 20, 2001 12:13:12 AM

Share this post


Link to post
Share on other sites
ANSI2000    122
The thing is I am using the PR terrain engine. SO I dont need to code anything. If not I should just work on my own engine, witch eventually i will but not now.

Share this post


Link to post
Share on other sites
PsycoBlade    122
Looking straight down looks kinda boring, so if you angle it forward slightly, like 10 degrees, it looks really great. I would also reccomend not having dynamic camera movment (like angle changes and stuff) it takes away from the flow of the game.
-Rich

Share this post


Link to post
Share on other sites
ANSI2000    122
It will be angled the problem is then I see to much of the trrain so then I dont get enough scroll.

I am trying to find good values or someone who has done something similar.

Share this post


Link to post
Share on other sites
PsycoBlade    122
Well, I did something similar.. before Landscape Studio was released I made a very large rectangular landscape in 3D Studio Max. It was at about the same scale as the Landscapes Created with LS...

X - Y - Z
camera souce (assuming Y is height)
0, 1000, 0
camera target (assuming Z is forward)
0, 0, 200


I hope this helps.

Share this post


Link to post
Share on other sites
ANSI2000    122
The problems with splitting the terrain to 4 parts is that if you set to muchangle you see the other parts. I will maybe try it with 3 and see how much scrolling I get.

Share this post


Link to post
Share on other sites