Jump to content
xxanimusxx

[Release] AniRadar - customizable radar for your needs

Recommended Posts

AniRadar is a highly customizable radar for ArmA2 and was developed as a part of a mission I'm working on.

Summary:

This radar will let you decide what to show and allows you to change almost everything to meet your needs.

Enhance your gaming experience and allow others to enjoy your missions using this feature, creating countless new mission objectives and adding new tactical possibilities.

Due to technical problems I was forced to change the known rotating radar to a sonar type one, which is, honestly, not really realistic but meh, who gives a sh**t anyway ^^

Demo:

When a picture is worth a thousand words, moving pictures are pure gold, so here's a demo mission with the AniRadar implemented:

All the dialogs are part of the demo mission and are not element to the AniRadar.

Downloads

Installation:

  1. UnRaR the archive into your mission folders root and initialize AniRadar.
    Just insert this line into your init.sqf to do so:
    execVM "AniRadar\scripts\aniradar_init.sqf";
    waituntil {!isNil "aniRadarInitialized"};   // you can delete this line, but be sure to wait for an adequate time before calling aniRadar-functions.


  2. You have to edit your description.ext-file. If you don't have one in your mission folder, create a new one. Insert this line into the top:
    #include "AniRadar\gui\aniRadar.hpp"


  3. Insert the functions module into your mission (the radar is using BIS_fnc-commands).

Preface:

All of the scripts which are used to modify radar behaviour are located in the AniRadar\scripts - folder.

These scripts are (hopefully sufficiently) commented and mostly provided with examples to offer a deeper insight of expected parameters and other stuff to consider.

It is highly recommended to look into those files before posting any bug report to ensure a well defined usage of the provided scripts.

Please also consider starting your missions with the -showScriptErrors startup parameter to get error messages ingame.

This will save you some valuable time figuring out what your problem is in case of occuring errors.

Using AniRadar:

AniRadar is composed of two parts: the visual part (the radar itself) and the data part.

Visual part:

In order to show the radar, insert the following code into your scripts:

true call aniRadarShow;
// or switch "true" to "false" to hide the radar (automatically deactivating it)

To De/Activate the radar, the following commands are used:

true call aniRadarActivate;
// or false to deactivate.

You'll now see the radar working, using "pulses" to detect the surrounding objects.

These pulses can be configured to be faster or slower, effectively affecting detection rate:

1500 call aniRadarSetPulseDuration;   // 1.5 seconds interval
200  call aniRadarSetPulseDelay;       // 0.2 seconds delay between intervals 

Every pulse generates a ping sound which can be selectively enabled or disabled:

false call aniRadarPlayPing;   // deactivating

Data part:

To be able to show something on the radar, there has to be a source of data which is used to place the icons.

You are in charge of delivering these data using a callback which you have to declare as a global function.

Taking the example provided in the script-file for setCallback:

mySimpleCallback = {
_playerPosition = _this select 0;
_maximumDistance = _this select 1;

_entities = _playerPosition nearObjects ["building", _maximumDistance];
_entities	// The returnvalue
}; 

// has to be run once. Can be called while the radar is active to change the data source on the fly
mySimpleCallback call aniRadarSetCallback;

Your callback function will be called with an array consisting of the players current location and the maximum detection distance.

You can use another location if you fancy some advanced application of this radar (like using relay stations to enlarge your field of detection) but you should be compliant with the maximum distance.

Using another maximum distance can produce undesired visual effects!

The above example will gather all buildings around the player and return it as an array.

