Jump to content
Sign in to follow this  
blakeace

Blake's AI Forward Observer

Recommended Posts

Really love this Mod. Thankyou very much Blake. Seriously, this should be part of the default Game. Such a simple and elegant solution that gives such a fantastic result.

I have a question though, is there anyway to re-initialise the module after mission start?

I would like to be able to spawn a fresh FO unit mid-mission and then sync it to your module so it can place arty requests. As I understand it, synchronising is half the task - I still then need to re-initialise the module for the new FO unit to be recognised. Any ideas if this is possible? My apologies if I am mistaken and there is no need for a re-initialise and just sync'ing spawned units is enough.

Thanks again for a great mod.

Share this post


Link to post
Share on other sites
Really love this Mod. Thankyou very much Blake. Seriously, this should be part of the default Game. Such a simple and elegant solution that gives such a fantastic result.

I have a question though, is there anyway to re-initialise the module after mission start?

I would like to be able to spawn a fresh FO unit mid-mission and then sync it to your module so it can place arty requests. As I understand it, synchronising is half the task - I still then need to re-initialise the module for the new FO unit to be recognised. Any ideas if this is possible? My apologies if I am mistaken and there is no need for a re-initialise and just sync'ing spawned units is enough.

Thanks again for a great mod.

Thank you, I'm glad you like it.

Not with this version, I have almost finished testing an update, but this is a good idea. Luckily the syncing timing is all between the artillery and the "hidden" artillery module. I just need to record a few key variables so that they can be accessed external to the initialisation script in another script specific to adding new FO's.

Share this post


Link to post
Share on other sites

Update 1.1 available

First post has been updated with a new version.

6sNzqCB5Cn8

Version 1.1 changes

  • Added SADARM,WP and SMOKE firemission types if the artillery have those types of ammunition.
  • Added check to gather if a unit is in combat, and alter lead values less if they are.
  • Added the ability to add FO's dynamically during a mission.
  • Added a check to terminate the FO's scripts if the artillery units are eliminated.
  • Changed Blakes_Fall_of_shot marker displays round type and type of target to help mission designers with analysing their missions.

Note the SADARM is very powerful, especially if used against human players.

In the next version I want to add counters specific to each round type.

Key points:

How FO's call Smoke and WP.

It is important for mission designers to note how I have limited the use of WP/Smoke to try and realise it's use in as realistic way as possible.

If an FO's group's current waypoint is search and destroy or destroy, and their behaviour is set to be combat or aware; Then they will call for WP/smoke if available for the final part of their approach to that waypoint. If they know of any enemy, they will switch to calling HE and the like in preference to the WP/smoke.

My thinking is that way it is used for assaulting possible enemy positions, and prevents it's use at inapproriate times.

Adding a spawned unit as an FO.

Use what you named your AIFO module where AIFO_module_name is in the example.

Use the reference to the new unit spawned where New_unit_object is in the example below.

waituntil {AIFO_module_name getvariable "AIFO_init"};
[New_unit_object,AIFO_module_name] CALL Blakes_Add_FO; 

As always constructive feedback and ideas are always welcome.

Blake

Edited by blakeace

Share this post


Link to post
Share on other sites

Cheers for update. Armaholic informed.

Share this post


Link to post
Share on other sites

Maybe you could insert a Demo Mission in your next release? Its much easier for me to have an working example than a written instruction to see how it works. Thanks

Share this post


Link to post
Share on other sites
Maybe you could insert a Demo Mission in your next release? Its much easier for me to have an working example than a written instruction to see how it works. Thanks

I'll try and remember too :)

Share this post


Link to post
Share on other sites

Hi Blake,

Finally had a chance to test the new version.

Unfortunately I am having a slight problem with the Sync of placed artillery units (as opposed to Module-Generated Ones).

Whenever I place a group of Artillery Units and sync them to the "Blake's AI FO Mortar" module I observer the following:

