Jump to content
Sign in to follow this  
tpw

TPW LOS: AI line of sight system

Recommended Posts

20130915: THIS MOD IS NOW PART OF TPW MODS AND IS NO LONGER SEPARATELY MAINTAINED. PLEASE USE THE TPW MODS THREAD TO REPORT BUGS AND REQUEST FEATURES.

TL;DR - AI stop and rapidly turn and fire upon enemies they have line-of-sight to.

Download (always contains latest versions of all my mods): https://dl.dropboxusercontent.com/u/481663/TPW_MODS.zip

Readme:

TPW LOS - AI line of sight

Version: 1.04

Author: tpw

Date: 20130913

Requires: Community Base Addons A3

Description

-----------

Arma 3 AI is a bit of a mixed bag. Whilst on the one hand they can display almost superhuman accuracy at distance, close in they can be very sluggish and ignorant of obvious nearby threats. TPW LOS is a small mod designed to enhance the CQB experience by enabling AI to rapidly turn to and fire upon any visible enemies they have line of sight to.

- Works for all editor placed and spawned infantry.

- Infantry units will stop, rapidly turn (stance dependent) and fire upon any visible enemies they have line of sight to.

- Enemy visibility is influenced by time of day, stance, speed, camouflage and NV at night.

- Enemies closer than a specified minimum distance (default 25m) are considered visible regardless.

- Enemies beyond a maximum distance (default 100m) are not subject to line of sight calculations.

- Debugging will enable blue balls over any units that have line of sight to an enemy.

This is an Arma 3 specific re-release of the original Arma 2 TPW AI LOS addon, using Arma3 specific scripting commands and assets.

Installation and configuration

------------------------------

Extract the @TPW_LOS modfolder to your preferred mod location, and call it via command line or mod launcher. You'll need Community Base Addons A3 (CBA A3) for the addon to launch and function properly.

Copy @TPW_LOS\userconfig\TPW_LOS\TPW_LOS.hpp to your userconfig\TPW_LOS\TPW_LOS.hpp. You may edit this file to taste:

tpw_los_hint = 1; //STARTUP HINT. 0 = NO HINT, 1 = HINT

tpw_los_debug = 0; //DEBUGGING. UNITS WITH LOS TO A VISIBLE ENEMY WILL HAVE A BLUE BALL OVER THEIR HEADS. 0 = NO DEBUGGING, 1 = DEBUGGING.

tpw_los_maxdist = 100; //MAXIMUM DISTANCE (M). LOS STUFF ONLY WORKS FOR UNITS CLOSER THAN THIS.

tpw_los_mindist = 25; //MINIMUM DISTANCE (M). ENEMIES ARE CONSIDERED "VISIBLE" NO MATTER WHAT, IF LESS THAN THIS DISTANCE.

tpw_los_sleep = 5; //DELAY UNTIL LOS FUNCTIONS START

The script version is in @TPW_LOS\scripts. Instructions for running it are in the header of the script. Please note that if you already have the addon version running, the script version will detect it and quit.

Known bugs and shortcomings

---------------------------

While LOS works well to sharpen up CQB performance in Arma 2, your kilometerage may vary in Arma 3:

- Arma 3 AI are significantly more recalcitrant than Arma 2 AI and scripting them can be like herding cats. Even though they may have perfect line of sight to an enemy, their FSM may cause them to do other things than shoot.

- Arma 3 AI turn much slower than Arma 2 AI.

Feedback

--------

As always I welcome feedback. My mods only improve due to your input. However, input which consists of asking me why there is no proper MP or dedicated server version, without offering help in this department, improves nothing, especially my temper.

For the record: I only play SP, have little interest in playing MP, little skill in coding MP, and no ability to test it. If you desperately want a fully functioning MP version of this or any of my other mods, and can't wait for me to make it happen, then you are welcome grab the code and knock yourself out.

For the sake of my sanity, when you're reporting bugs and issues can you please tell me:

- Arma3 version

- Version of my mod

- Script or addon version

- Running on SP, MP or dedi

Thanks

------

SaOk: Original line of sight code demonstration

CarlGustaffa: Azimuth stuff

Ollem: Additional code and support

Changelog

---------

20130913: v1.04

- Introduced "all in one" startup hint for all TPW mods, you'll get the one hint showing all active mods.

- Script versions will detect an already running addon and quit.

20130805: v1.03

- LOS calculations are not applied to units given hold fire (combatmode == "BLUE")

20130803: v1.02

- Implemented a stance specific rapid turn function to over-ride the slow default turn speed of AI

20130720: v1.01

