FlightControl-Master / MOOSE

Mission Object Oriented Scripting Environment (MOOSE) for lua mission scripting design in DCS World
http://flightcontrol-master.github.io/MOOSE/
GNU General Public License v3.0
291 stars 96 forks source link

Bombers not responding to CAS function #344

Closed gunterlund closed 7 years ago

gunterlund commented 7 years ago

Aircraft of type Bomber will not follow parameters set by CAS function type . Review supplied videos for detail in CAS section.

thebgpikester commented 7 years ago

xref https://flightcontrol.slack.com/archives/C3R68L561/p1490441593981287 Question: Can aircraft that have non native taskings be forced to make them? Ie Bombers perform CAS, A-10C perform CAP etc. Or are their finer rules for this. Answering this question will allow us to define as bug or not.

Delta-99 commented 7 years ago

I beleive so or at least I think I read this in the hoggit wiki with regards to setting tasks and enroute tasks via scripting. I think they said when these items are selected in the editor it is simply a way to help the user select the right aircraft for the job. But technically any aircraft can do CAS for instance. If I come across that in the wiki again I will put a link here.

thebgpikester commented 7 years ago

I guess the next step is to create a simple mission that has a known "bomber" that cannot natively do CAS and make it do it, in the simplest way possible. I don't know how to do that, any ideas?

FlightControl-User commented 7 years ago

We need a new AI_BOMB class

Delta-99 commented 7 years ago

@FlightControl-Master, before making something way to complicated let's first see if we can even make this work in the most simple of cases.

Create a flight in the mission editor with a plane that is known to work. Then spawn your bomber with Moose and use CopyRoute of the one in ME. That is first pass. See what happens. If it doesn't perform as expected then look at calling some of the EnrouteTask type methods.

gunterlund commented 7 years ago

Need more information on how to use Copyroute. I see the following parameters CONTROLLABLE:CopyRoute(Begin, End, Randomize, Radius)

I dont see how you tie this to the aircraft to copy. Is there a test mission to review?

Delta-99 commented 7 years ago

@gunterlund here is a sample directly from my mission:

USAWACSPatrolGroup = SPAWN:New("US AI AWACS 1"):InitRepeatOnEngineShutDown():Spawn() local tempRoute = GROUP:FindByName("US AI AWACS Route 1"):CopyRoute(0, 0, true, 100) USAWACSPatrolGroup:Route(tempRoute)

US AI AWACS 1 is a group defined in ME that I want to be "programmed" by Moose obviously. Its just sitting on an airport with no waypoints. This would be your bomber.

US AI AWACS Route 1 is a group defined in the ME that I just want to use for the waypoints. This would be a plane that can do CAS so that you can setup waypoints and actions just for testing purposes. In my mission for the AWACS I have waypoints including an orbit in racetrack pattern between waypoint 2 and 3. This gets copied via the CopyRoute to my Moose spawned plane with the above commands. Note, it has 4 waypoints where like I said on waypoint 2 has the orbit setup on it. Basically the first parameter to copyroute is the index of the first waypoint to copy (0 indexed or waypoint 0). The 2nd parameter is the index from the last waypoint. So 0 really means to copy to waypoint 4. Lets say we used CopyRoute(1,1,...) then it would copy waypoints 1-3 in this case. 3rd parameter allows a little bit of randomization of the actual waypoint with a radius at that point.

As an added bonus this is how I get the AWACS to RTB via a radio command:

local tempRoute = GROUP:FindByName("US AI AWACS Route 1"):CopyRoute(4, 0, true, 100)
USAWACSPatrolGroup:Route(tempRoute)

That copies just waypoint 4 to the AWACS that was spawned above. Waypoint 4 is a land waypoint. SO all its other waypoints are wiped out and it goes to land. BTW, I also define out of fuel and out of ammo options in the route that I am copying and the AWACS follows that too. So it can still land on its own if I'm not commanding it. Now that I'm looking at the code I should make that false for the randomization. But its all good. I'm sure since the waypoint is close to the airport it figures things out anyway.

Delta-99 commented 7 years ago

From the hoggit wiki and link here:

Within the mission editor the task role selection filters the list of valid attributeNames to be relevant to this task. In reality that doesn't matter and you can assign whatever attribute you want for an aircraft to attack.

This is why I said above I believe via scripting you can use a bomber (or any plane) to do CAS. This statement seems to imply that.

gunterlund commented 7 years ago

Delta not sure how this will show our problem as you can make cas missions in the editor using a bomber and they function.

Delta-99 commented 7 years ago

Oh, I thought you couldn't do that. In any event then maybe CAS as implemented in Moose should follow this type of method instead of attempting to more finely control units. I know FC has a higher level thinking going on here especially with regards to detecting units and such but perhaps it's too much. Maybe simplify and make it work like it would if defined in the editor. Because there it works well from what I have seen. I think the best would be to use an enroute task with the option of search in radius or whatever it is. I've seen this work extremely well in the editor.

gunterlund commented 7 years ago

example? Are you talking about a moose function or an ME function?

Delta-99 commented 7 years ago

Not sure what example you are looking for or what part of my answer you are referring to

gunterlund commented 7 years ago

I think the best would be to use an enroute task with the option of search in radius or whatever it is. I've seen this work extremely well in the editor.

Delta-99 commented 7 years ago

It's an ME function. Easily reproduced in Moose. If I remember I can put an example mission up. Super simple.

FlightControl-User commented 7 years ago

@gunterlund its all yours! bombing is implemented, but i can't get it to work properly, bombs seem to explode just after the release. Can you check this a bit please too?