Jump to content

Random Aircraft, Flightpath, and More - all countries, all aircraft, all skins


Kolyma

Recommended Posts

Attached is a script to generate random AI air traffic. There's several similar scripts on this site, and I've PM'd SNAFU about posting my own idea, which started out being based on his Random Air Traffic script. This thread includes a much more diverse random script (really a completely original re-write). It's my first attempt at DCS/lua programming, but I'm pretty sure the script works well enough now to share.

 

RANDOM FLIGHT PLAN TRAFFIC

 

Basic idea:

-Based on airbase coalition assignment, spawn random aircraft group (some on this site have done this through trigger zones. For simplicity, I just used airbase coalition assignment)

-Aircraft type and relative distribution can be adjusted between Utility, Bomber, Attack, Fighter, Helicopter types (or just spawn one type of aircraft only)

-Random skins for each aircraft based on the skins available for that country

-Spawns random group sizes for aircraft types that support formations

-Random multi-unit formation types

-Random group and unit callsigns

-Take-off and landing airbases are randomized if there are more than one airbase assigned to the coalition (also an option to prevent take-off and landing from the same airbase)

-Take-off waypoint type is randomized (sometimes from parking spot, hot, on runway, or airborne)

-If the take-off waypoint is airborne, the AI group spawns in the air over the runway and flies down the runway until proceeding to next waypoint (kind of a touch-n-go idea)

-Generate randomized intermediate waypoint between take-off and landing airbases

-There's several boundary condition checks to remove AI spawned aircraft that are damaged, wayward out of range, never actually spawned by sim, or amazingly have negative altitudes, etc

-Write dynamic spawn and destroy messages to the screen and log file

 

Options:

(MANY options adjustable in script file, notable ones described here)

-Spawn interval high/low value (value gets recomputed after each spawn, so the actual random time between spawns is continuously randomized)

-Maximum number of aircraft spawned per coalition side

-By default, tries to maintain the same number of ac for each coalition side. This has several optional styles of spawn fairness.

-Randomize fuel amount and settings for high/low random fuel values

-Enable/disable flight tasks (attack/defend or just fly)

 

How to use this script:

-This script uses MIST. I have been using version 3.5.37

-In ME, set country assignment for each coalition. To not spawn aircraft for a particular country, assign that country to the neutral coalition in the ME.

-In ME, assign desired random spawn/land airbase(s) to each coalition. Of course not all airbases need to be assigned and not all coalitions need to be used---you can assign just one airbase to one coalition and the script will only spawn aircraft for that side

-As described elsewhere, make sure to initialize MIST.

-As described elsewhere, add this script as a "Do Script File" in the ME

 

Issues or future improvements:

-Sometimes when a group spawns, the simulator stops or glitches for a moment. I think this is because the programming assets are not loaded yet for that aircraft in the sim and this delays the dynamic spawn. Some of the other scripts on this site include in the ME a hidden template aircraft, which causes the sim to pre-load the asset and is probably why they don't have this glitching. If anyone has suggestions on how to solve this problem in my script, please offer them. Because I spawn any aircraft from any country with any skin, I don't think I can use the hidden template aircraft idea.

-Include randomized aircraft liveries (the weapons loadout). Without being able to directly read the DCS config files for each aircraft, this idea would become a huge cut-n-paste exercise that I'm not interested in doing. It may be possible to read external files from within a running *.lua file during execution; I'll have to try that later...

-Ability to disable a particular aircraft type. Right now, this requires commenting line-by-line in the giant inventory matrix.

-Someone somewhere must have a fix for the runways and taxiways that become unusable from damaged aircraft!!! Given enough time, this script makes a real mess of airbase runways and taxiways. However, this script will occasionally spawn ac in the air over an airbase. New ac will continue to spawn when an airbase becomes unusable.

 

 

Included below are the script and 2 example missions. The first mission "bigmap" has all the airbases assigned and all countries enabled. The 2nd is called "maelstrom" and uses the 2 airbases at Krasnodar with some invincible AA ground units :)

 

I hope you enjoy! This was a lot of fun and more than a little work to put together.

Random_Flight_Plan_Traffic.lua

bigmap.miz

malestrom.miz


Edited by Kolyma
  • Like 3
Link to comment
Share on other sites

Interesting, thanks for posting this and for the work you put in to it. A couple of questions:

 

