#### Archived

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

# Implementing Dynamic Height Maps?

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

## Recommended Posts

I''m trying to implement a dynamic height map engine (similar to Chris Sawyer''s Tycoon series). I have done plenty of thought about the subject, and I thought that I should post my ideas here for a bit of "industry scrutiny". Here goes.... My terrain is made up of squares: X--X--X | | | X--X--X | | | X--X--X Each "X" represents a point which can be manipulated. These 9 points are stored floats within a class CSquare. My terrain class, CTerrain, creates an array of these based upon the size of the map specified in the level file. We call: CSquare *** m_aSquares = new CSquare[HEIGHT][WIDTH]; Next comes the initialization. We grab all the heights from the level file, the we''re ready to draw! We first find the square which will be shown in the middle of the screen. Then, based upon the zoom level, we calculate the maximum number of squares which COULD be shown, then we draw them all. Well... what do you think? Have I missed anything crucial? Or is there too much overhead for this system? All thought, comments and anything else are more than welcome! Simon Wilson

##### Share on other sites
Perhaps CSqaure[length][width] would make more sense, since it stores the heights

You could drop the third* if you want:
 ` CSqaure** squares=0;squares = new CSquare*[lenght];for(int i=0;i = new CSquare;//...for(int i=0;i

From the square in the middle & the res/window size, calculate the visible length & width so you know exactly what squares are shown. (might be off a little on the edges, let the clipper get em)

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 23
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631766
• Total Posts
3002236
×

## Important Information

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!