freeform running around a zone

A forum for the general posts relating to MacroQuest. *DEPRECATED: This forum is no longer in public use, but remains here for your reading pleasure. Enjoy

Moderator: MacroQuest Developers

User avatar
Fippy
a snow griffon
a snow griffon
Posts: 499
Joined: Tue Jul 16, 2002 10:42 am

freeform running around a zone

Post by Fippy » Thu Jul 08, 2004 6:20 am

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 ?
Fippy

This is my girl. But Rizwank had her first :-)
[img]http://www.btinternet.com/~artanor/images/fairy_bounce09.gif[/img]

Spoon
a lesser mummy
a lesser mummy
Posts: 72
Joined: Thu Jan 29, 2004 1:18 am

Post by Spoon » Thu Jul 08, 2004 11:36 am

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.

Mimatas
a hill giant
a hill giant
Posts: 262
Joined: Wed Mar 10, 2004 4:22 pm

Post by Mimatas » Thu Jul 08, 2004 8:32 pm

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.

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Thu Jul 08, 2004 9:30 pm

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.

User avatar
Fippy
a snow griffon
a snow griffon
Posts: 499
Joined: Tue Jul 16, 2002 10:42 am

Post by Fippy » Fri Jul 09, 2004 10:30 am

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 ?
Fippy

This is my girl. But Rizwank had her first :-)
[img]http://www.btinternet.com/~artanor/images/fairy_bounce09.gif[/img]

User avatar
Fippy
a snow griffon
a snow griffon
Posts: 499
Joined: Tue Jul 16, 2002 10:42 am

Post by Fippy » Fri Jul 09, 2004 11:36 am

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.
Fippy

This is my girl. But Rizwank had her first :-)
[img]http://www.btinternet.com/~artanor/images/fairy_bounce09.gif[/img]

User avatar
aChallenged1
a grimling bloodguard
a grimling bloodguard
Posts: 1804
Joined: Mon Jun 28, 2004 10:12 pm

Post by aChallenged1 » Fri Jul 09, 2004 11:49 am

If you can get this to happen, there are going to be a LOT of happy people.

GL!

Mimatas
a hill giant
a hill giant
Posts: 262
Joined: Wed Mar 10, 2004 4:22 pm

Post by Mimatas » Fri Jul 09, 2004 12:21 pm

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.

User avatar
Fippy
a snow griffon
a snow griffon
Posts: 499
Joined: Tue Jul 16, 2002 10:42 am

Post by Fippy » Sat Jul 10, 2004 3:52 am

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.
Fippy

This is my girl. But Rizwank had her first :-)
[img]http://www.btinternet.com/~artanor/images/fairy_bounce09.gif[/img]