Jump to content

[MOOSE] RAT - Random Air Traffic


Recommended Posts

Hi,

 

This is something that has really sparked my interest. For the first time ever in DCS I might even get to design some basic missions for myself (rather than just downloading missions others have done)

 

In order to do so however, I need to understand some very basics please.

 

Now this may be the dumbest question you will ever have seen but:

 

I downloaded the example mission 11 (carrier) and it works fine. What I don't quiet understand is that the Miz triggers call on two lua files. First the Moose.lua (which is on a seperate drive nowhere near my DCS installation) and the second RAT_011.lua which isnt even on my PC full stop?

 

In which case how is the Miz working just fine??

 

Regards,

 

Gary

 

OK. This may need indeed a bit of explanation...

 

You may have been looking at missions and found a lot of triggers, correct?

 

MOOSE or other scripts use the "scripting engine" of DCS, also subnamed "SSE". This is a set of application program interfaces (APIs) that can be called using the lua language.

 

In other words, MOOSE is "skipping" the Graphical User Interface trigger mechanism embedded within missions, and is directly loading a "mission scripts", using the DO SCRIPT FILE mechanisms.

 

That is why you see only two triggers in the mission. The first trigger loads moose.lua, and the second the actual mission script, which is using the MOOSE classes to orchestrate the mission. Both Moose.lua and the other lua file are embedded in the .miz file! You can unzip the .miz file yourself using unzip of 7z or any other zip tool and check for yourself!

 

RAT is a class of MOOSE, but there are many other classes now that you can use to make missions, which are all included and defined within the moose.lua file.

Consider the moose.lua file as the "definition" of the moose framework, and after loading it in your mission, you can use any MOOSE class to do more advanced stuff.

 

The funny thing about mission design is that you can design a mission using a mixture of triggers and other DCS mission editor capabilities and scripts and even MOOSE framework classes or objects.

 

In other words, you don't have to have only 2 DO SCRIPT FILE triggers in the beginning of your missions, but you are free to use scripting within the mission editor as well! (Just note that lua predicates is bugged in DCS since release 1.5, which is a shame!!! bummer :pain:. Using lua predicates, you could still use the normal DCS mechanism, and check using scripting some conditions on the fly within your mission. It would make mission scripting much more acessible for people like yourself who are starting up. We have escalated this to ED a few times now, but they haven't fixed this since 2 years.

 

 

In short, if you wanna have a good intro about how to embed your scripts into your missions, maybe have a look at this video, that explains a bit this process:

 

fIp2VdvRXQw

 

FC


Edited by FlightControl

[TABLE][sIGPIC][/sIGPIC]|

[/TABLE]

Link to comment
Share on other sites

FC,

 

Thanks. I understand everything above right up to and including the fact that both Moose.lua and any other.lua are embedded. That now makes perfect sense. I did actually watch both Moose for dummies 0 & 1 vids last night but not knowing the lua's are embedded in the Miz made vid 1 confussing. Obviously I could see in the vid the part where you add the triggers and paths to the lua's but fundementaly not realising they were saved within the Miz was the missing part for me.

 

Thanks again. I'm looking forward to giving all the other Moose options a try out now too!

 

Regards,

 

Gary

I5 - 1TB SSHD, 256 SSD - Nvidia 1070 - 16gb ram - CV1

Link to comment
Share on other sites

I have a few questions after playing with RAT for a bit:

 

1) Let's say I want to use the same departure and destination airport. If I add a minimum distance, will RAT simply ignore it since the departure and destination are the same, or will it generate a random flight path to meet that minimum distance requirement?

 

2) What is the difference between SetClimbRate and Vclimb? The descriptions in the documentation are nearly the same, although I suspect SetClimbRate is supposed to be the climb rate, and Vclimb is supposed to be the climb speed. Are both of these functioning? If Vclimb works, I'm assuming the parameter it wants is desired airspeed in knots?

 

I'm sure I'll have more questions as I test more. Absolutely loving the possibilities so far though, this is going to be a game changer for mission developers.

Link to comment
Share on other sites

Good questions :)

1) Let's say I want to use the same departure and destination airport. If I add a minimum distance, will RAT simply ignore it since the departure and destination are the same, or will it generate a random flight path to meet that minimum distance requirement?

