Page 1 of 1

freeform running around a zone

Posted: Thu Jul 08, 2004 6:20 am
by Fippy
Been thinking about how hunting scripts handle bumping into obstacles. The backup and strafe solution works fine for trees and small rocks etc but when it comes to places like the groups of huts found in the commons its less useful. What I was thinking was you could use a bitmap that represents the zone. You could then mark off areas in different colours green for totaly safe areas, red for dangerous areas and blue as a border between the two. It would be simple to then get your current loc apply some sort of scaling factor then look up the xy on the bitmap and do a quick color check of that pixel. if its green your safe, blue you know your probably heading into a red zone so you can turn away, red and your in trouble. This should be pretty quick to do compared to alternative methods (like collision checks) only prob is I know nothing about coding in C++ (well I know how to compile in it now :) ) so I dont know if this is something that wouls be doable and fast enough to be useable.

Thoughts anyone ?

Posted: Thu Jul 08, 2004 11:36 am
by Spoon
Why not use Line of Sight checking to check a fixed distance in front of yourself and turn when LoS in interrupted? This could work out well for advance obstacle avoidance, which would be much cleaner than the dumb robot look of back up and strafe techniques. Accounting for Z-axis changes in terrain might be a bit tricky, though.

Posted: Thu Jul 08, 2004 8:32 pm
by Mimatas
With the intro of LOS checking, I think hunter macros will become MUCH more intelligent. No more chasing mobs under the world... more realistic pathing (although I'm not sure how LOS works.. if you can do it with a loc or if you need a target). Great idea though.

Posted: Thu Jul 08, 2004 9:30 pm
by aChallenged1
Maps would have to be more detailed, showing where unpassable terrain is, valleys and hills and rivers in such a way that a macro would be able to "see" it and thus avoid it.

I don't see that happening in the near future.

Posted: Fri Jul 09, 2004 10:30 am
by Fippy
OK looked at using ${LineOfSight[yxz:yxz]} and it works pretty good. I just did a simple test runnign along one axis (Eastwards) towards a wall. In order for this to work you would need to be able to calculate the loc of a point about 15 units in front of your current loc along your heading. I am know maths geek so I aint to sure what your would need to do to calculate this. Anybody got a clue ?

Posted: Fri Jul 09, 2004 11:36 am
by Fippy
Ahh I think I hate it took me a while to think back to my school days. Equations of a right angle triangle is what I needed gonna get a working example and then post it in the forums if it works.

Posted: Fri Jul 09, 2004 11:49 am
by aChallenged1
If you can get this to happen, there are going to be a LOT of happy people.

GL!

Posted: Fri Jul 09, 2004 12:21 pm
by Mimatas
It can be done using Cos and Sin functions. I believe there's a way to get your heading in degrees... (not sure where it starts, but that can be figured out). From that point, it's just a matter of doing the equation:
cos(angle) = x/15, sin(angle)=y/15 (or x=15cos(angle), y=15sin(angle)) to get the x/y coordinates. The z coordinate, on the other hand, may be tricky. Since we don't have a way to access map data, we have no way to know what level the ground will be 15 units ahead of us. We can't assume that the ground will be the same height as us, or we wouldn't be able to run up a hill (our point would be below the world, and thus out of LOS). I suppose that if we found the maximum height that a character can run up, we could assume that Z is our height + that number, but it may still cause problems when running up steep cliffs. On the other hand, making the Z too high will cause us to ignore small objects that obstruct our path.

There's the math for you :) You'll have to do some playing around to figure out 1. where our direction angle is referenced from, and 2. which direction (NS or EW) is referenced by x and which by Y... but hopefully this is enough to get you started. Good luck.

Posted: Sat Jul 10, 2004 3:52 am
by Fippy
Ah well seems the los check is far to inconsistant for zones done prior to luclin as it sees through most of them. I guess its back to the drawing board. Maybe my original idea would be a possibility after all.