Home   Help Search Login Register  

Author Topic: For scripting gurus; UA AI use ;-)  (Read 1601 times)

0 Members and 1 Guest are viewing this topic.

Viriato

  • Guest
For scripting gurus; UA AI use ;-)
« on: 03 Nov 2003, 11:36:06 »
The guys from the CoC has gave us a wonderfull toy to play with, the Unified Artillery system, but, the A.I. canÂ't use it normally.    Of course, you can make a line of code wich calls a barrage on a given target, but there is no A.I. response (or simulated A.I. response) other than that.

What about a way to make the A.I. use the CoC UA wisely?

I have been thinking about that for quite a long time (as a betatester) and i think that all the pieces are over the table, and we only need a man good at solving puzles.

- First we had to create an array of the units known by the A.I. forward observers, i think that this has been already done.

- Second, we had to select the proper target for our arty within that array, some scripts like the ToadlifeÂ's group linking script has a similar system.

- Third, we call the arty barrage over that target with the proper line of code [gun, [target]] CallIFfireect...

- Fourht, we put a delay to let the CoC UA do it job.

- Fifth, starts again.


A improvement over this will be to calculate the speed of the target and calculate the estimated position when the shells land, so the script will maximice itÂ's hitting chances.

As the CoC UA acts faster if you correct the previous mission instead of calling a new one will be wiser to use this if you stay with the same target.

Overall, i think that this will be hard and code extensive, but doable.

¿What do you think?

Offline Spinor

  • Members
  • *
  • I'm a llama!
    • The chain of command
Re:For scripting gurus; UA AI use ;-)
« Reply #1 on: 04 Nov 2003, 17:34:09 »
I guess it can be as simple or as complex as you want it. Assuming you have
an array that includes all known (to the FO) enemies, the simplest solution would
be call fire on the nearest enemy. From this, one can add more realistic things like:
  -Call proper Arty type according to target type
  -Priority fire on dangerous enemies
  -Priority fire on static enemies
  -Maybe, mission-designer definable suppression areas

Viriato

  • Guest
Re:For scripting gurus; UA AI use ;-)
« Reply #2 on: 04 Nov 2003, 18:15:21 »
ThatÂ's what i am talking about.

My scripting skills are pretty limited, i can make some complicated scripts, but short scripts.  Once i try to make something of a certain entity, i finally mess it all.

Once my limitations has been recogniced, i had enougth skills to realice that this kind of script is possible with no innovative scripting resources, but using previous solutions like those used on group linking scripts, "detect most known enemy", improved AI behaviour ect...

My hope is that some of the guys which are actually able to merge six pages of code without dropping a comma on the wrong place (well beyond of my capabilities),  take a look at this post and said "Hey, itÂ's true i can do it!"

So, ToadLife, LCD, Spinor Anybody!!

It will be a good way to take the artillery to the place that OFP demands.

Regards you all.

Unnamed

  • Guest
Re:For scripting gurus; UA AI use ;-)
« Reply #3 on: 05 Nov 2003, 04:25:10 »
I was already in the process of expanding my Observer addon, to track groups for indirect fire scripts.

It works along the lines of:

Get the detected groups.
Get the groups info (Speed,Position,Direction,Composition,Cohesion).
Weight the groups based on all of the above.
Check group proximity (Large multiple groups take precedent over single groups).
Track the weighted groups over a period of time to find the most consistent.

Not sure it will use any ordnance wisely, but it's better than first come first served.

I have not looked into it yet, but I see no reason why you can't have a script to detect and control COC's UA.

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:For scripting gurus; UA AI use ;-)
« Reply #4 on: 05 Nov 2003, 06:17:02 »
Well sarge, if you need help making your observer addon work with UA, drop me a line.

dinger@thechainofcommand.com

:)
Dinger/Cfit

Viriato

  • Guest
Re:For scripting gurus; UA AI use ;-)
« Reply #5 on: 05 Nov 2003, 10:22:14 »
Sounds great Unnamed!!

ThatÂ's exactly what we need.

Unnamed

  • Guest
Re:For scripting gurus; UA AI use ;-)
« Reply #6 on: 06 Nov 2003, 23:44:10 »
Quote
Well sarge, if you need help making your observer addon work with UA, drop me a line.