At the moment, I explicitly exclude the case that departure and destination airports are the same. One reason is the way the waypoints are created. That would not work too well for that scenario - or at least I have not tested it.

 

Another reason is this:

Consider you want to restrict the departures and destinations like

RAT:SetDeparture({"Airport A", "Airport B", "Airport C"})
RAT:SetDestination({"Airport A", "Airport B", "Airport C"})

So basically you want to limit airports to those three. Normally, when Airport B is randomly selected as departure, you don't want it to be randomly selected as destination as well.

 

I guess I could allow identical departure and destination if only one destination is explicitly given by the user as

RAT:SetDeparture("Airport A")
RAT:SetDestination("Airport A")

No guarantee though that the waypoints are well placed in that case ;) But the aircraft would return to its original base somehow.

 

I'm thinking about implementing zones defined in the ME as destination. Then either the aircraft get despawned when they are in the zone. Or they would turn around and fly back to their departure airport. But it requires some changes in the logic the waypoints are created.

 

So at the moment, the only option to let aircraft fly back to their departure airport is with an intermediate stop via the Commute() option.

RAT:SetDeparture{"Airport A")
RAT:SetDestination("Airport B")
RAT:Commute()

(You don't need to set the destination. If you don't specify it, the first destination is chosen randomly and then the aircraft will fly back and forth between Airport A and a random but fixed other airport.)

2) What is the difference between SetClimbRate and Vclimb? The descriptions in the documentation are nearly the same, although I suspect SetClimbRate is supposed to be the climb rate, and Vclimb is supposed to be the climb speed. Are both of these functioning? If Vclimb works, I'm assuming the parameter it wants is desired airspeed in knots?

There is no difference between SetClimbRate and Vclimb. SetClimbRate just sets the value of Vclimb ;)

Default is 1500 ft/min (= 7.6 m/s). So the unit you have to use for SetClimbRate is ft/min.

 

Note that I (or anyone) don't have control about the actual climb rate of the AI aircraft. The climb rate determines the location of the waypoints assuming that the AI will fly there in a straight line in 3D space. Unfortunately, that is not always the case as I have reported here. Hope it gets fixed soon :)

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

Is it possible to increase the max FL for the aircrafts to, let's say; FL320? Most airliners fly around that ballpark figure?

[sIGPIC][/sIGPIC]

 

Commodore 64 | MOS6510 | VIC-II | SID6581 | DD 1541 | KCS Power Cartridge | 64Kb | 32Kb external | Arcade Turbo

Link to comment
Share on other sites

Is it possible to increase the max FL for the aircrafts to, let's say; FL320? Most airliners fly around that ballpark figure?

Yes, you can do

YourRATobject:SetFLcruise(320)

This would the "default" flight level so that value. The final choice is still random ;) But most aircraft will travel at or near that height.

 

Also, the distance between departure and destination has to be large enough. If a destination is picked close to the departure, then the aircraft can not reach that altitude and the actual flight level is automatically adjusted.

 

You can allow only airports which are at least a certain distance away from the departure by

YourRATobject:SetMinDistance(200)

Here only destinations 200 km away from the departure a chosen.

But you have to be a bit careful. It can happen, that no airports are that far away. DCS maps are not too large ;)

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

Ok,

 

So I have a number of RAT's now in my basic mission set up (mostly C130's and AJS37's) and it occurs to me that it would be really cool to explore the use of Moose for some suitable comms?

 

My RAT's get clearance from ATC to land (text box upper right) and I wondered if there was a way to trigger a sound file when these come up?

 

If not, I'm interested in any use of Moose that might improve the ATC? - calls wouldnt necessarily have to be 100% accurate in order to improve the sense others were "out there" IMHO

 

Regards,

 

Gary

I5 - 1TB SSHD, 256 SSD - Nvidia 1070 - 16gb ram - CV1

Link to comment
Share on other sites

Thanks for the info! I hadn't thought of using commute, that will certainly work for my purposes. I'm simply making a Red Flag scenario and I want a moderate amount of air traffic flying in and out of Nellis, McCarren, and Tonopah to give the scenario a lively feel.

 

Cheers!

Link to comment
Share on other sites

Thanks for the info! I hadn't thought of using commute, that will certainly work for my purposes. I'm simply making a Red Flag scenario and I want a moderate amount of air traffic flying in and out of Nellis, McCarren, and Tonopah to give the scenario a lively feel.