1. The module remains the default 81mm Mortar and does not seem to change into the same type as the placed units. What is the expected behaviour?

2. The unit manning the mortar does however, become the same type as the unit manning the placed artillery. I used some OA US army Arty and an A2 USMC FO - unit manning the Mortar was an OA US Army rifleman (obtained from the arty units, not from the FO - although this could be the order which I did the syncing).

3. The "module-default-created-Mortar" will fire on an FO's instructions, but not the placed artillery units. Testing is a little tricky as finding an acceptable range for the mixed Arty group is difficult (although I strongly suspect it shouldn't be a mixed group - See observation 1.) I know all placed Arty units must be of the same type - as per your instructions.

I also had problems getting the num_of_missions called function to return a value other than <null>. I was testing this using the module's auto generated mortars and not placed arty units? Will the function to return the number of missions called by an FO unit work on auto-generated artillery units? I was not sure, which is what led me to try some tests with placed artillery (with the intention to test the num_of_missions called function, but can't seem to get them to fire at all!)

Questions before I have another go at another:

1. Do placed Arty Units need to be Sync'ed to the basic BIS ARTILLERY Module as well as yours to get them to fire? I have added Ammunition to the placed units.

2. Once sync'ed, should there still be a solitary mortar + unit at the location of your AI FO Module? e.g. Syncing 3 M119s to the module results with 3 M119s and an additional 81mm mortar - is this as expected? If this is true, should I "this setVariable [ "Size_Group", 0, false];" on the AI-FO Module to remove the default mortar to leave me with just the placed M119 units?

3. Can I use the function to find how many missions and FO has called for both Auto generated artillery and Placed Artillery units?

4. Cheeky as I am, I had other mods running at the time (P85, Sounds and some islands), so I will try again tonight with just vanilla and the AI-FO mod to see if this is the cause of conflicts for syncing placed units.

Anyway, using Auto-generated Artillery pieces with Size_Group and Types defined using setVariable in the init line still works a treat.

HAving a great time with this mod. Prior to this, all of my Editor set-piece battles were a little shallow as I either had to forgo AI artillery altogether or script random strikes based on arbitrary conditions (time, map markers etc). This is much, much better. Suddenly, battles have the extra dimension that was sorely missed.

Thanks again and hoping you can give me a few tips.

Share this post


Link to post
Share on other sites

Updated version 1.2 available in the first post.

Version 1.2

  • Fixed Displaying of the artillery ranges broken in 1.1
  • Added sample missions

Whenever I place a group of Artillery Units and sync them to the "Blake's AI FO Mortar" module I observer the following:

1. The module remains the default 81mm Mortar and does not seem to change into the same type as the placed units. What is the expected behaviour?

If the module has any valid artillery objects synced to it, it won't create it's own mortar units. Validity is performed by checking whether the unit has an artilleryScanner in it's config. That is the best way I have found to check for valid units so far. Are the arty objects valid one's which will work using the default artillery modules coding which this addon draws upon? There isn't two instances of the module one over the other where making the syncs look valid, but half are going to one, and the other half to the second?

I have done some tests to try and replicate in some way your results and am unable to do so.

2. The unit manning the mortar does however, become the same type as the unit manning the placed artillery. I used some OA US army Arty and an A2 USMC FO - unit manning the Mortar was an OA US Army rifleman (obtained from the arty units, not from the FO - although this could be the order which I did the syncing).

Syncing order doens't matter other than for the first FO if spawning units via the module, and for which FO you want as the reference to the debug range display readout.

3. The "module-default-created-Mortar" will fire on an FO's instructions, but not the placed artillery units. Testing is a little tricky as finding an acceptable range for the mixed Arty group is difficult (although I strongly suspect it shouldn't be a mixed group - See observation 1.) I know all placed Arty units must be of the same type - as per your instructions.

Check whether the units are valid artillery units, else they are just considered FO's by the module.

