HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Simulating Unit Vision

02-02-2004, 12:40 PM#1
Vidstige
I am trying to model the vision of a unit. Different uses for this could be to let the unit wander around the map, avoiding obstacles and other units. It could also be used for exploring a map.

It's easy enough to get hold of all units and destructables in the vicinity of a unit by using something like (Unit is a variable) :
Quote:
Unit Group - Pick every unit in (Units within (Current acquisition range of Unit) of (Position of Unit)) and do (Actions)
As of now, there are two problems which I don't have any good solutions on:

1. How to I get hold of a units sight range?
2. How do I know the (blocking/pathing) size of a unit or destructable from in-game?

I suppose that I can get hold of both values from the object editor though...

Any ideas or suggestions?
02-02-2004, 08:01 PM#2
Starcraftfreak
Your idea looks interesting.
The problem is that, as far as I know, these values can't be accessed via jass (there is no function to get the sight range or pathing of a unit). So one solution might be (is a lot of work, I know):
- storing all the sight range/pathing values in an array (sorted somehow)
- writing functions to access these values (basically you have to think about a sorting system, in order to get the data that is associated to the unit-type you want)
02-11-2004, 07:04 AM#3
RodOfNOD
Like all good arrays use the point value of the unit and the custom value.

Info that is specific to a certain TYPE of unit use point.

Info that is specific to a certain UNIT use custom.

This way you can store as much info as needed by using as many arrays as needed. Say the unit dies. You have access to both the point and custom value so you can do anything that you need by accessing that array index value.

Good Luck.
02-11-2004, 09:10 AM#4
Cubasis
Also. While you can not sense what a individual unit sees without doing serious path-finding/whatever. You "can" know what a Player see's. So f.ex. a commandoes-like map "could" work.

You can also play with this limit, f.ex. use some un-used player-slot to spawn a invisible unit at the location of another unit (the one you want to know about), then sense if the un-used player "see's" the Player (or whatever)... If so, then bla.

Cubasis
02-11-2004, 04:49 PM#5
Vidstige
Thanks all of you for your feedback. I am planning to make an experimental setup where a group of soldier is on the march in certain direction. They will be lead by a captain who will use vision for avoiding obstacles and choosing formation.