Ah, great to hear! I already have an option in my development version which includes going to a zone and back :)

 

But let me know how your missions are going. AI behavior on NTTR airports can be challenging ;)

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

Missions are great so far! I haven't had this much fun in DCS in a long time, so thanks again for your great work.

 

I think the biggest thing holding RAT back right now is the single runway use. If ED could resolve that and add more parking to KLAS, the possibilities would be absolutely incredible.

  • Like 1
Link to comment
Share on other sites

A few more questions after tonight's scripting session:

 

1) How should RAT respond to combining SetTakeoff("air") and SetMinDistance(100)?

 

2) When using SetTakeoff("air") is there a way to force them to spawn at a particular altitude?

 

3) Is RespawnAfterLanding() necessary when setting ContinueJourney? Will aircraft respawn in the exact parking spot they were last in?

 

4) Is there a proper order to write the various commands? My order so far has been roughly in the same sequence of events that the aircraft would experience in flight.

 

5) Say I want to have some 737s spawn in the air, and have others spawn cold at airports. Can I just simply declare two different locals using the same 737 from mission editor? For example:

local B737_ground=RAT:New("RAT_737")

.

.

.

 

local B737_air=RAT:New("RAT_737")

.

.

.

 

I'm having such a a blast learning this stuff. Cheers!


Edited by RyboPops
Link to comment
Share on other sites

Again, great questions!

 

1) How should RAT respond to combining SetTakeoff("air") and SetMinDistance(100)?

2) When using SetTakeoff("air") is there a way to force them to spawn at a particular altitude?

First, SetTakeoff("air") is very much work in progress. I have already improved it a lot in my development version. For example the way the waypoints are set had to be changed. This is because there is no real "climb" part when you spawn in air.

 

1) The aircraft should spawn in air at a random point within the trigger zone and the destination airport should be at least 100 km away from that point.

2) The altitude at which the aircraft are spawned is set to be 70% of the "default" cruise altitude but then randomized by 30%. So at the moment, you cannot directly set it. But you can influence it via the SetFLcruise() function since they will spawn near that value. Would you prefer to set it directly?

 

3) Is RespawnAfterLanding() necessary when setting ContinueJourney? Will aircraft respawn in the exact parking spot they were last in?

No, ContinueJourney() does work without RespawnAfterLanding(). Without it a "clone" will be respawned after the original was despawned. But generally at a different parking position. I think there is no way to read out the parking position an aircraft gets when it has arrived. So no way to let the clone spawn at the same spot.

 

Initially, I introduced RespawnAfterLanding() because on NTTR there are many airports where bigger aircraft have no valid parking. The DCS solution if they land is to despawn them right after the landing event. Probably because that prevents the aircraft to hit static buildings on their way to the parking spaces or other things that could go wrong.

With RespawnAfterLanding() you can at least have another plane being spawned at these airports when the original gets despawned after the landing event. But then it would probably be spawned on the runway because it would also not have a parking position. And that might lead to trouble.

So to be safe, one should exclude airports where planes have no parking position.

 

4) Is there a proper order to write the various commands? My order so far has been roughly in the same sequence of events that the aircraft would experience in flight.

No, the order should not matter. The only very important restriction is that Spawn() has to be last. And Spawn() should only be used once per RAT object.

 

5) Say I want to have some 737s spawn in the air, and have others spawn cold at airports. Can I just simply declare two different locals using the same 737 from mission editor?

Yes, you can reuse the same template and give it different tasks and options. But you have to give each RAT object a unique alias.

local B737_ground=RAT:New("RAT_737", [b]"B737 Ground"[/b])
.
.
B737_ground:Spawn()
local B737_air=RAT:New("RAT_737",[b] "B737 Air"[/b])
.
.
B737_air:Spawn()

So the alias is simply a second argument in the New() constructor. It's important to set that if you reuse the same template. Otherwise things like the F10 menu get screwed up.

  • Like 1

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

Thanks for the detailed responses, they're very helpful.

 

