Jump to content

StopGaps - Script to fill empty player slots with planes


cfrag

Recommended Posts

StopGaps V.1.1.1 - 20240318 (now filters 'from runway' clients)

We all know the feeling: design a really nice mission with many player aircraft options, only to have the air base look like a desert diner: mostly empty. 

A few years ago, @Hardcard created a fantastic script to do away with the emptiness (and, admittedly, mission performance): SWAPR. I've used SWAPR and love the idea.

image.png

So it is with great humility and a deep bow to Hardcard that I present 'StopGaps': It's a light-weight re-imagination of Hardcard's idea that replaces all player planes with their static equivalents until a player jumps into them. After players leave their plane, it is returned to the parking position.

StopGap is small, and does not require any configuration or naming scheme: all player planes are automatically supported, including their liveries. Like anything DCS, there are a couple of rules or recommendations to observe

DOWNLOAD
(please click here) - ED User Files

 

RULES & RECOMMENDATIONS

  • StopGaps works best with single-unit player groups, although player groups with more than one aircraft (be they AI or player) are supported
  • ALWAYS use 'From Ground Hot/Cold' for player aircraft. Using "From Ramp" or "From Parking" does not provide stopGap with enough information to work well. Remember to NOT place "From Ground" starting aircraft inside bunkers that can close their doors. A bug in DCS will not open the doors when a player enters the aircraft.
  • Carrier/Assault ship slots are not supported

StopGaps fully supports Multiplayer [Note: requires a tiny 'stopGapGUI' script installed only on the server, see 'Known Issues', below]

 

ADDITIONAL FEATURES
StopGap automatically integrates with SSB (Simple Slot Block) if that is installed: a blocked slot will not show a static aircraft. This allows you to create conquerable airfields with automatically blocked slots where only the correct faction's aircraft appear (see DML or SSBClient for a drop-in script for that). 

You can selectively exclude player units from stopGap by

  • appending "-sg" to the unit's or group's name. Example: "Vandal -sg", blank is not required. This group is not stopGapped in single- and multi-player
  • appending "-sp" to the unit's or group's name. Example "Axe-sp". This group isn't stopGapped in single-player, but will be stop-gapped in multiplayer. This is useful for maps where in single-player, aircraft (usually placed outside of airfields) fall to the ground, but works well in multiplayer, where the superior server-based synching through stopGapGUI resolves this DCS bug (this happened a lot in my "Sinai Tourist" map, and this new option comes in handy). Since stopGapGUI is only available in MP, you can opt to exclude stopGap only when the mission runs in single-player. Requires stopGapGUI 1.0.1 or above.
  • should you want a "stopGapped" mission to run on a server long-term and dial up the eye cany even further, you can change line 9 in the script stopGap.refreshInterval = -1 to a positive value like "3600". That will refresh all stand-in statics every 3600 seconds (= 1 hour) to remove accumulated destruction amongst the static replacements. By default, this is disabled (refreshInterval is set to a value smaller than 1).

[Please note: the DML version of stopGap provides more elegant trigger zones to designate -sp and -sg aereas so you do not have to mess around with ungainly naming schemes, and of course allows for much better configuration handling from within Mission Editor.]
 

"SITTING DUCKS" COMPANION MODULE
The sittingDucks script extends stopGap's abilities to automatically block a player slot if the stand-in static was destroyed. This allows for scenarios where players must defend their airfield to keep access to player planes, and where it can be strategically advantageous to attack enemy airfields to deny those players access their most important aircraft.

 

KNOWN ISSUES

  • (Only Multiplayer): to resolve a server/client synchronization issue, the server must run the 'stopGapGUI' script. You know that you need the server script if your freshly spawned aircraft is broken or falls from some height upon spawning in Multiplayer.

 

INSTRUCTIONS

  1. Copy / paste the "StopGap" script to a DOSCRIPT ACTION at MISSION START
  2. (For Multiplayer, install the "StopGapGUI" script (only on server) in the "Hooks" directory) and re-start DCS
  3. You are done.

Enclosed is the "Caucasus Hangar" demo mission that puts (I hope) all currently playable DCS modules on display at Kobuleti. If you own it, you can enter it. If you don't own it, you can at least ogle at it.

image.png

 

Mission (please see below)

Note:
A more capable version of StopGap is part of DML. This is the stand-alone version.

 

Enjoy,

-ch

 

 

Caucasus Hangar StopGap.miz


Edited by cfrag
  • Like 4
  • Thanks 8
Link to comment
Share on other sites

 @cfrag your an absolute Hero. Just tested your script, it works like a charm and I've been looking for this for so long. Only issue is for spawn cold from ramp/airfield parking spot, the orientation of the statics is wrong, and the client spawns in the next adjacient free spot which is not a huge deal, as from ground hot and cold work fantastically so no need). 

I tested in SP and on my Dedicated Server, it works amazing. 

The only thing is, for mods, I was able to get it to work on my machine but the replacement statics dont show up on my Dedicated Server. I copied my aircraft mods to the servers Saved Games/DCS/mods/aircraft folder and the mods work for the client (my machine) but did not work for the statics. 

