funkyfranky Posted October 3, 2017 Posted October 3, 2017 (edited) 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 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: RAT v2.0 ( 10-29-2017 ) RAT v2.1 ( 02-12-2018 ) RAT v2.2 ( 05-10-2018 ) Edited March 26, 2019 by funkyfranky Updated links 1 3 A warrior's mission is to foster the success of others. i9-12900K | RTX 4090 | 128 GB Ram 3200 MHz DDR-4 | Quest 3 RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss
funkyfranky Posted October 3, 2017 Author Posted October 3, 2017 (edited) RAT Tutorials 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") yak:Spawn(5) (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"} b737:Livery(b737skins) b747:Livery(b747skins) b757:Livery(b757skins) a380:Livery(a380skins) chessna:Livery(cessnaskins) 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. 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 Edited May 25, 2018 by funkyfranky Updated links 1 A warrior's mission is to foster the success of others. i9-12900K | RTX 4090 | 128 GB Ram 3200 MHz DDR-4 | Quest 3 RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss
rogonaut Posted October 3, 2017 Posted October 3, 2017 awesome stuff thank u, ill try this for sure! 1
=DECOY= Posted October 3, 2017 Posted October 3, 2017 Wow this is great, cant wait to give this a try. Thank you 1 Water cooled i9-9900K | Maximus Code XI MB | RTX3090 | 64GB | HP Reverb G2
EntropySG Posted October 3, 2017 Posted October 3, 2017 Sweet congrats on the release! 1 [sIGPIC][/sIGPIC]
funkyfranky Posted October 3, 2017 Author Posted October 3, 2017 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") yak:Spawn(5) local c130=RAT:New("RAT_C130") c130:Spawn(3) This would spawn five Yak-40 and three C-130. A warrior's mission is to foster the success of others. i9-12900K | RTX 4090 | 128 GB Ram 3200 MHz DDR-4 | Quest 3 RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss
=DECOY= Posted October 3, 2017 Posted October 3, 2017 We have added various random flights into our training map for QRA. Thank you for this gem ;) Sent from my SM-G950F using Tapatalk Water cooled i9-9900K | Maximus Code XI MB | RTX3090 | 64GB | HP Reverb G2
Rudel_chw Posted October 3, 2017 Posted October 3, 2017 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 For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra For Gaming: 34" Monitor - Ryzen 3600 - 32 GB DDR4 2400 - nVidia RTX2080 - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar Mobile: iPad Pro 12.9" of 256 GB
=DECOY= Posted October 3, 2017 Posted October 3, 2017 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 we have 28 in ours at the moment to test it, so far so good Water cooled i9-9900K | Maximus Code XI MB | RTX3090 | 64GB | HP Reverb G2
funkyfranky Posted October 3, 2017 Author Posted October 3, 2017 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. Thanks Rudel, glad you like it. 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? No, there is no principal limit in the number of planes that can be spawned. You can set yak:Spawn(500) to spawn 500 planes. But it will bring your PC to its knees ;) You are absolutely right to carefully test how much your hardware can handle. But if you make changes to the mission script by, e.g., changing the number of planes to be spawned, always make sure to reload the script in the trigger section of the mission editor. If you don't reload it, the changes will not be included in the mission! I reckon this is the issue why you always see the same number of planes spawning. A warrior's mission is to foster the success of others. i9-12900K | RTX 4090 | 128 GB Ram 3200 MHz DDR-4 | Quest 3 RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss
Rudel_chw Posted October 3, 2017 Posted October 3, 2017 (edited) But if you make changes to the mission script by, e.g., changing the number of planes to be spawned, always make sure to reload the script in the trigger section of the mission editor. If you don't reload it, the changes will not be included in the mission! I reckon this is the issue why you always see the same number of planes spawning. You were absolutely right ... I reloaded the script and now it works perfect ... I even got multiple planes on the same airport and saw that they dont clash wit one another :) I will have so much fun with this ... editing all of my missions to add this background traffic :D Thanks a lot for sharing this ... best regards. PS: I never had looked in detail to the Yak-40 previously ... it's amazing how the model includes interior seats :) Edited October 3, 2017 by Rudel_chw 1 For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra For Gaming: 34" Monitor - Ryzen 3600 - 32 GB DDR4 2400 - nVidia RTX2080 - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar Mobile: iPad Pro 12.9" of 256 GB
AV_Partizan Posted October 4, 2017 Posted October 4, 2017 (edited) Hi funkyfranky, thanks for this very nice script. Would it be possible to assign areas to coalitions? - blue plane spawning and flying only over georgia. - red planes spawning and flying only over russia. I wonder how to script this? Assign coalitions to all airports in ME, then tell a group to randomly take off +land on red only. EDIT : maybe I should fin the answer in your test missions > RAT-005, will try it. Edited October 4, 2017 by AV_Partizan
funkyfranky Posted October 4, 2017 Author Posted October 4, 2017 Hi funkyfranky, thanks for this very nice script. Would it be possible to assign areas to coalitions? - blue plane spawning and flying only over georgia. - red planes spawning and flying only over russia. I wonder how to script this? Assign coalitions to all airports in ME, then tell a group to randomly take off +land on red only. EDIT : maybe I should fin the answer in your test missions > RAT-005, will try it. Hi Partizan, it works basically as you describe it. You can define the Georgian airports as blue and the Russian airports as red in the ME. If you have a blue and a red template group you can use SetCoalition("sameonly") to make them use only airports of their own coalition. And yes, I think test mission 5 gives a good example :) You can also restrict the departures and destinations explicitly by using something like russiantemplate:SetDeparture({"Russian Airport A", "Russian Airport B", ...}) russiantemplate:SetDestination({"Russian Airport A", "Russian Airport B", ...}) georgiantemplate:SetDeparture({"Georgian Airport A", "Georgian Airport B", ...}) georgiantemplate:SetDestination({"Georgian Airport A", "Georgian Airport B", ...}) It's a bit more typing but then you would not have to set the coalitions of the airports in the ME. A warrior's mission is to foster the success of others. i9-12900K | RTX 4090 | 128 GB Ram 3200 MHz DDR-4 | Quest 3 RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss
toma19 Posted October 4, 2017 Posted October 4, 2017 Thank you funkyfranky, exactly what I was after! 1
Stonehouse Posted October 6, 2017 Posted October 6, 2017 (edited) Very nice module which will be really useful to a lot of people. Thanks for adding it to Moose. Just a passing thought, wouldn't it be better practice to do a single mission start trigger with two actions; the first to load moose and the second to load the random airtraffic script? I realise the end result is the same but a once trigger fires after the mission starts while as I understand things the mission start trigger fires at the start before anything else happens internally from a DCS point of view. So players won't notice any impact from the script running for instance because it happens before they get to see the cockpit I believe. For some reason people don't use mission start triggers for mist and moose type stuff and I've never understood why. Edited October 6, 2017 by Stonehouse typo 1
FlightControl Posted October 6, 2017 Posted October 6, 2017 Wouldn't it be better practice to do a single mission start trigger with two actions; the first to load moose and the second to load the random airtraffic script? For some reason people don't use mission start triggers for mist and moose type stuff and I've never understood why. Indeed. Look at (most) the examples of the MOOSE demo mission and it uses a mission start trigger to load moose and a mission start trigger to load the mission. But indeed, one can opt to make one mission start trigger with two actions. The result is the same. What is not okay, is to have a "run only once" trigger being used. That is incorrect, because there is a slight delay in that trigger, which may give problems. Thanks for sharing these best practices Stonehouse. 1 [TABLE][sIGPIC][/sIGPIC]| Join MOOSE community on: DISCORD :thumbup: Website of the MOOSE LUA Framework. MOOSE framework Downloads. Check out Example Missions to try out and learn. MOOSE YouTube Channel for live demonstrations and tutorials. [/TABLE]
gunterlund21 Posted October 7, 2017 Posted October 7, 2017 works very nicely. Would be nice to take off and land a same airport. ie carrier operations I was in Art of the Kill D#@ it!!!!
Chicki Posted October 12, 2017 Posted October 12, 2017 Oh man. This thing is great. Hey guys, what Russian ships can Russian helos land on? I keep getting errors for anything but the Kuz. Thanks.
Ignition Posted October 15, 2017 Posted October 15, 2017 Im using RAT and is very easy to use and fast to set up. Awesome.
Looney Posted October 17, 2017 Posted October 17, 2017 Would it be possible to randomly select from a number of different aircrafts before spawning? That would be great to randomize type and traffic using this: https://forums.eagle.ru/showpost.php?p=3268436&postcount=89 [sIGPIC][/sIGPIC] Commodore 64 | MOS6510 | VIC-II | SID6581 | DD 1541 | KCS Power Cartridge | 64Kb | 32Kb external | Arcade Turbo
funkyfranky Posted October 17, 2017 Author Posted October 17, 2017 Would it be possible to randomly select from a number of different aircrafts before spawning? That would be great to randomize type and traffic using this: https://forums.eagle.ru/showpost.php?p=3268436&postcount=89 Ah, the Mod is out. Great :D Regarding the spawning of random groups. It's not possible out-of-the-box. But you can script that. Just to check that I understood you correctly. You want to spawn let's say 10 aircraft and it should be a random number of type X, a random number of type Y and a random number of type Z which add up to 10? If so this would be the pseudo code: b737=RAT:New("B_737") b747=RAT:New("B_747") b757=RAT:New("B_757") --math.randomseed(os.time()) local nX=math.random(1, 8) --spawn at least one and at most eight (leaving two for the other types) local nY=math.random(1, 9-nX) --spawn at least one but at most eight (leaving at least one for the last type) local nZ=10-nX-nY --spawn what is left but at least 1. b737:Spawn(nX) b747:Spawn(nY) b757:Spawn(nZ) Or maybe this is more what you had in mind: RATobjects={b737, b747, b757} randomRAT=RATobjects[math.random(#RATobjects)] randomRAT:Spawn() There are many other ways to do this or something similar. But they all involve a little lua scripting. A warrior's mission is to foster the success of others. i9-12900K | RTX 4090 | 128 GB Ram 3200 MHz DDR-4 | Quest 3 RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss
funkyfranky Posted October 17, 2017 Author Posted October 17, 2017 (edited) Btw, I have added a tips 'n' tricks section at the end of the second post how you can choose randomly from the CAM liveries. Hope I got all names right :) Also, the only airports on the NTTR map, where 747, 757 and A380 have valid parking spots are Tonopah Test Range Airfield, Nellis AFB, McCarran International and Laughlin. A 737 has also parking space at Groom Lake AFB and Henderson Executive. On all other airports the planes will get spawned on the runway (and might block it) and will get despawned right after the landing event. Edited October 17, 2017 by funkyfranky A warrior's mission is to foster the success of others. i9-12900K | RTX 4090 | 128 GB Ram 3200 MHz DDR-4 | Quest 3 RAT - On the Range - Rescue Helo - Recovery Tanker - Warehouse - Airboss
Gary Posted October 18, 2017 Posted October 18, 2017 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 I5 - 1TB SSHD, 256 SSD - Nvidia 1070 - 16gb ram - CV1
Recommended Posts