I also had problems getting the num_of_missions called function to return a value other than <null>. I was testing this using the module's auto generated mortars and not placed arty units? Will the function to return the number of missions called by an FO unit work on auto-generated artillery units? I was not sure, which is what led me to try some tests with placed artillery (with the intention to test the num_of_missions called function, but can't seem to get them to fire at all!)

They start as null until they get defined in the module. This process takes a short while to complete. The new version I just uploaded includes some sample code using the counter in the sadarm mission. Nothing special it just displays the total number of missions called.

1. Do placed Arty Units need to be Sync'ed to the basic BIS ARTILLERY Module as well as yours to get them to fire? I have added Ammunition to the placed units.

No, only one unit from the group needs to be synced to the aiFO module.

2. Once sync'ed, should there still be a solitary mortar + unit at the location of your AI FO Module? e.g. Syncing 3 M119s to the module results with 3 M119s and an additional 81mm mortar - is this as expected? If this is true, should I "this setVariable [ "Size_Group", 0, false];" on the AI-FO Module to remove the default mortar to leave me with just the placed M119 units?

No if a valid editor placed object is synced to the module, then no mortars will be created. If a mortar is being created the other units are not considered valid artillery units for some reason.

3. Can I use the function to find how many missions and FO has called for both Auto generated artillery and Placed Artillery units?

Yes, there is a counter created for each seperate FO. they are object variables use the name of the object you want to check to see that units amount.

4. Cheeky as I am, I had other mods running at the time (P85, Sounds and some islands), so I will try again tonight with just vanilla and the AI-FO mod to see if this is the cause of conflicts for syncing placed units.

Unless the mods actually change the artillery objects configs, it would be doubtful they would conflict. That said it is always easier to ensure you have found the right cause by eliminating any other noise :)

I'm sorry but I haven't been able replicate your issues, I hope the answers above will help in some way. Try the new versions sample missions and see what results you get there. These use editor placed units.

Hope this helps Blake.

Edited by blakeace

Share this post


Link to post
Share on other sites

Great addon blakeace, thank you. :)

Just to clarify; what types of arty round does this support? I ask because some of the BIS default rounds (SADARM, WP) don't actually work properly in my experience, or at least not when manually firing the arty using the Fire Control Computer. SADARM just results in a puff of dirt like a bullet striking the ground, and WP shows white smoke but doesn't cause any damage to troops.

Share this post


Link to post
Share on other sites
Great addon blakeace, thank you. :)

Just to clarify; what types of arty round does this support? I ask because some of the BIS default rounds (SADARM, WP) don't actually work properly in my experience, or at least not when manually firing the arty using the Fire Control Computer. SADARM just results in a puff of dirt like a bullet striking the ground, and WP shows white smoke but doesn't cause any damage to troops.

I'm glad you like it.

The ai will use under the right circumstance.

  • SADARM - In my testing this did make a mess of the enemy armours paintwork much of the time. Very effective actually. The effectiveness of these rounds depends on how accurate the fire mission is. The submunition is actually quite small, so if it misses, it only creates a small impact. If the initial charge goes off to far away from the vehicles below the submunitions won't be able to sense the vehicles. Try running my sample mission a few times. Sometimes they decimate the armoured group, other times they aren't accurate enough with leading the targets and the group gets away. I've also seen a few near misses as well. Generally I find if they hit one, it forces the others to stop which makes future fire missions easier against static targets. Which is what occurred when I created the video. All shots in that video were from only one run of the mission.
  • WP - Used more for screening a planned assault on an position. Not sure if it does any damage. Requires certain waypoint conditions for the FO's group for it to be used.
  • Smoke - As above.
  • ILLUM - May use at night if the FO doesn't have NVG's.
  • HE - Default round type used for most occassions.

The artillery needs to have these magazine types added to them for the special rounds to be used. The artillery module doesn't seem to track how many rounds the guns use, so they by default have unlimited numbers if that magazine is added.

Still thinking of the "nicest" solution to the unlimited numbers.

