Home   Help Search Login Register  

Author Topic: HCA - Helicopter Collision Avoidance - ArmA Version (ACCEPTED)  (Read 6518 times)

0 Members and 1 Guest are viewing this topic.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
If you have ever made a mission with more than one AI helicopter, you are well aware of how skilled the AI are at flying into one another. Here is a solution.

HCA - Helicopter Collision Avoidance
ArmA Version
by Mr.Peanut
Version 1.1 : July 1, 2008
Formerly called HeliCAS, before I knew CAS meant Close Air Support.

DESCRIPTION:
This script works by predicting each helicopter's position _dt seconds from present.  If any of the helicopters are
closer to each other than distance _dist they are nudged apart from each other with a speed based on the value
of _spd. The _delay variable is the loop delay between collision checks.  There is a degree of randomness involved.
The helicopters will not always successfully avoid collision. In the demo provided there are eight AI helicopters,
one of which will crash about 50% of the time in the first thirty seconds.

MP USAGE:
HCA will work in multiplayer if is run with the same arguments on all nodes i.e. server and clients.
It will also work with helicopters piloted by players, and AI helicopters under player command.
There are limitations. Two helicopters approaching collision at high speed might crash. A player trying very hard
to crash his helicopter into another will eventually succeed.

I would be greatful if someone would test the demo mission on a dedicated server. I don't have the horsepower to do so myself.

http://ca.youtube.com/watch?v=Eexpx1BvRMs
Here is the embed object info for the youtube link. I don't have a clue what to do with it.
Code: [Select]
<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/Eexpx1BvRMs"></param><embed src="http://www.youtube.com/v/Eexpx1BvRMs" type="application/x-shockwave-flash" width="425" height="350"></embed></object>

;======================================================================
;
; OFPEC Keywords: helicas,helicopter,helicopters,heli,helis,chopper,choppers,collision,collide,avoid,avoidance,crash
; SMUC Code: M for Multiplayer
; Originally released on www.ofpec.com
;
; Thanks to Mandoble for ArmA conversion advice and prodding me to re-release.
;
;Changelog
;2008/06/10 - Optimised code for sqs syntax. Added prefix tags to all global variables.
;             Tested for MP compatibility including player and player controlled pilots.
;             Functions no longer need to be initialised in init.sqs
;2008/07/01 - ArmA conversion. Tweaked default values for ArmA.

Get HCA v1.1
« Last Edit: 07 Jul 2008, 22:29:13 by Mandoble »
urp!

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: HCA - Helicopter Collision Avoidance - ArmA Version (READY)
« Reply #1 on: 06 Jul 2008, 20:14:18 »
Quite impressive.  :)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: HCA - Helicopter Collision Avoidance - ArmA Version (READY)
« Reply #2 on: 07 Jul 2008, 04:52:10 »
Thanks. It is funny. The OFP version of this script is several years old, and as far as I know it was only used by a couple people. Hopefully the new ArmA version will find a little more use. It would work with fixed winged aircraft but it would take experimentation with the parameters.
urp!

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
very nice :clap:

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Might be interesting to see a version without the script in action, y'know, just for comparison...  :whistle:

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
I leave that as an exercise for the user. Let them comment out the line in the init.sqf and see what happens.
urp!

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Updated this to the latest ArmA version (1.59).

Changes:
  • Improved variable naming
  • Improved coding (performance, more robust, better MP handling)
  • Improved code formatting
  • Player controlled choppers no longer auto evade
  • One can now add new units on the fly with:

Code: [Select]
SMB_HCA_NewHelicopters set [count SMB_HCA_NewHelicopters,_chopper];
Is Mr.Peanut still around?
If so, he may wants to update the readme and make an official release.

Enjoy.  :good:

---

> Standard ArmA Helicopter Collision
http://www.youtube.com/watch?v=bD_LTYEC5tg
vs
> HCA - Helicopter Collision Avoidance
http://www.youtube.com/watch?v=sKShVx4RL9k

---

Edit:

2.1 for a few fixes..  :whistle:
« Last Edit: 24 Jul 2011, 08:30:42 by kju »