1. Are the spawned AI aircraft armed?

2. If used in a mission, will the AI aircraft interact with one another, e.g. attack ground targets, shoot each other down etc?

System Spec: Cooler Master Cosmos C700P Black Edition case. | AMD 5950X CPU | MSI RTX-3090 GPU | 32GB HyperX Predator PC4000 RAM | | TM Warthog stick & throttle | TrackIR 5 | Samsung 980 Pro NVMe 4 SSD 1TB (boot) | Samsung 870 QVO SSD 4TB (games) | Windows 10 Pro 64-bit.

 

Personal wish list: DCS: Su-27SM & DCS: Avro Vulcan.

Link to comment
Share on other sites

Interesting, thanks for posting this and for the work you put in to it. A couple of questions:

 

1. Are the spawned AI aircraft armed?

2. If used in a mission, will the AI aircraft interact with one another, e.g. attack ground targets, shoot each other down etc?

By default the AI aircraft are armed. There is an option in the script to spawn them without weapons if you like.

g_flagRandomWeapons

And each aircraft has tasks assigned appropriate for their role. Again, there's an option in the script to spawn them without tasks.

g_flagSetTasks

 

So yes, by default they spawn with weapons and if close enough will definitely interact! I also use the DCS witchcraft software and console to change some of these flags during a running mission since they're global variables...

Link to comment
Share on other sites

By default the AI aircraft are armed. There is an option in the script to spawn them without weapons if you like.
g_flagRandomWeapons

And each aircraft has tasks assigned appropriate for their role. Again, there's an option in the script to spawn them without tasks.

g_flagSetTasks

 

So yes, by default they spawn with weapons and if close enough will definitely interact! I also use the DCS witchcraft software and console to change some of these flags during a running mission since they're global variables...

 

Interesting, thanks. This could be a very nice automated way to create a large-scale engagement in which the players have a small part. Nice!

System Spec: Cooler Master Cosmos C700P Black Edition case. | AMD 5950X CPU | MSI RTX-3090 GPU | 32GB HyperX Predator PC4000 RAM | | TM Warthog stick & throttle | TrackIR 5 | Samsung 980 Pro NVMe 4 SSD 1TB (boot) | Samsung 870 QVO SSD 4TB (games) | Windows 10 Pro 64-bit.

 

Personal wish list: DCS: Su-27SM & DCS: Avro Vulcan.

Link to comment
Share on other sites

Yeah we use the script now for kind of target practice with respawing aircraft in random areas of the map. Looks pretty cool while in your own ac during takeoff and landing with all the extra traffic. Especially groups of different ac types and numbers....and formations. I found all kinds of nice skins in the game I didn't realize were there


Edited by Kolyma
Link to comment
Share on other sites

This looks very cool indeed! Though I do have a dumb newbie question here. When you say to edit the coalition assignment to not spawn aircraft for a particular country, assign that country to the neutral coalition in the ME. How exactly do I do this in the ME? I see under the Briefing what countries are assigned to what coalition but where can I change this? I've looked around, and even tried to edit the briefing where the countries are listed but no go. Please point this clueless mission builder wannabe in the right direction. Thanks for your work and for any info someone can provide to help me.

Justificus

 

System Specs:

i7 4970K @ 4.8, GTX 1080 SC, 32GB G.Skill DDR 2133,Thermaltake Level 10 Full Tower Case, Noctua NH-D15 6 Cooler, Win 10 Pro, Warthog, CH Pro Pedals, CH Throttle Quadrant, Oculus, 1 32" & 2 19" Monitors

 

 

 

Modules Owned: A-10C I+II, Ka-50, FC3, F-86, Mig-15, Mig21, UH-1H, Mi-8, CA, P-51D, BF-109K-4, FW-190 D-9, Hawk, NTTR, M-2000C, SA342, F-5E, Spit Mk. IX, AJS-37, Normandy, WWII A.P., AV-8B, F/A-18C, L-39, Persian Gulf, Mig-19P, I-16, Super Carrier, F-16, Channel, Syria

Link to comment
Share on other sites

When you create a new mission you can choose the countries assigned to each coalition. Once the mission is created, you can't change the country assignments through the Mission Editor. But you can change the country assignments through editing the mission *.miz file.

 

For me, this requires:

