Jump to content
  • Advertisement


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.

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

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 this post

Link to post
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<length;i++)
squares<i> = new CSquare;


for(int i=0;i<length;i++)
delete squares[i];
delete[] squares;

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)

Share this post

Link to post
Share on other sites

  • 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!