WHat am I missing here?

 

What am I doing wrScreen_230520_122638.jpgScreen_230520_121433.jpgong there or missing?

 

 

  • Like 1
Link to comment
Share on other sites

Just now, Adalla said:

Only issue is for spawn cold from ramp/airfield parking spot, the orientation of the statics is wrong, and the client spawns in the next adjacient free spot

That is an issue with the way DCS allocates planes and stores them in a mission. If you choose 'from ramp' or 'parking' there is no heading information. Worse, DCS may suddenly decide to change the slot just out of spite. 

If you use "from ground" that should not happen.

Just now, Adalla said:

The only thing is, for mods, I was able to get it to work on my machine but the replacement statics dont show up on my Dedicated Server

Ah, yes. Non-official aircraft support may require server installation - that is unfortunately outside my bailiwick.

  • Like 1
Link to comment
Share on other sites

Yeah I'm new to dedicated server hosting, so I'll what I'll need to do to get the statics of mods to work. 

But so far absolutely amazed that such a simple solution works!!! Fantastic work cfrag. I'm going to test on the carriers next, not sure if it works on ships. 

Link to comment
Share on other sites

On 5/20/2023 at 8:45 PM, Adalla said:

not sure if it works on ships

It does not not work on Carriers nor Assault ships for the simple reason that the missions do not provide the required location information, and 'from ground' does not work with carriers/assault ships

The code won't break - it checks for 'waterlogged' planes and keeps its fingers off those planes. 


Edited by cfrag
  • Like 1
Link to comment
Share on other sites

Ah, shame, cause it'd take carrier decks to a whole other level. 

Also, I confirmed that on my dedicated server, "mod" statics dont appear, while vanilla statics do. Even if I installed the mods on the server. So if anyone knows how to fix that, please let me know. The 4 hornets on the right, are spawned by the script. The 3 Hornets on the left, are statics I added myself. The MH-60R is me spawning as a client, and the mod works. Between all those aircraft there are supposed to be MH-60R and Bronco statics from the script, but they dont work probably for same reason why the statics I added myself to the mission for those mods dont work. 

null

image.jpeg

  • Like 1
Link to comment
Share on other sites

Finally figured it out. I was not re-starting my server after installing the mods. Re-started and they show up now. 

The problem @cfragis that I spawn on top of the static, it does not get removed like it does on my own machine/single-player. 

 

Correction: It works for the Hornets. It works ok for nullOV10 Broncos (they do a bit of a jump and move forward), but for helicopter (MH60R) they spawn on top of each other and it crasher the server.

Works fine in single player though. No issues with any aircraft vanilla or mod, helicopter or fixed. 

I think in Multiplayer/dedicated server its a timing issue. In SP it takes a lot less for the swap to occur. In some aircraft drop from a few feet high, break things. 😛

image.jpeg


Edited by Adalla
  • Like 1
Link to comment
Share on other sites

@cfrag

I wish you better luck and more success than I had with SWAPR 😉
This aspect of DCS is a can of worms.

Will try to study your script in the future, perhaps this summer I'll have time.  

Congrats.


@Adalla

Ah, collision issues in MP... they drove me nuts when I was developing SWAPR. 😭