1) renaming the *.miz file to *.zip

2) extracting the mission file

3) renaming it to *.lua

4) opening in Notepadd++

5) editing to move the countries around to the desired coalition assignment

6) rename back to mission

7) put back in *.zip file

8 ) rename to *.miz

 

Key to editing the mission file is to change country coalition assignments in 2 sections. The mission file describes country coalition assignments in 2 different areas. Both must be set to the same assignments for the change to work.

 

There is probably an easier way to modify an existing *.miz file than my procedure and I know changing country coalition assignment after creating a mission is described elsewhere on this site.

 

Really, you can drop this script into any existing mission you have and it'll go to work.

 

Important parts to change in my script are:

g_aircraftDistribution

Which controls the types of planes. It expects a relative distribution number across each part. So to make the script just spawn Utility aircraft (transport, refueling, reconnaissance), set it to

g_aircraftDistribution= (100, 0, 0, 0, 0)

 

To favor fighter aircraft, try something like this:

g_aircraftDistribution= (5, 5, 5, 80, 5)

 

And the other important parameter is

g_maxCoalitionAircraft

Which defines how many total planes the script is allowed to keep spawned. When an ac lands or is destroyed, the count decreases and a new ac is spawned. Note the max limit does not include your own ac placed manually in your ME designed mission. As we all know, too many active ac in a running mission lowers frame rate. You'll have to modify this value to be compatible with the manually placed ac in your mission and your PC system capabilities.

 

There's also some intricate logic to handle groups of planes when only a single ac lands or is destroyed. The script also keeps room below the max limit for a full group to possibly spawn. So if

g_maxGroupSize = 4

and

g_maxCoalitionAircraft = {40, 40}

When the current amount of spawned aircraft contained in the variable

g_numCoalitionAircraft

is between 37-40, no more ac will be spawned, even if the script were to randomly pick a single ac or a group size of 3....Without this, the script "ratcheted up" to 40 and eventally only spawned single ac groups because there was never more than 1 free slot under max.


Edited by Kolyma
Link to comment
Share on other sites

Kolyma, thanks for your prompt reply! Wow, I didn't realize it was so hard to just change what countries belong to what coalition after mission creation... what a PITA that is to do. The reason why I wanted to do this was because I only wanted two countries in this mission and I love the idea of your script (I actually used another mission based on the original script you based yours on!) in my mission I'm trying to create while learning my way around the ME, well, at least I'm trying to learn my way... I guess I'll just leave things as they are.

 

I did try to search for how to edit a mission already created but didn't find anything useful. I guess it was my lame choice of words? Thanks again.

Justificus

 

System Specs:

i7 4970K @ 4.8, GTX 1080 SC, 32GB G.Skill DDR 2133,Thermaltake Level 10 Full Tower Case, Noctua NH-D15 6 Cooler, Win 10 Pro, Warthog, CH Pro Pedals, CH Throttle Quadrant, Oculus, 1 32" & 2 19" Monitors

 

 

 

Modules Owned: A-10C I+II, Ka-50, FC3, F-86, Mig-15, Mig21, UH-1H, Mi-8, CA, P-51D, BF-109K-4, FW-190 D-9, Hawk, NTTR, M-2000C, SA342, F-5E, Spit Mk. IX, AJS-37, Normandy, WWII A.P., AV-8B, F/A-18C, L-39, Persian Gulf, Mig-19P, I-16, Super Carrier, F-16, Channel, Syria

Link to comment
Share on other sites

Kolyma, I also just noticed that you are using MIST version 3.5.37 but I can't find that version (only 3.3 is listed in the MIST thread) to out into my mission. Where can I get that one? Thanks!

 

Never mind. I just found the latest version buried within the thread. I'm assuming that it will be okay to run a later version than the one you used as it shouhld still have everything you needed/used when you made your own LUA file.


Edited by Justificus
Found File Close to It

Justificus

 

System Specs:

i7 4970K @ 4.8, GTX 1080 SC, 32GB G.Skill DDR 2133,Thermaltake Level 10 Full Tower Case, Noctua NH-D15 6 Cooler, Win 10 Pro, Warthog, CH Pro Pedals, CH Throttle Quadrant, Oculus, 1 32" & 2 19" Monitors

 

 

 

