Home   Help Search Login Register  

Advertisement

Author Topic: AI Chopper Automatically Finds Suitable Landing Zone (ACCEPTED)  (Read 3277 times)

0 Members and 1 Guest are viewing this topic.

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Here is a a script/function suite that enables an AI chopper to find a sutable LZ. It utilizes several new functions: overForest.sqf - detects if an area is over forest (works with all standard BIS islands, can be modified to work for addon islands); overWater.sqf - detects if area is over water; overObst.sqf - detects if area is over any obstacles (trees, vehicles, buildings); groundSlope.sqf - calcualtes the average terrain slope for a given area (so the chopper will not try to land on terrain that has too much slope). posArray.sqf - creates and array of evenly space positions around a reference object (this is usefull for searching a large area to determine the terrrain, forest, water, slope conditions within the area).

The new scripts are: find_LZ.sqs - This is the script that uses the above functions along with user defined parameters to locate a suitable landing zone; cricle_LZ - script to make the chopper circle the area where it is looking for a good LZ, fastland.sqs - script that makes a chopper land absolutly anywhere, quickly and smoothly, or crash anywhere, as hard and fast as you define (depending on the parameters you provide); gen_unload.sqs; gen_load.sqs; gen_load_crew.sqs - these are scripts that load and unload units from any craft; AILand.sqs - script that sets up the conditions to make the chopper find the LZ and return info to the player. Other misc. functions, some new ,some previously submitted. All scripts and functions have good instructions in header or footer. The demo mission includes a readme file.+

Get FindLZ v1.01
« Last Edit: 06 Feb 2009, 23:35:28 by Mandoble »

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re: AI Chopper Automatically Finds Suitable Landing Zone
« Reply #1 on: 26 Jan 2009, 16:55:20 »
No one has tested this? Its been here for soo long and it really solves so many AI chopper landing problems. Give it a try.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: AI Chopper Automatically Finds Suitable Landing Zone
« Reply #2 on: 31 Jan 2009, 12:34:29 »
Sadly I have not OFP installed anymore, but I'm trying to figure out if this has any problem to be fully ArmA compatible, because if so, it might be worth to proceed with the conversion, and we may help there. Anyway I'll try to have it fully tested inside ofpec and accepted.

EDIT:
Did some test in ArmA with overForest and overObst functions and none of them seem to work. I would say that ArmA conversion is not an option actually  :confused:
« Last Edit: 31 Jan 2009, 15:18:57 by Mandoble »

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re: AI Chopper Automatically Finds Suitable Landing Zone
« Reply #3 on: 01 Feb 2009, 20:59:05 »
NightJay0044 has said that he would like to test this.

Probably some values in those functions just need to be adjusted for forest and obstacle models used in ARMA. I have not done much scripting/function writing for ARMA, mostly because I know that once I start to do that I will end up abandoning my very slowly progressing mission work for OFP (over 4 years now, but I only really work on it for 1 or 2 hours a week). Anyway, it is very detailed and long (so much so that I now have to make it into a campaign to prevent the save game bug).

Anyway, back to topic. The functions detect forests and obstacles in OFP by taking advantage of OFP model anomalies. I use these to determine if an object is dangerous to land on (a forest for example compared to a bush). Anyway, with a similar examination of ARMA object characteristics, one could adjust values in the functions (maybe) so they will work in ARMA. I know that someone also had problems with the overforest function in a non-BIS Vietnam island. I was able to adjust the overforest to work for that island (at least in my preliminary testing. So maybe the same is possible for ARMA.
« Last Edit: 01 Feb 2009, 21:01:17 by Raptorsaurus »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: AI Chopper Automatically Finds Suitable Landing Zone
« Reply #4 on: 01 Feb 2009, 21:03:21 »
Ok, so far I assume it is ready to be submitted to the ED for OFP only, right?

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re: AI Chopper Automatically Finds Suitable Landing Zone
« Reply #5 on: 01 Feb 2009, 21:04:32 »
Yes, it is OFP only.

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: AI Chopper Automatically Finds Suitable Landing Zone
« Reply #6 on: 01 Feb 2009, 22:22:13 »
I tested this briefly in OFP yesterday, the LZ finding routines worked nearly every time.
Only times it had a hiccup was when I chose the largest forest and clicked in the centre of it.

The routine didn't really fail, it just couldn't find a suitable place for the LZ so it seemed to default to a spot outside the place marked as Base, or a spot outside the forest my group starts in.
I imagine this could be fixed by slightly widening the area searched around each forest, but then many 3rd party islands might have even larger forested areas.

Picking an area in the middle of the ocean resulted in a spot on the island somewhere being chosen instead, which seems reasonable because nobody in a real mission is going to choose a LZ in the ocean anyway.

So, it seems to do what it says on the crinkly packaging to the most reasonable extent possible.


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

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re: AI Chopper Automatically Finds Suitable Landing Zone
« Reply #7 on: 02 Feb 2009, 00:22:10 »
The algorithm does not only check for forests, water and obstacles, but also for suitable terrain. A chopper cannot land on slopes that are too steep. Some of the largest forests may also be on steep slopes so the routine does not find an adequate LZ. Since first submitting this I have made a version of the script that will automatically expand the search area if an LZ is not found in the initial search area. I will have to make some changes too the demo mission to incorporate these changes.

The first post now has the latest version which expands the search area until an LZ is found. In addition it includes a demo on the island of Nagova which has a different type of forest to show that the algorithm works with the smaller tree forest models (this was a problem with earlier versions). The algorithm works on all OFP BIS islands and standard BIS objects. If anyone needs it to work on user made islands or has problems with it not detecting user made object/obstacles, please let me know which island or which objects and I will try to adjust it to work with those as well.
« Last Edit: 02 Feb 2009, 19:46:30 by Raptorsaurus »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: AI Chopper Automatically Finds Suitable Landing Zone
« Reply #8 on: 03 Feb 2009, 00:43:20 »
In addition to what you already have in the readme, you might add some special section with instructions to adjust the scripts to work with a particular non-bis island, otherwise you might end adjusting it by yourself to be compliant with who knows what requested by who knows who  ;)

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re: AI Chopper Automatically Finds Suitable Landing Zone
« Reply #9 on: 05 Feb 2009, 04:16:19 »
The problem is that figuring out how to adjust it changes from one model to another. If you look at the complexity of the contingencies in the functions you will see what I mean. I was thinking of adding user parameters that would adjust what the function looks for but I found that that would require about 10 to 15 parameters. Instead I made the test as general as required for standard BIS models for forests and objects. If there is some increased interest and I find that many people need it adjusted for non-BIS forests/object models, then I probably would try to come up with an instruction. More experienced scripters/function writers could probably do it on their own by examining the functions to see how the checking is done and adjust the numbers as needed. The toughest part was jumping around all the BIS islands and testing each type of tree, forest, building, fence, etc's. As you know there is no getHeight function in OFPEC, but I did find that larger objects tended to have a greater distance to their getPos positions. In other words, if you get the position, then set a game logic at that position then check the distance between the game logic and the object, there is a greater distance with tall objects than small objects. There are some anomolies and these are handled with special if-then tests. Anyway, this same thing could be done with non-BIS models to either "fit" them in to existing checks, or to add special contingencies to check for these. Also, I could maybe add and array parameter where if an object type is in that array, then it counts as dangerous to land on. One could make it an array of two dimensional arrays for the forest check, the first element being the type name of the forest and the second being the radius of that forest type. These could be optional arrays that are left off or blank if one has no special objects or forest types to check for. Yes, I think that would work! Then one would only need to find out the horizontal radius and type name for the troublesome object(s).

March 14, 2009: 7:32 PM
This idea will work for user placed objects/units for the overObst function, but forest and tree objects that are part of the map do not work with the typeOf or countType command, so knowing the type name of the forest will not help and using "forest" counType [_obj] does not work either. For this reason forests that are integral to the maps must be determined mathematically by discovering the typical "self distance" and radius size of those forest models. The "self distance" is found by placing a game logic at the getPos of the forest model and then finding the distance from the game logic to the forest. With BIS forests it will be between 6.8 and 6.9 for Nagova diciduous tree forests, between 10.9 and 12.5 for most evergreen forests and greater than 13 for evergreen forests set on steep slopes. I have begun to test some jungle forest on the Hawk Vietnam islands.
« Last Edit: 15 Mar 2009, 03:32:58 by Raptorsaurus »