Calculating RTS build radius

Hey guys,

I’m currently creating an RTS, and it’s going great! Having loads of fun creating it, actually (:

I just realized one little problem, though, and simply haven’t been able to wrap my head around it… I can build buildings anywhere on the map!

How would one go about calculating the bounds in which buildings can be built around their base? I’m thinking something like a Physics.Checksphere from buildings they have already built, allowing for gradual expansion of their base over time… But how would I be able to visually show the user that information? I’d like to construct circles along the ground like they do in Command and Conquer… I was going to do it with just placing textures on the ground, but I don’t think that’s how they did it because, in C&C, if one circle overlaps another you won’t see the other half of the circle, etc…

It doesn’t have to be exactly like C&C, or even remotely like C&C for that matter lol. I just don’t know how to calculate bounds for something like that while simultaneously giving the user a visual cue.

Keep the two tasks separate.

To calculate if a position is valid simply create circles around all of your buildings. If you have a small number of buildings you can test the distance from every building. Or you can use an overlap sphere from the new building location to see if there is a valid close building.

For visual display I would suggest putting the data into a texture that you can overlay on your map/terrain. Iterate through each building. Generate the circles and add the data to a texture. Be sure to add in such a way that you are only adding valid points to the texture and not clearing previously validated points.