Modules Owned: A-10C I+II, Ka-50, FC3, F-86, Mig-15, Mig21, UH-1H, Mi-8, CA, P-51D, BF-109K-4, FW-190 D-9, Hawk, NTTR, M-2000C, SA342, F-5E, Spit Mk. IX, AJS-37, Normandy, WWII A.P., AV-8B, F/A-18C, L-39, Persian Gulf, Mig-19P, I-16, Super Carrier, F-16, Channel, Syria

Link to comment
Share on other sites

I'm not sure where I originally got it, but the 3.5.37 is inside my *.miz files.

 

Here's some links where they appear to discuss newer versions than those in the MIST forum sticky. Also, I've attached the version I'm using. Not sure how the script behaves with other MIST versions. Guess I should check that :)

 

http://forums.eagle.ru/showpost.php?p=2164366&postcount=724

https://github.com/mrSkortch/MissionScriptingTools/releases

mist.3.5.37.lua

  • Like 1
Link to comment
Share on other sites

Thank you sir!

Justificus

 

System Specs:

i7 4970K @ 4.8, GTX 1080 SC, 32GB G.Skill DDR 2133,Thermaltake Level 10 Full Tower Case, Noctua NH-D15 6 Cooler, Win 10 Pro, Warthog, CH Pro Pedals, CH Throttle Quadrant, Oculus, 1 32" & 2 19" Monitors

 

 

 

Modules Owned: A-10C I+II, Ka-50, FC3, F-86, Mig-15, Mig21, UH-1H, Mi-8, CA, P-51D, BF-109K-4, FW-190 D-9, Hawk, NTTR, M-2000C, SA342, F-5E, Spit Mk. IX, AJS-37, Normandy, WWII A.P., AV-8B, F/A-18C, L-39, Persian Gulf, Mig-19P, I-16, Super Carrier, F-16, Channel, Syria

Link to comment
Share on other sites

  • 2 years later...
  • 5 months later...

Any way to make this work in 2.5.2?

i7-7700K, 32GB DDR4, 525GB SSD, 1TB HDD, GTX 1080Ti 11GB, Liquid Cooling, Win 10, Warthog HOTAS, TPR Pedals, HP Reverb, Oculus Rift with Touch, Jetseat and bass shakers, PointCTRL, and Scale F-14B Cockpit

Link to comment
Share on other sites

Any way to make this work in 2.5.2?

I had it working a few months back with the last version of 1.5. I've been looking to move the features over to Moose, which shouldn't be too hard; just need to extend the low-level unit creation functionality. I haven't had the time lately. Moose currently only supports static hidden template unit definitions, not full on dynamic creation of units with dynamic liveries, skins, and such. My original script gave you everything like that and was a blast to watch run out for a few hours. I left my 3 giant screens up like a fishtank in my office during the day while DCS raged against itself and I worked on other stuff.

Link to comment
Share on other sites

To a large extent this already exist in Moose as RAT - Random Air Traffic

 

Yeah the operational part with flight plans and persistent respawning is in moose rat, but last I checked, they only support a predefined library of user-created template units in the ME that are hidden and then cloned to spawn.

 

I was spawning completely non existent units that were completely random configurations.

 

In math terms, in order to get the same diversity of units you would have to define an unreasonable number of templates to get a similar variety. Like 100,000+ templates.

 

I explained this a while back to flightcontrol but he got stuck on a repetitive "doesn't make sense* chorus. LOL, I gave up trying to explain and just tabled the idea for now.

 

The difficult part is building a dynamic array of the available DCS aircraft, liveries, and skins from the filesystem and then feed iit into a random generator. From what I found, there was no way to access the DCS builtin library of this databases from a script running in the LUA scripting engine, so something must be built.

 

In my clunky original script, I just cut N pasted from DCS source Lua files the relevant areas of each aircraft and poured them into my script.

 

Still the effect was pretty cool. I even had the way points for start and end of runway so when the stupid runways got clogged, planes would soawn at one end of the runway and fly to the end before going off to their first real way point.

 

I'd just put it on fishtank mode on a view of a particular airbase and my cat would sit there swatting at the meyhem

Link to comment
Share on other sites

Yeah, I understand your additional requirements. Was just thinking this could be built on top of RAT rather than re-inventing the wheel. The only additional part is the dynamic generation without using ME templates.

 