- LOS functions no longer applied to player

20130717: v1.00

- First Arma 3 release of TPW LOS

Disclaimer

----------

I totally refuse to accept responsibility for anything that might happen to your game/computer/life as a result of using my mod. If you accept this, then feel free to use and modify this code, on the proviso that you post back changes and improvements so that everyone can benefit from them, and acknowledge the original author (tpw) in any derivative works.

My A3 mods:

TPW CIVS: Ambient civs and traffic

TPW FALL: Realistic infantry falling from height and bullet hits

TPW LOS: AI Line of sight system for enhanced CQB

TPW EBS: Engine based AI/player suppression

TPW HOUSELIGHTS: Automatic house lighting for Altis/Stratis

TPW BLEEDOUT: Realistic bleeding system

TPW FOG: Foggy breath for Altis/Stratis

Edited by tpw

Share this post


Link to post
Share on other sites

Great release, tpw!

I'm creating a coop mission for me and my friend and in the testing phase, this "bug" really annoyed me... AI units standing there and looking right at you but doing nothing at all :(

Gonna test it right now!

Thanks

Share this post


Link to post
Share on other sites

I have always used your LOS addon for A2. Great release!

What is the reason for:

Enemies closer than a specified minimum distance (default 25m) are considered visible regardless.

Performance issues? Back in A2 i used to set: tpw_los_mindist = 1;

Share this post


Link to post
Share on other sites

Thank you for this!

Do you have any information on how the script affects performance?

Share this post


Link to post
Share on other sites

tpw, you make it all worth-while.

Many thanks. Now for someone to get the fsm into acceptable shape.

any plans on a script version?

Share this post


Link to post
Share on other sites
Guest

Release frontpaged on the Armaholic homepage.

===================================================

We have also "connected" these pages to your account on Armaholic.

This means in the future you will be able to maintain these pages yourself if you wish to do so. Once this new feature is ready we will contact you about it and explain how things work and what options you have.

When you have any questions already feel free to PM or email me!

Edited by Guest

Share this post


Link to post
Share on other sites
Do you have any information on how the script affects performance?

I've been wondering about that too, considering the not-so-great sqf performance.

Share this post


Link to post
Share on other sites

I don't think I own a mission that doesn't have a tpw script in it -his stuff is like crack!

Also wondering about the minimum distance - does that mean that any unit under the 25m is automatically made known to the enemy? Not good for CQB -that's why I always play it safe and set to 1m.

any plans on a script version?

I'm glad I didn't have to ask this time :p Any plans to convert your Arma 2 suppression script?

Share this post


Link to post
Share on other sites
I don't think I own a mission that doesn't have a tpw script in it -his stuff is like crack!

Also wondering about the minimum distance - does that mean that any unit under the 25m is automatically made known to the enemy? Not good for CQB -that's why I always play it safe and set to 1m.

I'm glad I didn't have to ask this time :p Any plans to convert your Arma 2 suppression script?

Isn't it already? or am i mixing things up.

http://www.armaholic.com/page.php?id=19467

Share this post


Link to post
Share on other sites
Isn't it already? or am i mixing things up.

http://www.armaholic.com/page.php?id=19467

Yes I have that but after reading

This is an Arma 3 specific re-release of the original Arma 2 TPW AI LOS addon, using Arma3 specific scripting commands and assets.

...I figured this was optimized purely for Arma3. LOS is part of TPWCAS as far as I know, so I'm guessing this is an updated version by original author. But yes, abit confusing...

Share this post


Link to post
Share on other sites

Thanks for all the feedback guys. Here are a few answers in no particular order:

1 - I use CBA perframeeventhandler which helps to keep the fps loss minimal. If you have 50 AI on a map you might drop a few fps, but it shouldn't be dramatic

2 - Ollem pretty much took over TPWCAS when I was otherwise indisposed, and did a beautiful job too. He incorporated some LOS functionality into TPWCAS but it works slightly differently. TPWCAS for A3 is not yet production ready due to some of the scripting changes introduced in A3. I'm sure that Ollem, being the coding magician he is, will eventually get it on par with the A2 version

3 - 25m does not mean that the enemy is automatically known. It just means that the other visibility parameters (stance, speed etc) no longer apply. If the unit doesn't have LOS to the enemy 10m away then they still won't react to them. Let's say an enemy is prone, in the dark, at 80m away. Even though a unit had LOS to it, the enemy's overall visibility might be less than the threshold, and the unit wouldn't see/fire at them. The same enemy 10m away would be considered visible the moment the unit had LOS. Anyway, that's the rationale but I provide a config file for a reason!

