Archived

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

Mr Grinch

Storing cities for terrain

Recommended Posts

Mr Grinch    318
I''m working on a project where you can sail around an ocean in a ship. The terrain is displayed, and I have the collision detection with it working so you can''t sail through the land. However, I''m trying to add cities to the landscape now. Eventually, my goal is to be able to sail into the city, and switch to a "run around the city" mode. I''m not really sure how to handle the storage of the cities to make collision detection easier. For collisions I can just see if the distance to a city is less that some number and make sure you are pointed towards the city. Although I won''t have a huge number of cities (around 50) and it wouldn''t be that bad of a check, I would like to avoid checking the distance for every city. Doing this in 1 dimension would be no problem, but I''m not sure how to do it in 2 (the ship can''t leave the surface of the water, so I don''t need 3 dimensions). Is there a good way to store the cities so I can make this sort of checking easier? Again, I don''t need help with the collision detection itself, just how to store my cities so the collision detection go faster. If you can give me some advice, or point me towards some, I''d appreciate it.

Share this post


Link to post
Share on other sites
Leffe    301
Umm... will it really be possible to collide with all the cities? I''d say not, you can''t sail on the land, can you? :D:D:D

Just use some quadtree or something for this... and anything else too

Share this post


Link to post
Share on other sites
sSimontis    100
Okay. Use a World Frustrum Radius. This is confusing. You will draw an invisible box around the line of sight. Anything inside the box is visible. As it passes out, you stop the rendering. As it comes in, you render it. i read about this in Dungeon Siege. The terrain is there, but until it reaches an area, it is not rendered.

Scott

Share this post


Link to post
Share on other sites
GreatOne    122
I don''t think its really that computationally expensive to do a collision check in 2d 50 times anymore, but yeah, a quad tree would work pretty well if you wanted to reduce the number of collision tests.

Share this post


Link to post
Share on other sites