You should see what funkyfranky has to say about this as he is the actual author of RAT. Although RAT I'm sure uses the underlying Moose spawning function which currently is dependant on ME templates so it might not be that easy to incorporate.

 

Yeah the operational part with flight plans and persistent respawning is in moose rat, but last I checked, they only support a predefined library of user-created template units in the ME that are hidden and then cloned to spawn.

 

I was spawning completely non existent units that were completely random configurations.

 

In math terms, in order to get the same diversity of units you would have to define an unreasonable number of templates to get a similar variety. Like 100,000+ templates.

 

I explained this a while back to flightcontrol but he got stuck on a repetitive "doesn't make sense* chorus. LOL, I gave up trying to explain and just tabled the idea for now.

 

The difficult part is building a dynamic array of the available DCS aircraft, liveries, and skins from the filesystem and then feed iit into a random generator. From what I found, there was no way to access the DCS builtin library of this databases from a script running in the LUA scripting engine, so something must be built.

 

In my clunky original script, I just cut N pasted from DCS source Lua files the relevant areas of each aircraft and poured them into my script.

 

Still the effect was pretty cool. I even had the way points for start and end of runway so when the stupid runways got clogged, planes would soawn at one end of the runway and fly to the end before going off to their first real way point.

 

I'd just put it on fishtank mode on a view of a particular airbase and my cat would sit there swatting at the meyhem

Link to comment
Share on other sites

It's easy, you can tinker with the RAT code, but fundamentally, although you are right about SPAWN not having liveries, RAT does randomly assign them (if you want) so 21 random liveries for just a Boeing 727 as one of the 6 CAM plane types, to randomly start in any amount of randomly assigned zones or randomly dictated airfields to go somewhere equally random. That's incalculable randomness.... but you can tune/restrict if you look through the code.

 

 

So for 6 templateson the ME, you get way more than 100,000, I couldnt calculate the amount of pixels in a map or the subsequent route.

 

 

 

I get that your code worked fine and you were happy and understood it best, that makes absolute sense to me, but I thought your objections were unfounded so I provided a sample to show, which Franky wrote.

 

 

 

 

 

Yeah the operational part with flight plans and persistent respawning is in moose rat, but last I checked, they only support a predefined library of user-created template units in the ME that are hidden and then cloned to spawn.

 

I was spawning completely non existent units that were completely random configurations.

 

In math terms, in order to get the same diversity of units you would have to define an unreasonable number of templates to get a similar variety. Like 100,000+ templates.

 

I explained this a while back to flightcontrol but he got stuck on a repetitive "doesn't make sense* chorus. LOL, I gave up trying to explain and just tabled the idea for now.

 

The difficult part is building a dynamic array of the available DCS aircraft, liveries, and skins from the filesystem and then feed iit into a random generator. From what I found, there was no way to access the DCS builtin library of this databases from a script running in the LUA scripting engine, so something must be built.

 

In my clunky original script, I just cut N pasted from DCS source Lua files the relevant areas of each aircraft and poured them into my script.

 

Still the effect was pretty cool. I even had the way points for start and end of runway so when the stupid runways got clogged, planes would soawn at one end of the runway and fly to the end before going off to their first real way point.

 

I'd just put it on fishtank mode on a view of a particular airbase and my cat would sit there swatting at the meyhem

2.thumb.png.33783ed32da5db79e0cf34ad536dd0d3.png

1.thumb.png.6ec2f41e0045a15a36441adf9a842495.png

3.thumb.png.b0fbd1a068c9088e01e7c722bbe85335.png

RAT_Civil.miz

___________________________________________________________________________

SIMPLE SCENERY SAVING * SIMPLE GROUP SAVING * SIMPLE STATIC SAVING *

Link to comment
Share on other sites

 

I'd just put it on fishtank mode on a view of a particular airbase and my cat would sit there swatting at the meyhem

 

:megalol::megalol::megalol::megalol::megalol::thumbup::thumbup:

i7-7700K, 32GB DDR4, 525GB SSD, 1TB HDD, GTX 1080Ti 11GB, Liquid Cooling, Win 10, Warthog HOTAS, TPR Pedals, HP Reverb, Oculus Rift with Touch, Jetseat and bass shakers, PointCTRL, and Scale F-14B Cockpit

Link to comment
Share on other sites

  • Recently Browsing   0 members

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