After activating the radar (if it's not already) green dots will appear to indicate the location of the buildings relative to your viewing direction.

If you want to change the minimum or maximum detection range, you can do it as follows:

[0, 1200] call aniRadarSetDistance;
// First parameter: Minimum distance
// second paramter: maximum distance
// both in meters

You can change both distances while the radar is active - your callback will automatically adapt to the new detection range IF you followed my suggestion and used the second parameter of the callback as intended.

Note:

If you have a hugh load of objects you want to show on the radar or the process of gathering the data is excessive, you should consider caching the array and just return this array in the callback.

The longer the callback needs to gather the data, the longer will be the delay until the next pulse can be sent.

Be informed that the maximum amount of objects beeing able to be shown on the radar is 80 - any more objects will be discarded.

As most of the "nearXXX"-commands doesn't sort their output based on the distance to the given center point, any object beeing near to you could be discarded due to being the 81th or higher element of the resulting array.

New in v0.9.2:

You can now set the reference object the radar uses to calculate the distances in order to expand the potential use of this radar instead of using the player as the center of the radar field.

You could i.e. set a predator drone as the reference object and do recon missions while sending the drone into enemy fields, use a car or static buildings like the AntiAir-Radars and much more.

myRadarStation = "TK_WarfareBAntiAirRadar_EP1" createVehicle (getMarkerPos radarPosition);
myRadarStation call  aniRadarSetReferenceObject;

When the reference object isn't alive anymore (apparently buildings can die as well in arma :cool:) the reference object is switched back to the player.

To deactivate the radar whenever this happens, you can call the above command with an alternative way:

[myRadarStation, true] call  aniRadarSetReferenceObject;

This will automatically deactivate the radar once the reference object isn't alive anymore.

In this case you have to set another reference object and activate the radar once again if you wish to prolong radar activity.

Moving and Resizing:

The visual part of the radar was made under the assumption of a 16:9 aspect ratio.

Upon calling aniRadarShow the first time in your mission, the radar will be placed in the NORTH_WEST corner of your screen and the default size beeing 512x512pixel.

This specification can be misleading, because there are no pixels in GUI scripting, just relative values ranging from 0.0 to 1.0 (and considering safe-zones even negative values).

But normally you don't have to worry about all of this as long as you have the aspect ration written above (I'm fairly new to GUI scripting so I don't know of any method to be able to provide multi aspect-ratio solutions).

Considering the default size and location of the radar, I'm sure you'd want to move the radar to another point or resize it.

Resizing can be done with providing a relative size using a decimal:

1.5 call aniRadarResize;   // resizing the radar to 150%

You can call this command while the radar is being shown, but it would be better to do it while it's hidden whenever you have the legitimate chance to do so in order to prevent ugly after-images.

Resizing the radar will also invalidate the position, that is beeing askew some pixels to either direction.

The best way to prevent this is to set the location of the radar after resizing:

aniRadar_NORTH_EAST call aniRadarSetLocation;

This will dock the radar to the upper right hand side corner of your screen.

There are 9 possible dock locations described in AniRadar\scripts\aniRadar_fnc_setLocation.sqf so it wouldn't hurt to look into it.

You can also minimize the radar to any of above dock positions using the following call:

[aniRadar_NORTH_EAST, aniRadar_MINIMIZE] call aniRadarSetLocation;

Minimizing the radar will resize it to (default) 33% of it's original size.

Using aniRadar_MAXIMIZE will restore the size the radar had before minimizing (the dock position has to be defined either way).

Customizing:

You're fed up with the used images or just want to do your own thing? That's no problem, you're free to customize everything to fit your needs.

  • I want to change the background images for the radar!
  • The images used for the radar all have the dimensions 512x512 pixels and contain an alpha channel.
    You can download the Photoshop-File in the Downloads-Section and customize or completely redo everything.
    The three layer-groups in the PSD-File are representing the Frame (being the background), the radar field (where the icons are drawn on) and the pulse.
    The "dot" has to be saved as a 16x16Pixel image.
    Remember: Every image used in GUI's has to be a multiple of 2 (2, 4, 8, 16, 32 ...).
    Any half-way experienced Photoshop user should be able to edit and save the files with transparency.
    You need TexView2 to convert png-files with an alpha channel to the games file format named ".paa".
    After converting, name them exactly like the files in the AniRadar\images - folder.
    If, however, you don't wish to add transparency to your images, you're free to use jpg's.
    In both cases (or when using jpg's) you can also name your files using your own standards. Doing so will require you to modify the image's paths in AniRadar\gui\constants.hpp.
    If you don't wish to show an overlay image to create a dust/glas effect, just empty the overlay image's path:
    #define ANIRADAR_FRAME_IMG		"AniRadar\images\radarbackground.paa"	
    #define ANIRADAR_FIELD_IMG		"AniRadar\images\radarfield.paa"
    #define ANIRADAR_PULSE_IMG		"AniRadar\images\radarpulse.paa"
    #define ANIRADAR_OVERLAY_IMG	  ""
    #define ANIRADAR_DOT			  "AniRadar\images\dot.paa"
    

  • How can I use my own icons to show in the radar?
  • Do you want to detect air crafts or tanks and show an appropriate icon or do whatever you're into?
    Thats pretty easy to accomplish, you just have to return a slightly more fancy array in your callback.
    This example will show you the way:
    myComplexCallback = {
    _playerPosition = _this select 0;
    _maximumDistance = _this select 1;
    _returnValue = [];
    _currEntity = [];
    
    _entities = _playerPosition nearEntities ["Air", _maximumDistance];
    {
    	_currEntity = [];
    	_currEntity set [0, _x];
    	_currEntity set [1, [getText(configFile >> "cfgVehicles" >> typeOf _x >> "picture"), 3.0]];
    
    	// Better: Cache all pictures of air vehicles to save time
    
    	_returnValue set [count _returnValue, _currEntity];
    } forEach _entities;
    
    _returnValue;
    };
    myComplexCallback call aniRadarSetCallback;
    


    So what does this script do?
    First it's gathering all the objects of the type "air" and cycles through every element in the forEach-loop.
    Now the callback has to return an array consisting of arrays.
    These inner arrays have the structure: [0] = object or location array, [1] = [PICTURE_PATH, RESIZE_FACTOR] or [1] = PICTURE_PATH.
    As always the script-file will give you a more indepth explanation.
    In the above example we fetch the object's image icon in the cfgVehicles-class and insert it with an accompanying resize factor of 3, which means three times of the original picture.
    You have to experiment with this value to meet your needs because the original size could be too tiny (16x16Pixel in relation to 512x512Pixel)

  • I want another ping sound, how do I manage that?
  • Simply look into AniRadar\gui\sounds.hpp.
    You can change the path to the sound file, change the volume and pitch.
    Please ensure that, if you use your own sound file, the sound is not longer than 1 second, as it could be annoying if you choose a small pulse duration.

  • The minimized radar is too small/big, I want to change the default minimize scale!
  • Simply look into AniRadar\gui\constants.hpp.
    #define ANIRADAR_MIN_FACTOR		0.33	// 33% of the original size


    Change this entry to your hearts content (you shouldn't using anything greater or equal to 1.0, as it would ridicule the minimize feature).

  • I want to change something, but it isn't covered in this section!
  • Well, just explain your idea in this thread and I'll try to come up with a way to customize it asap.

After word:

I'm not experienced in GUI scripting, thus having problems here and there. I managed to create this with the little information I had and I'm sure there are several ways I could've made it better.

If you find any bugs, ideas, suggestions or just want to rant about me being a noob - you're free to post your opinion.

I'm eager to read suggestion to improve my scripts, even if it's just minor stuff, so if you took your time to browse through the scripts (I know that just a small number of you ppl will do this..) you can leave your ideas anytime in this thread.

This is the first version which got publicly released so I bet it will have numerous bugs and other errors which are hard to find.

If you hower contribute in improving this release by posting bug reports, please don't forget to meantion your used screen dimension (in game) and the exact error message you got. It would help alot if you could try to recreate the bug in order to discern specific patterns.

Thank you for trying out AniRadar and have a great time using it for your missions.

Known Bugs:

  • Although cutRsc is used to create the radar, it doesn't dissapear when the map is opened.
  • When the radar is moved or resized repeatedly without waiting for the effects, after-images will be displayed until the next pulse.

Edited by XxAnimusxX

Share this post


Link to post
Share on other sites

Wow, looks great, Animus!

I won't have a chance to dig into this for a few days - is there any way to specify what does or does not return a ping? For example, if you only wanted the RADAR to "see" specific objects?

Share this post


Link to post
Share on other sites

You can set the objects the radar should be able to "see" in the callback you have to write.

For a static list of objects, you'd write a callback like this:

someObjectsAndLocations = [[102, 1000, 0], tank1, tank2, objective0, objective1];

myStaticCallback = {
   someObjectsAndLocations;
};

The scripts will automatically evaluate the array and will show the object whenever they're in the specified detection range.

Another use case could be objects with a specific variable.

Let's say you place objects/units in the editor and add the following line into their init-field:

this setVariable ["aniRadarDetect", true];

Now you could write another callback to show the units which have this variable set.

myOtherCallback = {
   _playerPos = _this select 0;
   _maxDistance = _this select 1;

   _entities = _playerPos nearEntities [["CAManBase","LandVehicle","Air"], _maxDistance];
   _returnValue = [];

   {
       if (_x getVariable ["aniRadarDetect", false]) then
       {
           _returnValue set [count _returnValue, _x];
       };
   } forEach _entities;

   _returnValue;
};

Heck, you could even set a weight to indicate the chance of getting cought by the radar using the above example, the possible application is endless :D

Edited by XxAnimusxX
grammar correction

Share this post


Link to post
Share on other sites

Ah, very nice. looking forward to trying this out.

Share this post


Link to post
Share on other sites

This is awesome mate ! I remember Mandoble having something like this in the early days for AAA but, apart from me, it didnt seem anyone else used it!

I'm seeing an Aliens vs Marines coming up :)

Arma3 variant in the works ?

Share this post


Link to post
Share on other sites

Thanks Foxhound, it's really a honour for me to be able to contribute to this great game in any way possible :D

@Kremator, I didn't even think about porting this to ArmA3, mainly because I got to play ArmA2 for a popular mod (*cough* yeah, I should be ashamed of myself...) but now the game itself did really absorb me somehow so yeah, I'm thinking of porting this for ArmA3 in the future :D

Share this post


Link to post
Share on other sites

Oh - didn't even think of A3. Submarines!

Share this post


Link to post
Share on other sites

This looks quite awesome Animus! I will try to implement this in our bigger missions. Currently I am not capable looking into the files, am I correct this does not require any clientside modding? (In other words will editing/pbo-ing the mission and including your files be sufficient?)

Share this post


Link to post
Share on other sites

XxAnimusxX, very nice job. In response to your technical problems, have you ever taken a look at SPON Radar? It has the "sweeping hand" motion I think you're referring to. I believe it was not upgraded to Arma2, but I have it working in a test mission, so it's doable...

Share this post


Link to post
Share on other sites
Oh - didn't even think of A3. Submarines!

Omg your right, the sonar type would really fit that well!

This looks quite awesome Animus! I will try to implement this in our bigger missions. Currently I am not capable looking into the files, am I correct this does not require any clientside modding? (In other words will editing/pbo-ing the mission and including your files be sufficient?)

I didn't use any mods, just vanilla ArmA2 (latest beta) so editing your mission files will suffice :)

XxAnimusxX, very nice job. In response to your technical problems, have you ever taken a look at SPON Radar? It has the "sweeping hand" motion I think you're referring to. I believe it was not upgraded to Arma2, but I have it working in a test mission, so it's doable...
I'll look into it asap, I knew there was a solution xD

Share this post


Link to post
Share on other sites

AniRadar - Update - 0.9.2

Changelog:

  • new command added: aniRadarSetReferenceObject
  • initialization of modules rewritten
  • if the reference object is in the callback's results, it will be omitted

Summary:

You can now decide to switch the object the radar is using as the center.

With this, you can now use mobile objects (aircrafts, other units, cars etc.) or static ones (buildings) to feed your radar view and allows you to design more complex scenarios (like recon-missions).

The new command is explained in my first post.

@Hand of MoscoW

That video is really good mate! I like the background music and how you synched the pulse rate of the radar with it :619:

I'm really glad and thankful for everyone who takes the time to actually use my scripts, so keep up the good work folks!

Share this post


Link to post
Share on other sites

Cool stuff, it could be adapted for air missions.

Also, would it be possible to mod this radar in order to show humans/not only vehicles? I know this is cheaty and retarded, but I was looking for something like that for a long time. Think of it as a biosensor or motion tracker (like in Aliens :)) of some sort. It shows that there is something there, but you dont really know what exactly (ie. all entities have same icon).

Share this post


Link to post
Share on other sites
Cool stuff, it could be adapted for air missions.

Also, would it be possible to mod this radar in order to show humans/not only vehicles? I know this is cheaty and retarded, but I was looking for something like that for a long time. Think of it as a biosensor or motion tracker (like in Aliens :)) of some sort. It shows that there is something there, but you dont really know what exactly (ie. all entities have same icon).

Once again, what you want to show on your radar depends on the return value of your callback you have to define.

So if you want to show units on the radar, you could do it like this:

unitCallback = {
    _return = allUnits;
    _return;
};
unitCallback call aniRadarSetCallback;

This will return all the units in your game and show them respectively once they're in your radars detection range. If you just want to show a subset of units or specific ones, just alter the callback a bit until your needs are met :)

Share this post


Link to post
Share on other sites

Sorry for script noobing, but where Im supposed to put that code?

Also how exactly I can change icons so all detected stuff has same icons?

Share this post


Link to post
Share on other sites

Follow the stepts for "installing" the radar into your mission, then call the commands from anywhere within your scripts.

I can't make out a specific point because it highly depends on your mission scenario - if you want the radar to appear since the very start, you'd show the radar in your init.sqf, if you're interested in showing the radar after some mission events, you've to do it using triggers or actions or whatever fits your intentions.

For custom icons, please refer to "How can I use my own icons to show in the radar?" in the Customizing-Part of my first post.

If this information isn't enough for you to actually use the radar in your mission, you're free to post your (exact!) mission scenario in which you want the radar to show and everyone here will do his best to help you out with an appropriate callback.

Share this post


Link to post
Share on other sites

Good work mate !

I need to make this always On to replace vanilla radar !

Can it detect incoming missiles ?

Share this post


Link to post
Share on other sites

Grmmml.. I don't mind repeating this again: YOU define what the radar detects, using a callback. So if you want the radar to detect incoming missiles, you'd either use "nearObjects" or name the missiles independently and return your results in the callback, thus allowing the radar to calculate the distance to the reference object and showing the objects.

This isn't a static radar which is pre-programmed to show only a subset of objects the developer (namely me) saw fit to implement, but a highly customizable one for which the datasource for the detected objects can be changed at all times.

PS: For incoming missiles I'd consider lowering the pulse duration to less than one second in order to catch the missile before it hits :D

Share this post


Link to post
Share on other sites

@ XxAnimusxX.

That is soundtrack to old videogame from PS1 - Lifeforce Tenka. In principle it is easy to synchronize electronic music with such video, connected with electronics. :) Using opportunity, I want to thank for creation of such addition. Simply I in such scripts don't understand a lot of things, and you gave the chance to real function for my radar.

By the way, there is one more way of realization of a radar for ArmA 2. From Swedish Forces Pack, with some interesting features: determination of height and speed.

http://www.youtube.com/watch?feature=player_embedded&v=x9qyuHpfGoM

I think only markers it would be possible to change, at least the such:

3258652.jpg

Where key parameters of the purpose too are shown. I won't be able to make it (low skill:)), and to you it is idea can be useful.

Edited by Hand of MoscoW

Share this post


Link to post
Share on other sites

That's really a good idea Hand of MoscoW, normally you'd even get depth information using a real sonar so why not?

It's really simple to get the altitude and the speed of the objects, but as I'm using native GUI-elements to show the images on the radar screen, it will create more overhead in the description.ext.

This would be pretty easy to achieve once I switch to drawing an interactive map into my radar instead of using images but as I wrote in my first post, I'm just beginning to understand the concepts of GUI scripting so it will take some time I guess :D

I'm gonna memorize your suggestion and turn it into the next great update :D

Share this post


Link to post
Share on other sites

this radar is a best for working also a ASDIC and lure a visual asdic with pilenwerfer for submarine ;)

Edited by CERVANTES

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

×