Regarding the air start, yes I would love to be able to manually define the altitude for an aircraft to start. I'm hoping to eventually be able to generate several "sets" of traffic: airport to airport, air spawn to airport to air despawn (for the big heavies that only have the option of landing/departing at KLAS) and overhead transient traffic that is simply spawning in the air, and flying to a random trigger zone at cruise altitude and then despawning, creating the illusion of traffic cruising on the airways above NTTR. Hopefully that makes sense.


Edited by RyboPops
Link to comment
Share on other sites

Hey everyone, I made a small chart showing what airports can be used to spawn certain aircraft in actual parking spots.

 

QWFmYDy.png

 

Take note, however, that just because an airport CAN spawn a 747 in a parking spot doesn't mean it won't spawn on the runway. Smaller aircraft can still spawn in the few heavy spots which will lead to 747s spawning on the runway. I have found that this is mostly avoidable with some good planning and "city pairs." While the routes often aren't realistic, it gives a very vibrant and lifelike feel to the scenario.

  • Like 1
Link to comment
Share on other sites

I have a quick request if it's not already possible. It would be nice to have the ability to spawn a PAIR of AI, both using the same skin and flying the same flight plan. Obviously not useful for civilian traffic, but it would be great for randomly generating fighter traffic out of an AFB.

Link to comment
Share on other sites

Hey everyone, I made a small chart showing what airports can be used to spawn certain aircraft in actual parking spots.

Great stuff :thumbup: I will put this in the Tips 'n' Tricks section of the second post, if you don't mind?

 

Would it be possible to add the information on the total number of parking spots for planes and helos separately?

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

I have a quick request if it's not already possible. It would be nice to have the ability to spawn a PAIR of AI, both using the same skin and flying the same flight plan.

That's already possible :) You only have to add more planes to the template group in the mission editor.

 

Regarding the liveries, at the moment, each unit(!) of the group will get it's own random livery. So if you set more than one livery via RAT:Livery() you probably end up with different liveries for each unit.

 

I guess, I will change that in the code, because all units of a particular flights should all have the same skin.

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

Frank, definitely feel free to put the chart in the first post. It'll help more people there than it will buried in the thread :)

 

Regarding the number of spots, that was my original intent. However, with so much overlap in which airplanes/helos can use the spots I wasn't sure how to put all the info in a logical format in the table. I'll try to work something out.

 

That leads me to a question though...in the ME helos can be placed to ramp start in just about any parking spot that isn't covered. Does RAT somehow restrict helo spawns to runway and dedicated H parking spots?

Link to comment
Share on other sites

Frank, definitely feel free to put the chart in the first post. It'll help more people there than it will buried in the thread :)

Great, thanks :)

 

Regarding the number of spots, that was my original intent. However, with so much overlap in which airplanes/helos can use the spots I wasn't sure how to put all the info in a logical format in the table. I'll try to work something out.

Yeah, I know. Too many combinations if one would consider the aircraft type. But just differentiating planes and helos would be nice to have.

Like in the total column 7/8. First number for planes second for helos. When I read 15 spots in total at McCarran for example, it might be confusing because not all 15 can be used by planes, which I guess is what most people do.

 

That leads me to a question though...in the ME helos can be placed to ramp start in just about any parking spot that isn't covered. Does RAT somehow restrict helo spawns to runway and dedicated H parking spots?

No, the parking spot entries in the spawn template are set to "nil". So only the DCS logic automatically decides where the helos or any other aircraft is placed.


Edited by funkyfranky

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

But just differentiating planes and helos would be nice to have.

Like in the total column 7/8. First number for planes second for helos

 

I'll start on that as soon as I can. I tried to test something with a pair of aircraft in the template and it seems to have corrupted my mission file somehow :cry: I reverted back to a single aircraft but it still results in script errors on load and then no aircraft spawn...

Link to comment
Share on other sites

I'll start on that as soon as I can. I tried to test something with a pair of aircraft in the template and it seems to have corrupted my mission file somehow :cry: I reverted back to a single aircraft but it still results in script errors on load and then no aircraft spawn...

PM me the DCS logfile and I'll take a look. Maybe the whole mission as well.

A warrior's mission is to foster the success of others.

i9-12900K | MSI RTX 3080Ti Suprim X | 128 GB Ram 3200 MHz DDR-4 | MSI MPG Edge Z690 | Samung EVO 980 Pro SSD | Virpil Stick, Throttle and Collective | MFG Crosswind | HP Reverb G2

RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...