Home   Help Search Login Register  

Author Topic: BIS location functions  (Read 8985 times)

0 Members and 1 Guest are viewing this topic.

Offline Trexian

  • Members
  • *
BIS location functions
« on: 18 Aug 2009, 15:29:07 »
Based on city-finding scripts I did for A1, I was VERY interested in the new location functions - BIS_fnc_locations.

http://community.bistudio.com/wiki/BIS_fnc_locations

I searched, but could not find any in-depth resources, so I'm starting this thread to share what information I develop, and invite anyone else to contribute what they find. :)  I am at the very beginning, so this may be super-simple to people.

I started (on Utes) with the city center functions.  I began by placing a location game logic with they type city center.


In the init of the test mission, I set it up to hint various things.
Code: [Select]
private ["_list", "_JTDMarker"];

_JTDMarker = createMarker ["marker", getPos player];
_JTDMarker setMarkerColor "ColorGreen";
_JTDMarker setMarkerShape "ELLIPSE";
_JTDMarker setMarkerSize [50, 50];

_list = ["CityCenter",[position player,1000],true] call bis_fnc_locations;

hint format ["list = %1", _list];

sleep 1;
{
 _JTDMarker setMarkerPos getPos _x;   // marker for debugging
 
hint format ["element %1 = %2", _x, getPos _x];
sleep 5;
} forEach _list;


The first hint revealed that it had 5 elements, L1 through L5 (interestingly, not L0 through L4, although I'm certain they were elements 0 through 4 of the array).  Using the marker, I *think* that the first entry is actually the player position.  Anyway, the in-game map then had this:


You can see that it had small black dots at the locations of the "city centers" that it knew about.  An interesting omission is the city on the SE coast.  That location had apparently not been registered.  (Was that city added with patch 1.03?)  It did not register the actual location of the city center GL.  It also showed the gray line from each city center to the next.

Also, the Biki refers to a Dynamic Route module (with barely more than a single sentence of information on it), although I could not find that in the modules or the game logics.  (Although, there was a "Strategic Reference Layer" or something like that.)
http://community.bistudio.com/wiki/Dynamic_Route

Edit:
Ahhhh... figured it out.

I was limiting the search distance to 1 km...  which actually only returned *3* locations 2-5!



I de-PBO'd the Utes PBO and unRapified it.  Some interesting stuff.  The LHD Khe Sanh is the first name, and I think that's why the cities are identified as 2-6.

Also I grabbed (thanks to Spooner's tip) the fnc_help text.  I'm trying to work out how to get the neighbors of cities.  They are designated in the config....

And "Eureka"... the magic of "getVariable" and namespace....

Once you get the city centers, you get the information mentioned in the Biki.

Init:
Code: [Select]
private ["_list", "_typeVar", "_neighbors", "_name"];

waituntil {!isnil "bis_fnc_init"};
//[] call BIS_fnc_help;

_list = ["CityCenter",[position player,2000],true] call bis_fnc_locations;

hint format ["list = %1", _list];

sleep 2;
{

hint format ["element %1 = %2", _x, getPos _x];
sleep 2;

_typeVar = _x getVariable "type";
_neighbors = _x getVariable "neighbors";
_name = _x getVariable "name";
hint format ["%1 ... %2 ... %3", _neighbors, _typeVar, _name];
sleep 2;
} forEach _list;

For more trickiness, get the locations of the neighbors by nesting forEach commands.
Code: [Select]
{

hint format ["element %1 = %2", _x, getPos _x];
sleep 5;

_typeVar = _x getVariable "type";
_neighbors = _x getVariable "neighbors";
_name = _x getVariable "name";
hint format ["%1 ... %2",_typeVar, _name];
sleep 2;
{
hint format ["near %1 at %2", _x, getPos _x];
sleep 2;
} forEach _neighbors;
} forEach _list;

Now, there's a bunch of other game logics (like City Links) that are less well documented (if that's possible), :) from what I can tell.
« Last Edit: 19 Aug 2009, 05:30:25 by Trexian »
Sic semper tyrannosauro.

Offline Trexian

  • Members
  • *
Re: BIS location functions
« Reply #1 on: 28 Aug 2009, 14:55:25 »
(Continuing the monologue.) :D

Some interesting strangeness in the cfg's for Utes and Chernorus.  I'm not familiar with the A1 (or prior) cfg's so apologies if this is stuff that is already known. :)  I'm really curious about the entries for FlatArea/FlatAreaCity/FlatAreaCitySmall and StrongpointArea.

