Game Development Community

Overlapping Buildings that share same location

by Angelo Coccettini · in RTS Starter Kit · 08/28/2005 (3:40 am) · 2 replies

Hello,
I have succesfully installed the world domination pack, that made me very happy as my game is evolving quite quickly. I can now create a sort of little village with basic building type, but with the possibility to add other buildings and other type of unit. I have also added the possibility to put units in formation.. very cool! There is now a thing that I find quite annoying, and my (still) limited knowledge of the whole system impedes me to find a correct solution. The problem is when I place building on top of other buildings and both share the same location, making the game quite ugly. The best solution would be a different texture (like a red one) on top of the forbidden areas, but this lead another problem, how can I identify forbidden areas? I see that when the mouse passes over the building, there is a circle that appears. It is possible to "intercept" that event? Another solution could be to create an array of positions that is inspected each time I need to place a new building. This approach should be quite easy to implement, but of course it is very memory demanding (an array of 256x256 position brings to a 65535 elements, not big but rather annoying). I think that this topic should have been already posted, and somebody should have already investigated on the matter. It is possible to have a short hint at least to have a direction where to go?
Thank you so much and regards


Angelo

#1
08/28/2005 (7:28 am)
It does a Ray Intersect on the location where you click, just change it a little so it will check if another building is there. I'll seee if I have time today to write this up.
#2
01/19/2006 (7:53 am)
Robert, did you ever implement this type of code?