ED Forums

ED Forums (https://forums.eagle.ru/index.php)
-   Mission Editor Discussion and Questions (https://forums.eagle.ru/forumdisplay.php?f=210)
-   -   [MOOSE] RAT - Random Air Traffic (https://forums.eagle.ru/showthread.php?t=194247)

funkyfranky 10-03-2017 12:28 PM

[MOOSE] RAT - Random Air Traffic

Hi guys,

I have been working on a new implementation - simply named RAT - to generate random air traffic. This is something I was missing a lot in many of my missions :)

So what is RAT about?
RAT generates air traffic and fills the DCS sandbox with more life. Each aircraft will be spawned at a random airport of the map and gets a random route to another random destination. This creates a lot of dynamics and unpredictability to your missions with very little effort. Even the mission designer will not know what is going to happen.
When an aircraft has arrived at its destination it will be despawned and a new aircraft is spawned at another random departure airport and the game begins anew.

How much effort is it to use it?
One important aspect in the design of RAT was to keep it simple and easy to use even for people who are not so familiar with lua scripting but also very flexible at the same time. The most basic example needs two lines of simple lua code. But there are many options for fine tuning.

Which maps are supported?
All current DCS maps - Caucasus, NTTR and Normandy - are supported. Furthermore, the implementation of RAT is general, so that also all future maps such as SoH or whatever will come should be seamlessly usable as well.

Which airports are supported?
All airports of all maps. Again, the implementation is universal, so that there is no restriction regarding the airports. There are also several options to define which airports should or should not be used if this is desired.

What aircraft are supported?
There is no restriction regarding the aircraft type. You can use anything from civil aircraft over fighters and WWII birds to helicopters. Helos can also use FARPs and ships as airbases.
RAT works with templates. So you decide which aircraft will be included in the air traffic.

Will RAT interfere with the rest of my mission?
Only in the sense that your airspace gets more crowded. The main task of RAT planes is to fly from A to B. By default, they will not engage other units or even react to enemy threads if you don't ask them to.

What is the difference compared to other random air traffic scripts?
I'm aware of at least two other scripts that deal with random air traffic.
Firstly, there is a great script by SNAFU. However, in contrast to RAT it is rather specific and written to work only with airports on the Caucasus map.
Secondly, there is a very nice script by Zubetto. This script works with pre-defined routes the user has to create before the mission. So there is a bit more effort the user has to invest before the mission.

What about multiplayer?
RAT should work equally well in SP and MP.

Where is the catch?
The RAT implementation is kept general by supporting all maps, airports and aircraft types. This naturally leads to some problems. However, most of these can be handled by the user.

PROBLEM: The DCS AI logic sometimes causes aircraft to block each other on the taxi way. If that happens no aircraft is able to make its way to the runway or to its parking spot.
SOLUTION: If a RAT aircraft is on the ground and does not change its position for a certain time interval, it will be despawned automatically. By default the interval is set to 5 minutes. It has to be rather long (maybe even longer) because there are also many valid situations, where aircraft are waiting in a queue and don't need to be removed. The interval can be fine tuned by the TimeDestroyInactive option.

PROBLEM: If several aircraft arrive simultaneously at the same airport, the DCS ATC has often problems to manage the landing and/or take off queue. So it can happen that aircraft don't get landing clearance for a long time. This has been reported here.
SOLUTION: The RAT class has a build in rudimentary ATC queue. When RAT aircraft arrive simultaneously at the same aircraft, each one gets a holding point and the landing clearance is triggered for one aircraft after the other. This eases the workload for the DCS ATC but problems are still to be expected.

PROBLEM: Especially on the NTTR and Normandy map, there are quite a few smaller airports and airstrips. These can't be used by all aircraft especially bigger ones - the aircraft can land or takeoff but they don't have a parking space. This has two unpleasant consequences.
Firstly, if aircraft are spawned at these airports they are spawned in air on airports on the Caucasus map. On the NTTR and Normandy map however, aircraft are spawned on the runway and can even be spawned on top of each other - see here.
SOLUTION: The user can restrict the departure and destination airports for each aircraft type.
Secondly, if aircraft land at airports where they don't have a valid parking spot, they will be despawned directly after they land. This is a minor problem, but it causes that no new RAT aircraft is spawned since this is normally done after the aircraft has reached its parking position.
SOLUTION: RAT has an option so that aircraft can be respawned after the landing event with a certain delay. Check out the RespawnAfterLanding function.

Do you have an example?
There are several example missions available. These cover a lot of the basic RAT features and options. You can find them here. Most of the examples take place on the Caucasus map, but there are also some for NTTR and Normandy.

Is there a documentation?
You find the documentation here.

Are there YouTube tutorials?
YT videos about RAT can be found on the MOOSE channel but I will also link them here in another post. They provide the basic concepts and cover important examples what can be done with RAT. With time, I'll add more episodes showing RAT in action.

What do I need for RAT?
RAT is a class of the MOOSE framework. You can download the latest Moose.lua file which includes RAT here. Note that you need at least MOOSE version 2.2.0!
I will make step-by-step guide how to set up a mission employing RAT in separate post of this thread.

Last but not least, a big thanks to Sven aka FlightControl! Without his help this project would not have been possible.

I hope RAT helps to fill your DCS sandbox with nice toys :)

Change log:

funkyfranky 10-03-2017 12:28 PM

RAT Tutorials
1 Attachment(s)
Part 1: Introduction and Concepts

Part 2: Examples and Options

Step-by-step Setup Guide

Step 1:
First, you need to download the Moose.lua file from the MOOSE github page. This contains the RAT class. Here is also the direct link to the Moose.lua version 2.3.1.

Step 2:

Open the DCS mission editor and:
  • Add an aircraft of your choice. In this example I use a Yak-40 as template group.
  • Rename the group to "RAT_YAK".
  • Check the "LATE ACTIVATION" tick box.

Step 3:
  • Create a new text file and rename the extension to .lua. In the following I will refer to this as "RAT Script.lua"
  • Open the "RAT Script.lua" file with a text editor and insert the lines

    local yak=RAT:New("RAT_YAK")

    (If you are really lazy, you can also download the "RAT-001 - Basic.lua" file from the RAT example page: link.)

Step 4:

In the mission editor:
  • Add a new trigger: TYPE=ONCE, EVENT=MISSION START.
  • Add a new action for this trigger: ACTION=DO SCRIPT FILE.
  • Click on OPEN and load the "Moose.lua" file you downloaded in step 1.

Step 5:

Repeat similar steps as in Step 4 to include the "RAT Script.lua":
  • Add a second trigger: TYPE=ONCE, EVENT=MISSION START.
  • Add a new action for this trigger: ACTION=DO SCRIPT FILE.
  • Click on OPEN and load the "RAT Script.lua" file you created in step 3.

Step 6:

Start the mission and observe five Yak-40 being spawned at random airports.

Tips 'n' Tricks

Random Liveries
These are the available liveries of the Civil Aircraft Mod. Each spawned aircraft will get a random livery from the list.

local b737=RAT:New("RAT_B737")
local b747=RAT:New("RAT_B747")
local b757=RAT:New("RAT_B757")
local a380=RAT:New("RAT_A380")
local cessna=RAT:New("RAT_Cessna")

-- Liveries CAM v0.78
local b727skins={"AEROFLOT", "Air France", "Alaska", "Alitalia", "American Airlines", "Clean", "Delta Airlines", "Delta Airlines OLD", "Hapag Lloyd", "Lufthansa", "Lufthansa Oberhausen Old", "Northwest", "Pan Am", "Singapore Airlines", "Southwest", "UNITED", "UNITED Old", "ZERO G"}
local b737skins={"Air Algerie", "Air Berlin", "Air France", "airBaltic", "Airzena", "AM", "American_Airlines", "British Airways", "C40s", "Clean", "Disney", "EA", "easyjet", "FINNAIR", "HARIBO", "JA", "Jet2", "kulula", "LH", "Lufthansa BA", "Lufthansa KR", "OLD_BA", "OMAN AIR", "PAN AM", "Polskie Linie Lotnicze LOT", "QANTAS", "RYANAIR", "SouthWest Lone Star", "ThomsonFly", "TNT",  "Ukraine Airlines", "UPS"}
local b747skins={"AF", "AF-One", "AI", "CP", "IM", "KLM", "LH", "NW", "PA", "QA", "TA"}
local b757skins={"AA", "BA", "C-32", "Delta", "DHL", "easyJet", "Swiss", "Thomson"}
local a380skins={"Air France", "BA", "China Southern", "Clean", "Emirates", "KA", "LH", "LHF", "Qantas Airways", "QTR", "SA", "TA"}
local cessnaskins={"Blank", "D-EKVW", "HellenicAF", "Muster", "N9672H", "SEagle_blue", "SEagle_red", "USAF-Academy", "V5-BUG", "VH-JGA"}


Note that the livery names are not necessarily identical to the ones you see in the mission editor!

Radio Communication
If you don't want to get spammed by RAT group radio messages like "passing waypoint", you can simply disable the COMM tick box of the RAT template group in the ME.
Attachment 170846
In future, it will also be possible to enable/disable this setting via scripting.

Show Cases

McCarran Airport Cam (Inbound Traffic)

McCarran Airport High Frequency Outbound Traffic

Henderson Executive Activate Uncontrolled Aircraft

rogonaut 10-03-2017 12:34 PM

awesome stuff thank u, ill try this for sure!

=DECOY= 10-03-2017 12:36 PM

Wow this is great, cant wait to give this a try.

Thank you

grunf 10-03-2017 03:25 PM

Awesome! :thumbup:

EntropySG 10-03-2017 04:48 PM

Sweet congrats on the release!

Chicki 10-03-2017 05:19 PM

How do I setup multiple types of aircraft?

funkyfranky 10-03-2017 06:05 PM


Originally Posted by Chicki (Post 3258470)
How do I setup multiple types of aircraft?

Hey Chicki - good question :)

For each aircraft type you want to include, you need to add an own template group in the mission editor.

So if you want, for example, to add a C-130 additionally to a Yak-40, you have to add a new group of a C-130 in the mission editor, name it e.g. "RAT_C130" and set the "LATE ACTIVATION" tick box.

The lua code would look like this:

local yak=RAT:New("RAT_YAK")

local c130=RAT:New("RAT_C130")

This would spawn five Yak-40 and three C-130.

=DECOY= 10-03-2017 06:12 PM

We have added various random flights into our training map for QRA.

Thank you for this gem ;)

Sent from my SM-G950F using Tapatalk

Rudel_chw 10-03-2017 08:04 PM

I'm a newbie when it cames to LUA programming, but was trying the demo missions and it works really well, I can fully envision a more alive world into which to fly.

However, wanting to test how much of a load it made on the performance of my PC, I increased the amount of planes ... but only five are being spawn ... ┬┐is there a limit to the quantity of planes it can handle?

Anyway, fantastic job ... thanks a lot

All times are GMT. The time now is 11:39 AM.

Powered by vBulletin®.
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.