The spawned mortars if used get ILLUM,HE only by default.

Share this post


Link to post
Share on other sites
WP - Used more for screening a planned assault on an position. Not sure if it does any damage.

In my tests WP ARTY ammo was highly effective against infantry.

Share this post


Link to post
Share on other sites

Thanks guys for the replies. Hmm, wonder what I'm doing wrong. Perhaps those rounds work with scripted arty but not via the manual Fire Control Computer.

Cheers.

Share this post


Link to post
Share on other sites
Perhaps those rounds work with scripted arty but not via the manual Fire Control Computer.

Cheers.

Was wondering, if this is true, so did some test:

One M119 named "a1" with me as leader, synchronized with ARTY module, and this init:

{a1 removemagazine _x} foreach (magazines a1);a1 addMagazine "ARTY_30Rnd_105mmWP_M119";

also one infantry group in range as target and some playable/switchable observer behind them.

Fired some shells and switched to observer unit. Well... There was lots of white smoke and all infanty in range died. I saw ARTY ammo configs an it looks, like HE ammo has higher hit/indirect hit value, but WP has wider (50 meters for howitzer (?)) blast radius.

Also, about SADARM, I know, that if just to spawn such shell in air above target, it will do nothing except falling as a stone, but works great when fired as ARTY ammo from gun. Probably must by ARTY module synchronized with such gun, because script, that gives SADARM ammo its specific behavior is located in this module (there is created "rocketcore" class submunition (two of them ?)) above target with separate classname).

Share this post


Link to post
Share on other sites

Hi Blake,

Thanks for the detailed responses to my questions. I solved the problem after looking at your sample mission. I mean it's such a straight forward mod only an idiot* could get it wrong ( *see below) . After updating to the latest release I re-tried my test mission and low and behold - all things working correctly. Even the script I had running to check number of missons called for a group of FOs and disable them.

My stupid mistake was somehow messing up the mod copy for version 1.2 - I got the 1.2 readme into the addons directory but not the .pbo. Humiliating! Not really surprising that the synced placed arty units were simply acting as FOs!

Sorry to waste your time! Thanks again for everything.

Share this post


Link to post
Share on other sites

Fired some shells and switched to observer unit. Well... There was lots of white smoke and all infanty in range died. I saw ARTY ammo configs an it looks, like HE ammo has higher hit/indirect hit value, but WP has wider (50 meters for howitzer (?)) blast radius.

Ouch! At least with the guns there is the option of using smoke or WP depending on the mission designers desires. Mortars I don't think are to devastating, in all my tests which is the included WP mission there always seems plenty of opfor still fighting back after the WP rounds ended. Though I never did any real head counts.

Also, about SADARM, I know, that if just to spawn such shell in air above target, it will do nothing except falling as a stone, but works great when fired as ARTY ammo from gun. Probably must by ARTY module synchronized with such gun, because script, that gives SADARM ammo its specific behavior is located in this module (there is created "rocketcore" class submunition (two of them ?)) above target with separate classname).

By spawn, do you mean using the spawn mode from the artillery module, or by createvehicle just out of curiosity?

Hi Blake,

Thanks for the detailed responses to my questions. I solved the problem after looking at your sample mission. I mean it's such a straight forward mod only an idiot* could get it wrong ( *see below) . After updating to the latest release I re-tried my test mission and low and behold - all things working correctly. Even the script I had running to check number of missons called for a group of FOs and disable them.

My stupid mistake was somehow messing up the mod copy for version 1.2 - I got the 1.2 readme into the addons directory but not the .pbo. Humiliating! Not really surprising that the synced placed arty units were simply acting as FOs!

Sorry to waste your time! Thanks again for everything.

No worries mate, I've had my own massive share of face plant moments, just not going to out myself with them here :p

Share this post


Link to post
Share on other sites
Mortars I don't think are to devastating,

Indeed. Some examples:

