Home   Help Search Login Register  

Author Topic: LOS(Line of Sight)  (Read 875 times)

0 Members and 1 Guest are viewing this topic.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
LOS(Line of Sight)
« on: 13 Jan 2004, 22:10:36 »
Hmmm... OK... So every1 know the knowsabout command right? Well then every1 should know that it's not a perfect command. It checks if the AI can see the player and if the player can see the AI, right? Well, in both ways it's filled with bugs and stuff. Now, all I wanna do is check if a player/AI has LOS with AI/player. I think it needs a function or something?

Thanks!

:beat: *Gets Shot* :beat:

Offline Igor Drukov

  • Contributing Member
  • **
  • Conscientious Subjector
Re:LOS(Line of Sight)
« Reply #1 on: 13 Jan 2004, 22:44:13 »
Hey real !


What you need is LCD's function (no link available yet as OFPEC hasn't fully recovered, it's called AngleFacingDiff). You can also use mine, which uses positions rather than angle, but LCD's might suit your needs better.



PM me if you want me to e-mail you LCD's function.


Ig.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:LOS(Line of Sight)
« Reply #2 on: 14 Jan 2004, 07:36:26 »
I have used AngleFacingDiff before in another mission and I can't really understand why this function would work the way I need it. Doesn't AngleFacingDiff just checks the Angle for an object to another?

:beat: *Gets Shot* :beat:

Offline Igor Drukov

  • Contributing Member
  • **
  • Conscientious Subjector
Re:LOS(Line of Sight)
« Reply #3 on: 14 Jan 2004, 14:39:58 »
Hey !


Ok, I might have been a lil' too cosy on this one. The way I saw it, a unit is in the line of sight of another if the angle returned by AngleFacingDiff is superior to, say, 300 and inferior to 60 (may be wider, but that's not my point).
Now, if there's an obstacle that blocks the unit's view, ok, I'm scr*wed, and apart from scanning the entire island with NearestObject and computing the distance between the unit and the object (the way they plan to do here), and check whether it actually DOES block the view - which no doubt implies heavy, potentially unwanted, calculations - then, no, I don't see a solution.


Hope that helps  :P




Ig.

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:LOS(Line of Sight)
« Reply #4 on: 14 Jan 2004, 17:12:12 »
check dat

http://www.ofpec.com/yabbse/index.php?board=27;action=display;threadid=7078

;D

it got ma funky function ;) nd also da script itself may help ya - if u can edit it ;)

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:LOS(Line of Sight)
« Reply #5 on: 14 Jan 2004, 19:14:24 »
OK, I'll check this out.

:beat: *Gets Shot* :beat:

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:LOS(Line of Sight)
« Reply #6 on: 14 Jan 2004, 19:22:31 »
OK, so now I'm all like "aaaaaaaaaaaaaaaaah! Do I have to define all houses and other buildings on the whole friggn island?!". Hmmmm... I'll tell you more about my situation:

I'm making this new combat system, which I call "The Round Based Combat System - or - TRBCS"(don't I have such imagination?). Everything works out great, except one thing, I can't figure out how I can check if the bloody enemy is behind an obstacle, therefor, my problem.

Now, all weapons have a limited range in this system, for various different reasons that I won't bring up here. Now, can I somehow tweak your funky function so it'll automaticly define all buildings of X distance to the player?

Also, height problems? If the enemy is behind a hill?

:beat: *Gets Shot* :beat:

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:LOS(Line of Sight)
« Reply #7 on: 14 Jan 2004, 20:07:03 »
About the height problem, I thought of something.

It would possibly be best done with maths. If A is 100 meters above the ocean(I know there's a function for this... I think)and B is 120 and the distance between them is 15 meters then A cannot see B and vice versa. Would it work? See any problems with it any1?

:beat: *Gets Shot* :beat:

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:LOS(Line of Sight)
« Reply #8 on: 15 Jan 2004, 10:42:57 »
Quote
Do I have to define all houses and other buildings on the whole friggn island?!".

yes :P  :-* da script was made 4 lil bases not 4 big islands ::) :P even tho ill b happy if bis gives me command 2 check da size of da nearest object ::)

Quote
It would possibly be best done with maths. If A is 100 meters above the ocean(I know there's a function for this... I think)and B is 120 and the distance between them is 15 meters then A cannot see B and vice versa. Would it work? See any problems with it any1?

it is doable but i think 2 keep realisem u shud remember som things ;)

if A is 100 nd B is 120 den B can c A unless deres somin biger dan 120 somwere aroun dere nd A may c b if deres nothin dats very high between em so itll also need lotaa work :P

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:LOS(Line of Sight)
« Reply #9 on: 15 Jan 2004, 18:07:10 »
Hmmm... so you mean if I can get the highest point between the targets(possibly can be done with your AngleFacingDiff, moving a GL to the highest point with that other function about above sea level)and if it's higher than B's position A cannot shoot B?

Man, this is quite pain-in-the-buttich.

:beat: *Gets Shot* :beat:

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:LOS(Line of Sight)
« Reply #10 on: 16 Jan 2004, 21:12:37 »
I've figured out a work-around, but I have a small n00bish question:

How can I set AI to shoot single when I want and burst when I want?

:beat: *Gets Shot* :beat:

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:LOS(Line of Sight)
« Reply #11 on: 16 Jan 2004, 21:19:33 »
Just a shot in the dark.....try the fire command.

something like:

unit fire ["muzzle", "mode", "magazinetype"]


Planck
I know a little about a lot, and a lot about a little.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:LOS(Line of Sight)
« Reply #12 on: 16 Jan 2004, 21:22:01 »
Still need to fire at a unit.

:beat: *Gets Shot* :beat:

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:LOS(Line of Sight)
« Reply #13 on: 17 Jan 2004, 10:54:52 »
How about letting a game logic 'walk' the path of the LOS ? From above, the LOS would be a line from the attacker to the target. Now start at the attacker and setpos the GL on the LOS. Then move further down the line, every half a meter for example. Then check the position where GL actually IS right now and where you wanted it to be (the setpos command).

MAYBE (haven't tested this yet) if there's a hard obstacle on the setpos position, GL would be pushed around this object and therefore the both positions would be different. That way you could tell there's a hard obstacle in the way. Won't work with bushes though.  :P

Another advantage would be to get the maximum height differences on the LOS. If the attacker and target are on height 5m, but the GL had a maximum of 10m somewhere along the LOS, you could tell that both objects can't see each other because of a hill.
« Last Edit: 17 Jan 2004, 10:57:29 by DrStrangelove »

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:LOS(Line of Sight)
« Reply #14 on: 17 Jan 2004, 13:45:36 »
Hmmm... that's an intresting idea. It will work perfectly for hieghts in the ground but I am 99% sure it won't work on houses or vehicles, etc.

:beat: *Gets Shot* :beat: