Jump to content
Sign in to follow this  
Rydygier

Sneaky Finder of Unfair Positions - script for snipers

Recommended Posts

Recently created a piece of code for next HAC release (probably will be used also for planned guerilla mode), that made me quite happy as performs suprisingly well and can be useful also outside HAC, as another proposition of usage "intersect" commands family combined with selectBestPlaces. So here it is.

This extracted from HAC files pack of functions will choose array of up to 100 (usually less than half of that) from 100 randomly chosen spots around sniper position. For each is calculated LOS check between pos and target pos and elevation/coverage (trees, buildings) values. Then calculates "a quality" for each such positions and returns an array of 2D positions sorted from finest to the worst (but still good). This allows for any mission situation and positions to choose in 90% of cases really sniper-effective positions in the area against given target position - if possible good covered, elevated, and with not disrupted LOS. Often chosen for me positions was not worse, than I would choose by my own... Sometimes not, sometimes some bush or tree may disrupt LOS (for me, maybe for AI not, after all - position passed LOS check provided by introduced in 1.62 for this purpose scripting commands), and sometimes there is not possible to find LOS-proved positions, but even then usual such positions can be considered as reasonable (or at least not so stupid) choose for sniper hideout;

Here is demo mission, see Init.sqf, where is shown in details, how to use this:

SFUP demo

Main code is contained in "SnpPos_fnc.sqf".

Usage:

_positions = [sniper position ATL,target position ATL,"radius" around sniper to search - in fact searches a square area with size of doubled this value,(optional - default 1) - multiplier of elevation factor,(optional - default 1) - multiplier of coverage factor] call RYD_FindOverwatchPos;

Optional parameters may be used for tweaking (not tested yet). The bigger value, the more impact on position's rating will have given factor.

Script will sift-off sea surface positions, if there is no position with not obstructed LOS, instead will return all other positions sorted by its elevation and coverage values.

Target will be marked after search by a flag, red particles (clouds going up) and light source. Player has to his disposal map-click teleport, so can quicly check each of marked positions (the lesser number, the better (according to the script) position). To precise check may be useful temporarily turned off grass (lowest terrain details). Included also secondary functions for debug.

UPDATE:

SFUP demo 2

What's new?

- slightly tweaked;

- takes into account and favors positions inside buildings (if found any, not so often, as there is no too many good positions inside buildings usual, but demo is set up in manner, that should return some interior positions from time to time. Radius for house search (50) perhaps can be wider);

- player is moved to the first position (will be in the building, if possible);

- couple of bonus functions, that allow with some (un)comments use same demo for test, where enemy sniper is created and placed using SFUP. Its position can be marked in 3D, also can be displayed his actual knowledge about player.

Note, that AI likes perform some rope-less bungee jumps from elevated building positions as rooftops...

Edited by Rydygier

Share this post


Link to post
Share on other sites

Rydygier, nice function you have there. Will it also give good sniper roosts in buildings?

Share this post


Link to post
Share on other sites

No, in buildings not. At most within urban area.

Probably possible, even have some idea, how to make this (check for urban area nearby, LOS check for every position of every building then, and must return 3D positions). But not sure, when I 'll have time to work with this piece more, as this is created&published only "by the way". Unless I decide expand it in such a way also for HAC (CPU power/calculation/time "weight" is limitation there). Of course anybody can mess with this code and change/imrove/extend it at the discretion.

Share this post


Link to post
Share on other sites

Updated first post with new version - this version passed efficiency tests with good results, still may need improvements.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×