The Daily Click ::. Forums ::. Klik Coding Help ::. Line-of-sight ai
 

Post Reply  Post Oekaki 
 

Posted By Message

Saven (CrobaSoft)



Registered
  12/03/2004
Points
  587
18th April, 2004 at 18:50:26 -

I made a line of sight ai useing a detector and im trying to figure out how to keep him from seeing through walls. Any ideas?

 
You shouldn't go here, there are crazy swedes who mumble about cucumbers:
http://www.crobasoft.com

NovaSoft{Dynecys}



Registered
  08/03/2004
Points
  105
18th April, 2004 at 19:36:22 -

make your line of sight a transparent ball which player shoots eg. every 5ms

at whatever speed and in the direction player is facing

ball collides with wall - destroy

ball collides with enemy - do whatever

Any help?

Image Edited by the Author.

 
Viddy A ClockWork Orange, Droogs...

Goddamn you to hell 'Newbie' DC Rating... Go up, UP DAMN YOU!

Saven (CrobaSoft)



Registered
  12/03/2004
Points
  587
18th April, 2004 at 20:44:02 -

That works but how do i limit how far it can go? i used the dir calculater, but it wont work for some reason. :/

 
You shouldn't go here, there are crazy swedes who mumble about cucumbers:
http://www.crobasoft.com

Kirby Smith

Resident Slacker

Registered
  18/05/2003
Points
  479

VIP Member360 OwnerWii OwnerThe Cake is a Lie
18th April, 2004 at 22:15:11 -

Make it have an alterable value that starts at... say, 10 (higher for longer distances or lower for shorter). Then, every 1/4 second or so, subtract 1 from that value. When the value is equal to 0, destroy the detector.

 
XBL Gamertag: Rampant Mjolnir

cake



Registered
  13/12/2002
Points
  1173
18th April, 2004 at 22:54:04 -

alternatively start the value at 0, add 1 to it and when its >= to <distance you want it to travel> destroy it.

This allows you to more easily vary how far things can see, which is handy for say, sudden changes in the environment, allows things like turning lights on and off, day night cycles, etc, to actually affect that AI in a very easily to code way

 
n/a

Saven (CrobaSoft)



Registered
  12/03/2004
Points
  587
18th April, 2004 at 23:38:51 -

YAY! It works! Thanks

 
You shouldn't go here, there are crazy swedes who mumble about cucumbers:
http://www.crobasoft.com

Grazzum - Scorpion E



Registered
  25/10/2003
Points
  918
19th April, 2004 at 18:57:47 -

You should make a Tutorial, Get some extra DC points

 
n/a

cake



Registered
  13/12/2002
Points
  1173
19th April, 2004 at 19:13:25 -

Me? Lol.

I would have actually coded it a different way, no active objects...

 
n/a

Grazzum - Scorpion E



Registered
  25/10/2003
Points
  918
19th April, 2004 at 21:30:17 -

Well do it, I don't feel like having to do it... lol. And you'd make it so much better prolly and less cluttered like this run on sentence is.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click