In Utes, FlatArea consistently has a config radius of 50x50 (ellipse) except for 1 that has one of 97x70. Regardless, I think that these areas could make for relatively good LZs. Needs some testing, but maybe combined with Mando Heliroute, you could filter for FlatArea and use the nearest one as an LZs.  FlatAreaCity consistently has a config radius of 40x40. That may still be good enough for a Little Bird or UH-1.  Almost certainly enough for fast-roping. Would also likely make a good spawn point for vehicles.  FlatAreaCitySmall consistently has a config radius of 20x20. That's pretty small. Maybe available to spawn MG nests or somesuch.  StrongPointArea consistently has 30x30. I'm going to map out what kinds of locations these are. I'm hoping they're designated as such for some sort of tactical value.  Alot of these have a radius assigned to them also, but many don't.

Now, Chernorus is different.  It does have StrongpointArea/FlatArea/FlatAreaCitySmall/FlatAreaCity but they seem to uniformly have a radius of 100m.  No differentiation.  They also seem to have an angle that is specific to each one, that is, it isn't always 0 or some arbitrary number; it looks like someone either hand-picked it, or it was generated based on the orientation of something else, like nearby road or something.

Each of these has 2d format positions, so I'm thinking that it will likely be possible to use these references as waypoints or intermediate objectives for taking a city, also.
Sic semper tyrannosauro.

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: BIS location functions
« Reply #2 on: 28 Aug 2009, 16:40:22 »
The locations are used by various modules like ALICE, SILVIE and warfare.
Maybe the armory makes use of it to.

It is a way to establish this strategic layer with different type of locations.
You can either define them via the world config or place them as editor
objects from what I recall.


Offline Trexian

  • Members
  • *
Re: BIS location functions
« Reply #3 on: 28 Aug 2009, 18:47:42 »
Is there more information on this stuff somewhere online?

And, IIRC, there's a module for Strategic Reference Layer?

The odd thing, though, is the difference in sizes on Utes but the uniformity of sizes for Chernarus for these different areas.
Sic semper tyrannosauro.

Offline Odin

  • Members
  • *
Re: BIS location functions
« Reply #4 on: 29 Aug 2009, 06:23:41 »
Trexian, Thx for the Info mate  :good: I have only owned ARMA2 for a week, spent all of that trying to learn how to use the functions and so forth. Thanx to this info I have been able to create a Marker patrol zone script, where the the group will just keep moving City to City  :D

Offline nikita320106

  • Members
  • *
Re: BIS location functions
« Reply #5 on: 31 Aug 2009, 10:21:21 »
Trexian do you know something about

