Pathfinding / Beams through walls?

Post your scripting questions / solutions here

Moderator: Moderators

Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Pathfinding / Beams through walls?

Post by Rookie One.pl »

Has anyone been able to make func_beams appear through walls? Alwaysdraw doesn't work, it seems a trace is being done at the moment of activating the beam from origin to endpoint, and it stops at any solid found on the way. I tried tracing forward from inside the solid (endpoint + forward vector - this is 1 unit deep inside the wall), but the game refuses to do so and traces from the surface (where the beam endpoint is), which is useless, and as a result I get an error (either all edicts have been used or a command overflow). Any ideas?
Last edited by Rookie One.pl on Mon May 01, 2006 10:47 am, edited 1 time in total.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

I believe it is impossible :(
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

clip

Post by tltrude »

Perhaps the beam will go through "player_clip". Then the walls could be nonsolid. You're not saying much about what it is for, but how about making a small hole in the wall?
Tom Trude,

Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

I'm afraid I can't reveal much yet. It's for the project I wanted to use pathfinding for. My algorithm worked partially, but I encountered a bit of a problem (would be much easier if sighttracing returned the point hit) and scrapped the idea.

The thing is that I need to display a bot's path before they follow it, and beams would be perfect for it, if only they could be made to work like that (or a valid pathfinding algorithm was used).
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
neillomax
Lieutenant General
Posts: 880
Joined: Thu Jun 23, 2005 6:57 am

Post by neillomax »

I don't know much about it, but what do you use to get a plane to fly around a map ? Can't you do something similar with the function beam ? Make waypoints for it to follow ?
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

planes use a number of nodes that have no connection other than a little value saying what's next in the list. he wants a visible line from node to node.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Rookie One.pl wrote:(would be much easier if sighttracing returned the point hit)
Use trace maybe?
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

I think the picture below explains the pathfinding problem quite well.
Image
While the sight trace fails because of the obstacle, the linear one succeeds. This is not a problem with larger obstacles (I can find a path e.g. around a corner), but quite an issue with smaller ones.

Why is this important? Here is an excerpt of my pathfinding script:

Code: Select all

		local.dest = $startnode.origin + (angles_toforward (local.ang + ( 0 local.i 0 ))) * local.dist * -1 // honestly I have no idea why this needs inverting :S
		if (sighttrace $startnode.origin local.dest 0 ( -16 -16 18 ) ( 16 16 76 )) {
			println "Found at offset " local.i
			local.passages[local.pindex] = local.dest
			local.pindex++
			waitthread draw_beam ($startnode.origin + ( 0 0 32 )) (local.dest + ( 0 0 32 ))
			break
		} else {
			local.dist = vector_length($startnode.origin - (trace $startnode.origin local.dest)) + 32
			println "Distance updated to " local.dist
		}
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Bump!

I guess I need your help again, jv. ;) I'm still trying to get it somewhere.
Image
Providing the alpha and a, how do I get the value of b?
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

The length of b cannot be determined. One more side or angle needs to be given.
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Hmm. How about this?
Image
I forgot to mark the beta angle, but it's there between the black and green lines next to alpha. ;) And alpha contains beta within itself.
c = sin(beta) * a
b = c / sin(alpha)
Would this work?
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Nope,

c != sin(beta) * a

but

c = cos(beta) * a

Similarly,

c = cos(alpha) * b

Such that

b = c / cos(alpha)

Or

b = cos(beta) / cos(alpha) * a
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Oh. :oops: But hey, I was close, and I haven't had trigonometry yet. :P Anyway, thanks a lot, m8. :)

1 more thing. Can I use your cosinus from Skylimit? You'll be credited, of course. :)
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Rookie One.pl wrote:Can I use your cosinus from Skylimit? You'll be credited, of course. :)
Ofcourse, although I can't really take credit for a Taylor expansion :P

cos x ~ 1 - x^2 / 2! + x^4 / 4! - x^6 / 6! + x^8 / 8! - ...

Where x is in radians.

pi radians = 180 degrees.

The skylimit script takes x in radians, as well.

! denotes a factorial, e.g.

3! = 1x2x3 = 6
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Thanks. And I've already made the deg->rad conversion, don't worry. ;) And yes, I do see the light! :P
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Post Reply