Cheers I will, I rekon it's a safe bet that you have provided everything needed in the UA documentation :)

But the observer is more of a proto type at the moment, I'm still trying to figure out what you can and cant get away with in OFP and what works and what doesnt.

So I'd look forward to any help you and the guys over at COC could offer. I will PM BN880

Quote
ThatÂ's exactly what we need.

Hope it will live up to my hype :)

cornhelium

  • Guest
Re:For scripting gurus; UA AI use ;-)
« Reply #7 on: 03 Jan 2004, 01:41:47 »
Hi Unnamed,

This sounds great. Thanks for your efforts  :-*


Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:For scripting gurus; UA AI use ;-)
« Reply #8 on: 12 Jan 2004, 04:51:58 »
    Here is a simple script I wrote for a 'nam mission I'm working on. It uses a function called "find units" that is extremely simple and just finds units within a certain distance of another unit. You'll notice I execute an artillery strike script, but that line could easily be replaced by a call for UA to fire (actually I'm going to replace that line soon).
    Basically it looks for an enemy target with no friendlies nearby (that the observer knows about), then it calls for fire, waits, and repeats. Simple but it works decently. One major problem with it though (and please, somebody tell me how to fix this!), is that the AI will call for fire as it is retreating, on targets it can no longer see. In some ways this is realistic (calling for arty to cover the retreat), but the problem is even if the target moves while the spotter is running away, each new barrage is still centered on his position.

The code:

Code: [Select]
_observer = _this

#Loop
    ;//wait until enemy detected
@("Land" countType ([_observer, west_units] call knownUnits) > 0 && allow_Earty) OR !(alive _observer)
?!(alive _observer) : exit

_knownEnemies = [_observer, west_units] call knownUnits
_i = 0
_max = count _knownEnemies
   ;//loop until target is found with no friendlies nearby

#FindTarget
     _unit = _knownEnemies select _i
     ?  count ([_unit, 100, east_units] call findUnits) == 0 AND "Land" countType [_unit] == 1 AND (_observer knowsabout _unit) > 3 : goto "CallStrike"
     _i = _i + 1
     ? _i < _max : goto "FindTarget"

   ;//if no safe targets, wait, then back to beginning
~20
goto "Loop"


#CallStrike
_observer dofire _unit
_observer switchmove "combattomedic"
~4
?!(alive _observer) : exit

allow_Earty = FALSE
[getpos _unit, "sebgren", 150, 1, [1,3] call randInt, 0, 0, 5, 75 + ((4 - (_observer knowsabout _unit)) * 30)] exec "scripts\g_arty.sqs"

~10 + random 5
allow_Earty = TRUE
goto "Loop"
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Unnamed

  • Guest
Re:For scripting gurus; UA AI use ;-)
« Reply #9 on: 13 Jan 2004, 17:31:06 »
Quote
In some ways this is realistic (calling for arty to cover the retreat), but the problem is even if the target moves while the spotter is running away, each new barrage is still centered on his position.

I should be able to sort out a true line of site thing soon, but why not say?

If the observer is moving he cant call fire.

If he starts retreating, call down the barrage on his last positon, for a set period of time.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:For scripting gurus; UA AI use ;-)
« Reply #10 on: 13 Jan 2004, 18:44:47 »
Quote
I should be able to sort out a true line of site thing soon
 I'll be looking forward to that!

Quote
If he starts retreating, call down the barrage on his last positon, for a set period of time.

  Good idea, and easy enough to do.

Quote
If the observer is moving he cant call fire.

   Well how would he call fire then? Would he have to wait until the leader happens to stop? Or would I have to force him to stop via script (in which case, why would I bother with that at all?)?
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Unnamed

  • Guest
Re:For scripting gurus; UA AI use ;-)
« Reply #11 on: 13 Jan 2004, 19:03:01 »
Quote
Well how would he call fire then? Would he have to wait until the leader happens to stop? Or would I have to force him to stop via script (in which case, why would I bother with that at all?)?

My mistake, I assumed you had a seperate group for the observer, that would not move around when spotting.


Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:For scripting gurus; UA AI use ;-)
« Reply #12 on: 13 Jan 2004, 19:38:49 »
Oh, I see. Sometimes I have a separate group, and sometimes they are mixed in with a squad. Thanks for the suggestion though!
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!