M119 HE ammo: Hit: 250; indirecthit :110; indirectHitRange: 25 (hmm obviously this range is not in meters);

M119 WP ammo: Hit: 60; indirecthit :50; indirectHitRange: 30;

M252 HE ammo: Hit: 160; indirecthit :50; indirectHitRange: 20;

M252 WP ammo: Hit: 35; indirecthit :30; indirectHitRange: 20;

I wish to know, exactly how these values ​​translate into the final effect, but overall trend is clear.

By spawn, do you mean using the spawn mode from the artillery module, or by createvehicle just out of curiosity?

Createvehicle.

Share this post


Link to post
Share on other sites

Updated

Version 1.3 available in the first post.

  • Added AI from the same group may attempt to move to a dead FO and retrieve his FO ability.
  • Added code to prevent unlimited ammunition from the artillery.
  • Improved the efficiency of the code slightly.

The addition of ai members retrieving the FO abilities means you don't need as many FO's synched in case some die. Though if the new wannabe FO dies before grabbing the ability, no further attempt is made to pass on the ability.

Share this post


Link to post
Share on other sites
Added code to prevent unlimited ammunition from the artillery.

Interesting. Can I ask how this code looks?

Also have such questions:

Some time ago I maded AI arty script too, dedicated to beginners however, but for more advanced users yours arty scripts seems to be better in my opinion. So I'm wondering, would you be interseted in implementing/adapting into yours script used by me code for calculating amendment for moving targets? I used for that purpose overall movement vector determined by comparing of target's position change in time instead of simply target's movement direction in given moment only. This makes FO more clever and makes targeting routine less sensitive to dodging and erratic movement, because FO pays attention on general movement direction, not on present direction. Of course this way of calculation needs more time. But maybe you used some better method...

Maybe also you will be interested in used by me way to choose most tempting target amongst known enemies?

Share this post


Link to post
Share on other sites

The addition of ai members retrieving the FO abilities means you don't need as many FO's synched in case some die. Though if the new wannabe FO dies before grabbing the ability, no further attempt is made to pass on the ability.

Nice update, thank you!

The "no further attempt is made.." to replace a dead FO if first replacement gets a prior hit - is that by design, or a imitation of the engine? - curiosity, not complaint :)

BR

Orcinus

Share this post


Link to post
Share on other sites

I've used your code to give my M119s HE rounds, but they are still firing SADARM because the targets are tanks.

My module init is this: this setvariable ["Arty_Type","M119",false]; this setvariable ["Size_Group",4,false]; this setvariable ["Arty_Ammo",["ARTY_30Rnd_105mmHE_M119"],false];

Also, there is something bizarre about how howitzers work in this mod. They are firing in the complete wrong direction, yet their rounds are landing at the target.

Share this post


Link to post
Share on other sites
I've used your code to give my M119s HE rounds, but they are still firing SADARM because the targets are tanks.

My module init is this: this setvariable ["Arty_Type","M119",false]; this setvariable ["Size_Group",4,false]; this setvariable ["Arty_Ammo",["ARTY_30Rnd_105mmHE_M119"],false];

Also, there is something bizarre about how howitzers work in this mod. They are firing in the complete wrong direction, yet their rounds are landing at the target.

Hi Maturin,

I've had a quick look at this, it seems as if the BIS artillery module now gives the units all the ammo types by default. I tested with both spawned and editor placed units and they all have access to SADARM ammo without requiring the designer to manually add the magazines.

There is no need to add HE rounds all units automatically have these and it now seems all other types too!

this setvariable ["Arty_Ammo",["ARTY_30Rnd_105mmHE_M119"],false];

To stop the ai using SADARM, add this to the AIFO module to stop SADARM use.

this SETVARIABLE ["SADARMcount",0,false];

Actually this mod only calculates where and then requests fire missions from the default BIS artillery module. The default BIS artillery module handles all the firing of the units, so it would be something to do with that.

Hope this helps

Blake.

Edited by blakeace

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  

×