Jump to content

  • Log In with Google      Sign In   
  • Create Account


Terrain type related problems in RTS game


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Shockwave   Members   -  Reputation: 167

Like
0Likes
Like

Posted 07 April 2014 - 05:21 AM

Hi,

I've started a small RTS project and had encountered some interesting problems for which I can't find solutions in the Internet and thus I've made my own algos for solving 'em but I'm not sure that I'm not inventing a wheel (and even that it's not a square wheel smile.png ).

 

Lets say we have a terrain built from a heightmap and with textures applied to it using splatting. There are 4 textures: sand, stone (red), grass, snow.

 

1. I want to allow construction of buildings only on terrain covered by stone. One of the approaches I can think of is to have a quadtree structure where sectors have boolean value saying if sector is constructible or not. The smallest size of quadtree's region is a size of smallest building's aabb. This boolean value in quadtree tree node is set according to color of region of pixels in splatting texture (if all pixels are red, mark this node as one in which building construction is allowed).

 

2. I have a vehicle and I want to change its speed according to terrain type (for example, on sand vehicle's speed should be reduced by 0.4, etc.). So I need to know on what terrain type vehicle is on. I thought of checking splatting map's pixel color in the current position of vehicle but I'm not sure this is a correct approach.

 

So guys I need your opinion, if described solutions are good or I'm inventing square wheel. Any help will be much appreciated.

 

Thanks in advance



Sponsor:

#2 Flicklizic   Members   -  Reputation: 435

Like
1Likes
Like

Posted 07 April 2014 - 07:06 AM

You can store the data inside your heightmap, use R and G channels for the height level, B for the construction data and the alpha channel for the speed factor.
 
Using this approach you will only need a short lookup function. Just remember to store the texture info inside the heightmap when you "paint" your terrain.


#3 Shockwave   Members   -  Reputation: 167

Like
1Likes
Like

Posted 07 April 2014 - 08:49 AM

Ok I think I've found solution to all my problems described in the first post. I should generate another grid not for geometry but for logic and store any info I want there (in tiles). I've read about this solution here: http://www.richardssoftware.net/2013/12/pathfinding-1-map-representation-and.html and I think it completely satisfies my needs.

 

 

 

You can store the data inside your heightmap, use R and G channels for the height level, B for the construction data and the alpha channel for the speed factor.
 
Using this approach you will only need a short lookup function. Just remember to store the texture info inside the heightmap when you "paint" your terrain.

 

 

Thank you for your answer but I think I'll stick to having additional grid for storing all required data. As far as I understand this is a common way to handle things in RTS games.


Edited by Shockwave, 07 April 2014 - 08:50 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS