Page 1 of 1

idea for "forbidden zone" calculation

Posted: Thu Aug 26, 2010 2:16 pm
by Starrider
Maybe you can think about some code improvements that the bot doesn't run into barriers. The code was improved in case of calculating the best way between waypoints and that the bot not leave the route to far by the new attacking system. So if it would possibile to set an pointer in which radius around it the bot isn't allowed to cross, when it wants to reach a target or next mob.

On the pictue i discribe what i mean:

the bot runs normally from A->D and leave his direct way to the waypoint if an target is in his attack range. Now he leaves the waypoint to attack the mobs 1-> 4 after mob 4's death the bot calculate the shortest way to the next nearest waypoint.
What is if you think about an development on the waypoint system to add a "forbidden zone radius".

When you create your waypoint file you go to such barriers and mark them with a new waypoint function. This waypoint ist saved at the beginning of the waypoint file and is loaded at the beginning to be not entered when the bot calculate the route between all following waypoints and does automatically to forgo around them.

Re: idea for "forbidden zone" calculation

Posted: Thu Aug 26, 2010 6:47 pm
by droppen
hmm, do you mean like mark an area in witch to fight mobs, or make the bot not go too far from the points?

Re: idea for "forbidden zone" calculation

Posted: Fri Aug 27, 2010 4:29 am
by Starrider
You can seperate it, one marker is Elite/boss area, one marker is barriers, but isn't really necessary.
Maybe devide in small (for fences or points on the map the bot can't walk up)/middle (larger objects like houses) large (mountains). So you can set different values.

I am no math expert, but if you create an area for example a circle around the marked point, you need a formula where the bot calculate the circle/ elipse around it, then the bot decides the shortest way around this point on the circle line. That could he do by comparing the lenght the bot has to walk on the circle. Then you need dynamic new waypoints until the next static waypoint is reached.
that the bot doesnt enter the cricle is garuanteed by that the bot takes the total length of the way on the circle, devides it by the max distace between two waypoints f.e. lenght is 500 max distance between two dynamic waypoints is 100 the bot has to calculate 5 waypoints on the circle.

Its only a suggestion, i think rock5 is the formula and math expert XD maybe he has an idea if this is realizable

Re: idea for "forbidden zone" calculation

Posted: Fri Aug 27, 2010 5:33 am
by rock5
Starrider wrote:You can seperate it, one marker is Elite/boss area, one marker is barriers, but isn't really necessary.
Maybe devide in small (for fences or points on the map the bot can't walk up)/middle (larger objects like houses) large (mountains). So you can set different values.

I am no math expert, but if you create an area for example a circle around the marked point, you need a formula where the bot calculate the circle/ elipse around it, then the bot decides the shortest way around this point on the circle line. That could he do by comparing the lenght the bot has to walk on the circle. Then you need dynamic new waypoints until the next static waypoint is reached.
that the bot doesnt enter the cricle is garuanteed by that the bot takes the total length of the way on the circle, devides it by the max distace between two waypoints f.e. lenght is 500 max distance between two dynamic waypoints is 100 the bot has to calculate 5 waypoints on the circle.

Its only a suggestion, i think rock5 is the formula and math expert XD maybe he has an idea if this is realizable
It would be a lot of work but it could be done if it was only 1 point but what if there are overlapping circles? Then it becomes too much math for me.:) And really, it's not necessary. With a little bit of planning and care, when making your waypoint file, you should be able to avoid obstacles.

Re: idea for "forbidden zone" calculation

Posted: Fri Aug 27, 2010 6:58 am
by Starrider
yes i tried but on several maps this problem occures because the bot found the next mob across such a point and get stucked into it where only the report helps to get free.

If you have overlapping points calculate the intersections of them and add the next cricle to the length calucaltion, by checking if there are other cirles before the route is created. Then the best route around is the one where less intersections are. Then start calculating the route around these crcles. The the bot should run along the circles to the next one until all where passed.
One point would be enough for the first time :-P

Re: idea for "forbidden zone" calculation

Posted: Fri Aug 27, 2010 7:33 am
by rock5
Starrider wrote:yes i tried but on several maps this problem occures because the bot found the next mob across such a point and get stucked into it where only the report helps to get free.
What you can do is reduce the COMBAT_DISTANCE at those waypoints so it doesn't see those unreachable mobs.
Example:

Code: Select all

changeProfileOption("COMBAT_DISTANCE", 60)

Re: idea for "forbidden zone" calculation

Posted: Fri Aug 27, 2010 3:15 pm
by Starrider
the problem in this case is that if I reduce this, i have 50% less mobs I can attack, because the radius of their movement is so large that it happens that they are so far away form my waypoints and the bot runs only to the next waypoint. In some bad cases the bot runs 5-6 waypoints without attacking because I had the luck that at this time the mobs have been far away from that. If I increase it i got also the problem that 3 mobs around the "forbidden area" and whith an value of 60 also doesnt really help because the mobs are not far away from each other...

Re: idea for "forbidden zone" calculation

Posted: Fri Aug 27, 2010 4:03 pm
by Administrator
The math is simple. The hard part is marking all of the zones you don't want to go in to and doing so in a simple, easy-to-use way, then writing a pathfinding algorithm to navigate it. And then you have to worry about things like cliffs still.

I've considered it before, but it's such a huge project that it's just not worth the time.

Oh, and also, you can use the above code to change it per waypoint.

Re: idea for "forbidden zone" calculation

Posted: Fri Aug 27, 2010 6:01 pm
by Starrider
a ok, dont now that this is a waypoint based value XD

Re: idea for "forbidden zone" calculation

Posted: Fri Aug 27, 2010 9:08 pm
by Administrator
It's not. You need to change it back and forth. Lets say waypoint 3 in the below example contains a lot of stuff you want to avoid, but waypoints 1, 2, and 4 can have a wide target range. You would do this:

Code: Select all

<!-- 1 --><waypoint x="0" z="0"></waypoint>
<!-- 2 --><waypoint x="0" z="0">changeProfileOption("COMBAT_DISTANCE", 60)</waypoint>
<!-- 3 --><waypoint x="0" z="0"></waypoint>
<!-- 4 --><waypoint x="0" z="0">changeProfileOption("COMBAT_DISTANCE", 210)</waypoint>
Now, waypoint 1 will use the default, and move to waypoint 2. Once you hit waypoint 2, you'll change the combat distance to 60. This will be used between 2 and 3. It stays at 60 for betwen 3 and 4, where it will finally be changed to 210 again.

What I'm getting at here with the example is that you should leave a small gap in the waypoints where you will use the reduced combat distance; don't just set it low for one waypoint.

Re: idea for "forbidden zone" calculation

Posted: Fri Aug 27, 2010 11:55 pm
by rock5
By the way 60 was just an example. It might be too low a value. You can use 'rom/getid.lua' to get an idea of how far objects are and set a more appropriate value.

Re: idea for "forbidden zone" calculation

Posted: Sat Aug 28, 2010 1:29 pm
by Starrider
how does the getid.lua work, run it like the bot lua and it shows me the ids of alle objects around the bot?

Re: idea for "forbidden zone" calculation

Posted: Sat Aug 28, 2010 8:19 pm
by rock5
Starrider wrote:how does the getid.lua work, run it like the bot lua and it shows me the ids of alle objects around the bot?
It shows you the id of objects you point at as well as their distance.