4 - I will provide a script shortly!

Thanks again everyone.

Share this post


Link to post
Share on other sites

How do I eliminate the red marker that identifies sighted enemy and their last known position? To be clear, I do not refer to debugging option (I have it switched off), but to the marker that appears when a commander assigns targets to you, only in this case I am the commander and the script paints the target.

Share this post


Link to post
Share on other sites
How do I eliminate the red marker that identifies sighted enemy and their last known position? To be clear, I do not refer to debugging option (I have it switched off), but to the marker that appears when a commander assigns targets to you, only in this case I am the commander and the script paints the target.

im not sure but I think you are on ez mode. check your difficulty options

Share this post


Link to post
Share on other sites

Do you think you could do something about the enemy having the superman abilities of blowing your head off from 800 meters?

Because the way I think of it now, the enemy can not only blow your head off from 800 meters but now, because of your script (great work btw!!)

they can blow your head off when closer to the player and his/her AI teammates.

Just seems things just got more difficult, or I'm I getting the wrong idea about this?

Share this post


Link to post
Share on other sites
im not sure but I think you are on ez mode. check your difficulty options

No it's a known bug that was in TPW LOS ArmA2 version initially.

I remember the fix was really simple. The issue was tied to TPW LOS not taking into account if it was a player or AI to whom the script was applied and so it basically gave an order to a player to target someone too much like if it was done by a commander through in-game UI or AI commander. Need isPlayer condition.

Share this post


Link to post
Share on other sites

Can I somehow rectify this or does it require the creator's intervention?

Share this post


Link to post
Share on other sites

Thanks for this input. I've personally never seen the red targetting box referred to, but I play with nearly all aids turned off. Metalcraze is right, I will add an extra if and we are good to go.

Share this post


Link to post
Share on other sites

ok, i understand how to install the mod and been able to install it, now what is the "calling" part?

Share this post


Link to post
Share on other sites

TPW LOS: https://dl.dropboxusercontent.com/u/481663/TPW_LOS_101.zip

Changes:

  • LOS calculations no longer applied to player - should eliminate the red marker on easier difficulty settings.

---------- Post added at 07:57 ---------- Previous post was at 07:53 ----------

ok, i understand how to install the mod and been able to install it, now what is the "calling" part?

Installing the mod is half the battle, the "calling" bit is making Arma 3 actually use the mod. Here's what I cribbed from Armaholic:

You'll also need to add a Launch Parameter to Steam, in order to do so right-click on ArmA 3 Alpha and click Properties and then Set Launch Options. In the window that opens enter in -mod=@your_mod_folder_name

For using multiple mods you would then do so like this:

-mod=@mod_name;@mod_name2;@mod_name3;@mod_name4;@mod_name5

So you'll need to add -mod=@TPW_LOS to the launch options in steam.

Share this post


Link to post
Share on other sites

I dont think you need to add -mod= to your parameter, you can just enable it inside the game and i dont see how this improves the AI at all.

---------- Post added at 00:03 ---------- Previous post was at 00:02 ----------

they're just as slow turning as they were

Share this post


Link to post
Share on other sites
I dont think you need to add -mod= to your parameter, you can just enable it inside the game and i dont see how this improves the AI at all.

---------- Post added at 00:03 ---------- Previous post was at 00:02 ----------

they're just as slow turning as they were

You're welcome.

Share this post


Link to post
Share on other sites
You're welcome.

Hahaha. It's no wonder modders often stop making mods...

In light of killerwhale's statement, though, the mod isn't supposed to make the AI turn faster but rather to spot and react to enemies more quickly -- is that about right?

Share this post


Link to post
Share on other sites
Hahaha. It's no wonder modders often stop making mods...

In light of killerwhale's statement, though, the mod isn't supposed to make the AI turn faster but rather to spot and react to enemies more quickly -- is that about right?

That's it in a nutshell. Early on in the piece I experimented with making the AI turn instantly to face the direction of the enemy (using setdirection) and it looked crap so I abandoned the idea. Like I say in the readme, your mileage may vary with this mod due to the limitations of A3 AI.

What bugs me the most is that AI turn so slowly, yet the player can turn as fast as they can move a mouse, even when sitting, prone etc. Might be time for a dive into the configs...

Share this post


Link to post
Share on other sites

Just a note that if i switch characters (ie from blufor to green side) the red target indicator is active.

Share this post


Link to post
Share on other sites

Just tried it and I'm completely in love with it! With the AI reacting faster the gameplay is much more challenging and dynamic. Also performance is very good. I didn't notice much of an impact, even with 50 AI shooting each other.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×