Code: [Select]
configFile >> "CfgWorlds" >> worldName >> "safePositionAnchor
this is from
Code: [Select]
scriptName "Functions\misc\fn_findSafePos.sqf";
/*
File: findSafePos.sqf
Author: Joris-Jan van 't Land

Offline Trexian

  • Members
  • *
Re: BIS location functions
« Reply #6 on: 31 Aug 2009, 16:06:06 »
Yeah, I've started using that findSafePos function to find spawn locations.

That config line basically finds the entry "safeAnchorPosition" (pretty obvious).   :)  My understanding of that is that it is more or less the center of the map, or maybe the middle of the land mass for the map.

I think the function just uses that as a starting point if no other point is passed to it.

I'm trying to sort out the max gradient element, myself. :)  Otherwise, it is a pretty helpful function.
Sic semper tyrannosauro.

Offline nikita320106

  • Members
  • *
Re: BIS location functions
« Reply #7 on: 02 Sep 2009, 11:06:44 »
so/ ma bad engliz))
I thought about new tactical implement// thought this is some as "findcover"//so it's a pity

thanx)) you right))

Offline jones

  • Members
  • *
Re: BIS location functions
« Reply #8 on: 10 Sep 2009, 21:38:56 »
I'm trying to sort out the max gradient element, myself. :)  Otherwise, it is a pretty helpful function.

I found this line in the taskpatrol function with the gradient element defined and have been using it with no problems

Code: [Select]
_newPos = [_prevPos, 100, _maxDist, 1, 0, 60 * (pi / 180), 0, _blacklist] call BIS_fnc_findSafePos;

Offline Trexian

  • Members
  • *
Re: BIS location functions
« Reply #9 on: 10 Sep 2009, 22:05:06 »
Ah right - I remember seeing that, but it didn't click that it was a conversion from 60 degrees to radians. :)  :good:

I'd settled on a value of .5 for my purposes, which works out to about 30 degrees.  I may adjust down a bit, since I'm placing a structure, and that is still a pretty serious grade.
Sic semper tyrannosauro.

Offline Trapper

  • Honoured Contributor
  • ***
  • I'm a llama!
Re: BIS location functions
« Reply #10 on: 02 Jan 2010, 22:42:27 »
It's probably my lack of experience with functions, but I'm struggling for hours to follow the first example. Am I right that there are a few things wrong with it?

1.
Quote
I started (on Utes) with the city center functions.  I began by placing a location game logic with they type city center.
This type of game logic isn't required for the test. Instead the first thing to do should be placing the game logic required to initialize the BIS functions -> Functions

2. Not absolutely necessary but to be sure the module is fully loaded, place a trigger checking for !isnil "bis_fnc_init" to execute the script

3. The only part of the script giving me useful hint output and mapmarkers for locations is:
Quote
private ["_list", "_JTDMarker"];

_JTDMarker = createMarker ["marker", getPos player];
_JTDMarker setMarkerColor "ColorGreen";
_JTDMarker setMarkerShape "ELLIPSE";
_JTDMarker setMarkerSize [50, 50];


_list = ["CityCenter",[position player,1000],true] call bis_fnc_locations;

hint format ["list = %1", _list];

sleep 1;
{
 _JTDMarker setMarkerPos getPos _x;   // marker for debugging
 
hint format ["element %1 = %2", _x, getPos _x];
sleep 5;
} forEach _list;

The second hint output just says: element any = array and the green markers isn't moving around.



Guessing other class names as CityCenter I found out that the airport on Utes is not registered in the island by default, while Chernarus has two registered airports.


However my main concern is if these hardcoded locations could be useful for a mission featuring skirmishes on random island locations. Or will I just find out after using locations correctly that they are of no use for me because the hardcoded locations are badly choosen and custom islands come without them?
I would need anything not only city locations. Depots, airports, interesting buildings, good camp locations in the wilderness.
And should I bother to mark and register additional custom locations into the BIS system which I hardly understand or just set up my own position array system. What'll be more easy and faster?
« Last Edit: 02 Jan 2010, 22:46:50 by Trapper »

Offline Trexian

  • Members
  • *
Re: BIS location functions
« Reply #11 on: 05 Jan 2010, 22:10:58 »
Right - interesting stuff, and good questions.

In terms of usefulness, I've used these functions to set up situations where there is a "target" city, which is connected (from the neighbors variable in the config) to 2 other cities, one is the base for red troops, the other the base for blue troops.  A waypoint is then generated for all the forces to meet in the target city.  I think that is what you are kinda getting at?

There are other commands, involving locations and commands like findEmptyPostition that can help you dynamically find areas for landing zones or campgrounds.  Airports and "interesting buildings" may be more difficult, but are technically feasible if you know the classname of the object.
Sic semper tyrannosauro.

Offline Trapper

  • Honoured Contributor
  • ***
  • I'm a llama!
Re: BIS location functions
« Reply #12 on: 10 Jan 2010, 18:54:44 »
I was thinking about a random coop generator for platoon sized battles on different locations. Only one at a time is already sufficient for that. I can't tell if I would be pleased by the looks of the enemy presence at this location afterwards but that's the overall issue with randomness. Two neighbor locations could do for parol.
For open grounds and I would still need my own sector list I think. Then I could use findEmptyPosition to look for camping sites in the sectors. Which however wouldn't appear tactically chosen.

How would I go about finding out building class names? Which pbo to extract?

Offline Trexian

  • Members
  • *
Re: BIS location functions
« Reply #13 on: 11 Jan 2010, 14:46:22 »
Dunno which pbo, I usually go here with questions like that:
http://www.armatechsquad.com/ArmA2Class/

:)
Sic semper tyrannosauro.

Offline Trapper

  • Honoured Contributor
  • ***
  • I'm a llama!
Re: BIS location functions
« Reply #14 on: 02 Oct 2010, 19:52:43 »
Probably nothing new to you Trexian, but today I've discovered the Biki category page about locations. It helps to get a bigger picture. Though not anybody will be as awkward as me navigating the Biki, but this is the link:

http://community.bistudio.com/wiki/Category:Command_Group:_Locations

I was especially missing the CfgLocationTypes infos before.