HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to detect water?

11-23-2003, 01:16 AM#1
AIAndy
How do you detect if at a certain point there is deep water?
I need that for some scanning of the map I am doing to determine where one can walk and where not. Currently I am using a unit, instantly moving it to the points that need to be checked and then looking if it actually is there. On land that works fine but on water it seems that he does move even non swimming units to deep water.
So I need a fast way (there are many points to check) to determine if a certain point is passable that works even on deep water.
11-23-2003, 10:20 AM#2
Vidstige
I have also been thinking of some map scanning. I will start using your teleportation trick and see if I get any idea about the deep water problem.
11-23-2003, 10:30 AM#3
AIAndy
The only way I have found until now is to teleport them there and then order them to move. The problem is that that is probably way too slow. My best bet up to now is to do a low res scan with that moving and if I find a water point flooding the area around that in the pathing map with false until the cliff level changes. But even that is probably rather slow and especially it will miss smaller water areas due to the low res (although these might be neglectable on most maps).
11-23-2003, 12:06 PM#4
Cacodemon
Read another thread about cliff detection - information posted there may be very useful for you.
11-23-2003, 12:35 PM#5
AIAndy
I have read that thread but it does not solve the water problem at all. What I need is a way to detect if a certain point is passable. The unit location method works for land but it does not recognize deep water as non passable.
11-23-2003, 01:36 PM#6
Cacodemon
Water depth can't be changed during the game so there's another way. While working in WE you may define regions (not rects!) overlapping deep water areas then process that regions with special triggers or scripts.
11-23-2003, 03:15 PM#7
PitzerMike
Okay Cacodemon, but I bet this is to improve the behaviour of AMAI and therefore it should be independent from any precalculated stuff and work for every map.
11-23-2003, 04:40 PM#8
AIAndy
Exactly, that is what I need it for. Actually it is a pretty easy question I want to answer with all that effort.
I want to make the expansion site choosing different each time. I know a way to expand manually to a specific mine but the problem is that I do not know which mines are actually reachable. For that I want to scan the map and run a pathing algorithm to determine which mines I can reach. Of course there are other possibilities like advanced map analysis once I have a pathing map.
The only thing missing is to mark water areas as unpassable.
11-23-2003, 08:03 PM#9
Cacodemon
Is there another ways? Only using regions or external programs I guess. But... If you want to detect is distant gold reachable or not just send one unit there avoiding creeps. If it reaches gold mine, all is ok else you AI may guess that mine isn't reachable.
11-24-2003, 01:44 AM#10
AIAndy
Yes, I guess that might be possible. But I have other things in mind that I could do with the pathing so I'd rather do it that way.
Another method I thought of is to kill a transport over the point in question and look if the unit in the transport is alive after that. Is there any way to move a unit instantly into a transport ?
11-24-2003, 10:01 AM#11
Cacodemon
AIAndy:

You have to kill so many transports to know path... Also you may add unit's location to location array every second so if unit reaches destination, you'll know path points. Else you can destroy array data and try again. You should use hidden units for this...
11-24-2003, 11:54 AM#12
PitzerMike
maybe keep track of the positions of several units.
A location where after 15 minutes still no unit was could be unpathable...
11-24-2003, 12:29 PM#13
AIAndy
Well, that would not help me fill the pathing map but it would solve the original problem.
Can hidden units be moved by orders ?

To fill the pathing map I guess the best way is to create hidden units at all the points in question, move them by order to a nearby point and then check after a short duration if they actually moved. Is there any changing delay on orders given by trigger in multiplayer?
11-24-2003, 03:24 PM#14
Vexorian
arg, I just logged to tell you that you should use the pathing system you made for the contest to improve amai behaviur in island maps.

However it is quite a problem to detect water if even the units can be moved to it, did you try by creating an unit?
11-24-2003, 04:16 PM#15
AIAndy
Yes, I did.
I guess I will check the expansion reachability by moving units for now and maybe later try to complete the pathing map by a low res scan with units and small move orders to see if they can move and then fill neighboring grid fields that have the same cliff level with false.

EDIT: When I tried to implement the moving units to check if an expansion is reachable I ran into more problems. Since I am doing this for AMAI all the player slots might be used up and I cannot use triggers. The problem with that is that units in the neutral slots have that bad behaviour of returning to the start location. If I repeat the move orders every 7 seconds most of the time the units just stand there and it gets worse with every additional AI (since each AI sends a unit to every expansion). It seems that there is only a limited pathing time available for each player because when I spread it among the neutral slots it gets better. But still that is not enough when there are many AIs in the game. Now I also found out that from a certain distance from the start location that return order is no more given. Does anyone know any better solution to that or the exact distance from where the return order is no more given ?