I just started working on my Protoss AI and the use of their special abilities. The guardian shield was easy to implement.
But I'm stuck now on the force fields. It's easy to make a Sentry cast a force field at a random location, but that location needs to be well considered. One of the most important things it needs to check is the presence of existing force fields and what they exactly block.
There are several pathing related native functions. Some ignore buildings and destructibles and others don't. I expected those that don't to also take into account any force fields because a ground unit needs to path around it. But apparently this is not the case.
As it stands now, I have no way of checking if there is a force field blocking a ramp. All the pathing functions pretend the force field doesn't exist.
I could probably manage to catch force field casts with a trigger and store the location and time of cast somewhere so I have at least something, but that will still make it pretty hard to get any decent force field code working.
Does anyone have any helpful information on this matter?
Mtops Im guessing this is in regards to your "cliff thingy AI".......
Use the same logic you use to find cliffs and choke points
this is why on your other thread I told you,that you would need to constantly update this information....
you should also be checking this to see if players are blocking pathing with units as well... such as bunkers ... supply depots, and other units...
Force fields are basically temp pathing blockers...
for force fields specifically ... you could have another set of data you store and update as you detect the effect being used.... then kinda super impose that over your choke point detection to see where force fields need to be used?
My choke detection logic only responds to cliff edges, ramps and destructibles. Not buildings or force fields. So there is no need to update it constantly.
The pathing algorithms available will respond to buildings blocking paths, so I will be able to detect that.
But I do not have any tools to detect temp path blockers like units or force fields. Do you?
I have tested the trigger and it works. So I will be able to detect the effect being used, just not the effect it has on pathing.
Do you know the way that your units will take to a certain point? (e.g. can you determine the path a unit will take) Or can you only find out the pathing cost to this point?
You can use events to detect a forcefield create unit effect being used and its location so i guess its simple. Time out for forcefield is 15s game time as well
Do you know the way that your units will take to a certain point? (e.g. can you determine the path a unit will take) Or can you only find out the pathing cost to this point?
I have written a function that calculates this, but it uses the pathing costs to determine the shortest path. And since those pathing costs ignore units and force fields, it doesn't help in this regard.
An invisible dummy unit that would collide with force fields would help to figure out if a choke is completely blocked or not. But this dummy should not collide with other ground units because that could disrupt normal gameplay.
Then how about you enumerate each force field currently on the map and check if the closest distance between your path and this forcefield is < 2.
If you find one that is this close you enum all force fields in a small area around this one and see if there is another one that connects to your first one. And so on.
Forcefield is a structure.
maybe save the cost and, if the cost changed too much u know there is a building in the way. if cost return to old value, u know it is a forcefield.
I just started working on my Protoss AI and the use of their special abilities. The guardian shield was easy to implement.
But I'm stuck now on the force fields. It's easy to make a Sentry cast a force field at a random location, but that location needs to be well considered. One of the most important things it needs to check is the presence of existing force fields and what they exactly block.
There are several pathing related native functions. Some ignore buildings and destructibles and others don't. I expected those that don't to also take into account any force fields because a ground unit needs to path around it. But apparently this is not the case.
As it stands now, I have no way of checking if there is a force field blocking a ramp. All the pathing functions pretend the force field doesn't exist.
I could probably manage to catch force field casts with a trigger and store the location and time of cast somewhere so I have at least something, but that will still make it pretty hard to get any decent force field code working.
Does anyone have any helpful information on this matter?
Mtops Im guessing this is in regards to your "cliff thingy AI".......
Use the same logic you use to find cliffs and choke points
this is why on your other thread I told you,that you would need to constantly update this information....
you should also be checking this to see if players are blocking pathing with units as well... such as bunkers ... supply depots, and other units...
Force fields are basically temp pathing blockers...
for force fields specifically ... you could have another set of data you store and update as you detect the effect being used.... then kinda super impose that over your choke point detection to see where force fields need to be used?
@SouLCarveRR: Go
My choke detection logic only responds to cliff edges, ramps and destructibles. Not buildings or force fields. So there is no need to update it constantly.
The pathing algorithms available will respond to buildings blocking paths, so I will be able to detect that.
But I do not have any tools to detect temp path blockers like units or force fields. Do you?
I have tested the trigger and it works. So I will be able to detect the effect being used, just not the effect it has on pathing.
Do you know the way that your units will take to a certain point? (e.g. can you determine the path a unit will take) Or can you only find out the pathing cost to this point?
@s3rius: Go
Having a dummy unit that move at high speed ? guess that wont be fast enough for the needs
@MTops: Go
You can use events to detect a forcefield create unit effect being used and its location so i guess its simple. Time out for forcefield is 15s game time as well
I have written a function that calculates this, but it uses the pathing costs to determine the shortest path. And since those pathing costs ignore units and force fields, it doesn't help in this regard.
An invisible dummy unit that would collide with force fields would help to figure out if a choke is completely blocked or not. But this dummy should not collide with other ground units because that could disrupt normal gameplay.
Then how about you enumerate each force field currently on the map and check if the closest distance between your path and this forcefield is < 2.
If you find one that is this close you enum all force fields in a small area around this one and see if there is another one that connects to your first one. And so on.
Forcefield is a structure. maybe save the cost and, if the cost changed too much u know there is a building in the way. if cost return to old value, u know it is a forcefield.
http://wiki.sc2mapster.com/galaxy/triggers/ai-pathing-cost-unit/
maybe use the preset "Include All Buildings", :D