I experimented with different events (because some of them didn't trigger in MP), I ended up having to write a dedicated server hook, which seemed to do the trick.
But even then, some people kept reporting collision issues in certain situations, never found the cause of those (but then again, I'm no scripting expert).  

Like I said, this aspect of DCS is a can of worms, issues keep appearing with DCS updates.
ED might decide to change event IDs, some necessary scripting functions might stop working, replacements might start spawning incorrectly (suspended in the air instead of touching the ground, etc.).

I hope @cfrag is able to deal with the worms that keep crawling out of this can 👍

  • Like 6
Link to comment
Share on other sites

Good to see you around @Hardcard
I've been trying to get SWAPR to work as well but without any success especially on a dedicated server. My primary aim is to get these scripts to work on a dedicated server in multiplayer, so as much I as love seeing them work in SP, the real value for me at least will be in MP so that multiplayer clients can see airbases (and maybe ships one day) filled with planes and helicopters rather than empty hollow ghost airfields. 

cfrag's script works with fixed wing aircraft as they are able to bounce and roll when spawning, but helicopters dont move much and so they collide on top of each other. 

I hope @cfragis able to do more testing on a dedicated server to help resolve the MP issues. Perhaps, something can be tweaked to allow helicopters to not collide on spawn as well.

These are IMHO really important scripts as they really bring DCS maps to life, especially when coupled with Random Air Traffic scripts and Carrier static swapping. 

  • Like 1
Link to comment
Share on other sites

1 hour ago, Adalla said:

cfrag's script works with fixed wing aircraft as they are able to bounce and roll when spawning,

More robust testing has shows that there is definitely an issue on MP servers, just as @Hardcard predicted, and it seems that it gets more pronounced, the more airplanes are involved. This also can impact fixed-wing aircraft (e.g. the Hornet may suddenly lose nose wheel steering because it gets damaged). Helicopters seem to be much stronger affected than fixed wing.

Single player seems to work well (still stress-testing), MP definitely needs more work.

  • Like 1
Link to comment
Share on other sites

StopGaps V.1.0.3 - 20230522

New version, fixes the multiplayer synchronization issue with a tiny server script that must be installed on the server (and only sever). Please see amended OP for instructions.

I'm still testing on a dedicated, hosted MP and a large mission, but initial results are promising.

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

21 hours ago, Adalla said:

I hope @cfragis able to do more testing on a dedicated server to help resolve the MP issues. Perhaps, something can be tweaked to allow helicopters to not collide on spawn as well.

My tests on local server and hosted dedicated server have completed, the 1.0.3 version in conjunction with the small server script works. @Adalla - maybe you can also give it a shot to see if it resolves your issues? Oh, and @Hardcard - your tip with trying a server plug-in saved me a LOT of grief, thank you so much!

  • Like 3
Link to comment
Share on other sites

1 hour ago, cfrag said:

My tests on local server and hosted dedicated server have completed, the 1.0.3 version in conjunction with the small server script works. @Adalla - maybe you can also give it a shot to see if it resolves your issues? Oh, and @Hardcard - your tip with trying a server plug-in saved me a LOT of grief, thank you so much!

Damn @cfrag. You keep impressing me! Already? Super excited, I will test this out here in the next few hours and let you know. 

This is so exciting. Really want this script to work as it'll make airbases feel so much more alive. 

I'll get back to you shortly, gotta have breakfast first 😄

  • Like 1
Link to comment
Share on other sites

@cfrag

IT WORKS!!!!! YOU ARE A FREAKIN GENIUS. This is going to transform multiplayer airfields....cant tell you how happy I am to see this working. 

I'll be making a video on my channel to showcase and spread the word. 

Thanks again for such a simple and elegant solution. 

Link to comment
Share on other sites

This is fabulous.

I've used @Hardcards SWAPR script for the last couple of years and it was "ornery" to get working in my experience. Took a lot of trial and error to make it work and I could never figure out what the magic incantation was for success even after creating many scripts. So much testing and frustration. It seemed like a great idea that was struggling with DCS's API scripting environment.

On the plus side, all the old scripts I've made have seemed to continue to work release after release of DCS. Hardcard's work was a really appreciated quality of life improvement to DCS.

Looking forward to trying StopGaps tonight and seeing how "ornery" it will be. 😃

  • Like 1
Link to comment
Share on other sites

This is a great script. The one thing I looked at from my wish list and added (hope you don't mind) was where you can add a tag of '-nsg' at the end of the group name and the unit will not spawn a static. This is helpful for me as I have some miz files with a very large number of Client Groups and spawning all of them will choke out clients. So this way I can have granular control.

I haven't been able to thoroughly test it, but it worked from initial tests

stopgap.lua

  • Like 1
Link to comment
Share on other sites

1 hour ago, gunterlund said:

also is there a way to get the static jet to face the same way the spawned jet does? Issue in NTTR

 

Yeah just change the group from Starting from Ramp to Start on Ground, then rotate the heading arrow to line it up how you want it.

  • Like 1
Link to comment
Share on other sites

8 hours ago, Ic3DevilDog said:

one thing I looked at from my wish list and added (hope you don't mind) was where you can add a tag of '-nsg' at the end of the group name and the unit will not spawn a static

Ah, indeed. I'm not a fan of naming schemes (IMHO they are a bane for mission designers), and so the DML version uses trigger zones to exclude planes (any player plane inside such a trigger zone is not stopgapped). I'll add an optional naming scheme to the next update, thank you so much for the suggestion!

  • Like 1
Link to comment
Share on other sites

8 hours ago, Ic3DevilDog said:

This is a great script. The one thing I looked at from my wish list and added (hope you don't mind) was where you can add a tag of '-nsg' at the end of the group name and the unit will not spawn a static. This is helpful for me as I have some miz files with a very large number of Client Groups and spawning all of them will choke out clients. So this way I can have granular control.

I haven't been able to thoroughly test it, but it worked from initial tests

stopgap.lua 12.33 kB · 6 downloads

That is a very cool feature. I did think that the "all or nothing" approach could really cripple FPS for very large servers, this might be a way to perhaps not spawn statics for aircraft inside sheltered parking spots/bunkers. 

  • Like 1
Link to comment
Share on other sites

Version 1.0.4 - 20230524

Added the following enhancement:

  • When you add '-sg' to a unit's name or group's name, that unit/group is exempt and will not show up as a static. My thanks to lc3DevilDog for the recommendation.

Enjoy,

-ch

  • Like 1
Link to comment
Share on other sites

Great minds... I was actually just making a revision to the update I did with the -nsg switch by adding the -sg to include rather than exclude it in the stopgap. Plus changed the polling from timer based to event based and put a batch processor in to respawn the statics only when all player slots are empty to prevent too many spawning of statics while others may be in flight.

This plus I've considered putting an option to create a "controller slot" where you can designate a specific group with an F10 menu to toggle the stopgap on and off live while the miz is running.

Thoughts? Or am I overstepping your boundaries, @cfrag


Edited by Ic3DevilDog
  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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