Jump to content

Recommended Posts

Just wanted to let people know that I seem to have a working very basic prototype of time of flight based flak. One of my main stumbling blocks was I didn't seem to be able to populate a non locally declared table until I found that it seems that I needed to return the tables from each function to get things to update. Which was a surprise as I thought the table being globally declared would have sorted things like that.

 

Anyway now doing a lot of testing and starting to put back in things like battery quality etc to influence things like the spread of the flak box created but have some questions for those with more scripting knowledge than me in the hope they can help me improve this and deliver something efficient.

 

Currently the prototype uses the following triggers:

(1) a mission start trigger to load first mist3.3a and then the flak script

(2) a continuous trigger which runs the flak manager function from the flak script - this basically does nothing else than figure out if a flak box should be created and where the explosions happen. This flak manager creates explosions for the entire map and all flak zones. lol theoretically anyway as I still have to test the limits of this.

(3) a continuous trigger per flak zone as before - this pretty much does nothing except add flak box co-ordinates and time for the explosions to happen to some tables which the flak manager reads.

 

My questions are:

(1) currently to remove a table entry I'm just setting it to nil as remove table didn't seem to work for me. This doesn't seem to actually remove the table entry as such but allows me to ignore it by testing for the nil entry. Reading some lua references it seems that eventually nil table entries are removed in reality freeing memory and reducing the number of entries in the table (ie #table goes from 2 to 1 if one was nil) via a garbage collection routine inherent in lua. Have I understood this correctly? Do I need to worry about this further eg force some sort of garbage collection routine to kick in more often to reduce the iterations in for loops around the tables and other performance related things? How would I do this or where would you look for examples of how this works?

 

(2) The flak manager is running on a continuous trigger whereas my original thought was to use a once trigger to load the whole script and then use the schedule function command to operate the flak manager at a convenient interval. Unfortunately I had trouble getting the schedule function to work properly for me so sidestepped the issue in preference of getting a prototype going.

Is the schedule function method significantly better from a performance point of view? Can someone give me a basic thumbnail sketch of getting it to work and prerequisites (eg I noticed snafu declares the scheduled function in his GCICAP as a local function but I've never understood if this was important for scheduling - I kind of assumed the main reason was to force each scheduled instance to have a fresh set of variables scope wise)

In other words I'm trying to decide if it is worth trying to rearrange things in this version before adding other nice to haves like battery skill, rate of fire etc.

 

Hopefully I can progress this some more soon if my workload in my job lets me. One of the nice things about a week off is that you can concentrate on things like this.

 

Cheers,

Stonehouse


Edited by Stonehouse
Link to post
Share on other sites

Release client of time of flight based flak

 

Ok looks like my questions were too hard or the right people haven't looked at this thread yet.

 

Not to worry :smilewink:, I ended up pushing on regardless with adding back skill levels, rate of fire etc to arrive at the script attached below. It definitely seems to work and my test bed mission (also attached) seems to run ok without frame rate issues even when all the zones are adding targets and the flak manager is creating explosions all over the place. I can see that if a plane changes their vector that the flak box will get created where they would have gone and likewise if they don't change their vector they start to get bracketed.

 

I do see some explosions occasionally going off in odd places so I think perhaps that the zones are fighting over the next index for the tables and possibly either overwriting entries or the flak manager perhaps struggles to keep up so it probably needs further work. I also find this version is much less deadly than the old vector based flak and even though I've reduced the skill based errors at great deal it just doesn't seem to be as effective. Perhaps another bug still to find or just more tweaking.......

 

I suggest you load up my test mission and watch it run through until all the aircraft land or crash and see what you think and then give it a try in your own missions and post up feedback/errors. Not sure how fast I can address things people mention as work is a bit up and down at present so I can't judge my spare time.

 

Note Mist 3.3a can be found http://forums.eagle.ru/showpost.php?p=2078336&postcount=97

 

Cheers,

Stonehouse

 

<edit> sorry found the reason for the lack of effectiveness - got the case of a variable name wrong so the explosions were all strength 1. Updated the script and mission but now it seems too deadly. It's getting very late here so I'm going to head off to bed and will look at the skill based errors tomorrow to sort out the effectiveness of the flak.

<end edit>

flaktofv0_3.lua

tof.miz


Edited by Stonehouse
found a bug
Link to post
Share on other sites

I've done some tweaking and I think this version is a reasonable balance. High skill batteries are very deadly unless you aggressively change your vector often, med skill - if you fly on a constant vector for too long expect to suffer damage or die, low skill you probably can get away with reasonably long periods of flying a constant vector unless you are unlucky. Mind you there is randomness at work so each run of the test mission will give different results and I'm looking more at the average experience I seemed to get from running it many times. ie if luck is against you all the aircraft might get shot up, where in another run most will make it.

 

Updated the notes a bit in the script to the effect that this is meant to model a Flak 36/18 and gave instructions as to what values should be changed and how to modify it to represent a Flak 41 (which came into service during 1943 but pretty much stayed in Germany for home defense and wasn't as anywhere near as common as the earlier model) - if I get time I may try to parameterise this so you can pass a value to indicate the battery is the more deadly Flak41.

 

Anyway attached is new version of the script and the updated test mission.

 

Cheers,

Stoney

flaktofv0_4.lua

tofv4.miz


Edited by Stonehouse
Link to post
Share on other sites

Hay Stonehouse; Great work on the flack set up... I've been following all the post and I found the Flack down load in the user files...

I need just a little help here...

My question is;

 

1. There is no referance to where to install the "flackv1.lua" file! Where dose it go?

 

2. You mentioned you need a lua called "Mistv3_3" I have never used this can you direct me to where to find the lua? Edit...I just saw your link above for the Mist.lua...cheers...

 

I'm really interested in your work however I do not speak code....I need it broken down for the regular guy..hehe

 

Keep up the good work Smokehouse..


Edited by Mojeaux

[sIGPIC][/sIGPIC]

Link to post
Share on other sites

Excellent

 

Using this in place of MANPADs in missions where I want to have some sort of danger without having to resort to SAMs all the time. For this purpose I use 3 kg shells, to strike a balance between lethality and playbility.

 

A tip is to set a "if unit dead" condition for the FLAK-zone, so that the FLAK dies when you kill a certain structure. I use deployed ZSU23 for that purpose.

 

Thanks!!

Link to post
Share on other sites
Hay Stonehouse; Great work on the flack set up... I've been following all the post and I found the Flack down load in the user files...

I need just a little help here...

My question is;

 

1. There is no referance to where to install the "flackv1.lua" file! Where dose it go?

 

2. You mentioned you need a lua called "Mistv3_3" I have never used this can you direct me to where to find the lua? Edit...I just saw your link above for the Mist.lua...cheers...

 

I'm really interested in your work however I do not speak code....I need it broken down for the regular guy..hehe

 

Keep up the good work Smokehouse..

 

Ok the flak lua script is just in a folder which you can reference easily when building your mission. When you add the trigger action DO SCRIPT FILE you get a OPEN button which when clicked gives you the standard Windows browse for a file dialog - you just navigate to where the lua script is and select it and that is it. Ditto for Mist. Your finished mission.miz file will contain both lua scripts (you can open the .miz file with tools like 7 zip). This would be most likely on a MISSION START trigger after you've done a DO SCRIPT FILE trigger action for MIST.

 

Please see following post for an update on both the vector and time of flight flak scripts.


Edited by Stonehouse
Link to post
Share on other sites

I've integrated the original vector based script with the time of flight based script so you now have a single flak script to load with 4 main functions:

 

  • flakmgr - this is half the shell time of flight system and creates explosions at co-ordinates given by the addtgt function
  • addtgt - this creates co-ordinates and timing for flak boxes into a table and is the other half of the time of flight based flak. This table is read by the flakmgr function which creates the actual explosions.
  • fill - this is the original script closely based on what Sithspawn built and is really a flak "effect" which creates random explosions across a zone (see example mission and comments in the script itself)
  • vecflak - this is a rebadged version of the old vector based flak script which is still useful for some situations.

Pretty much use a combo of flakmgr + addtgt (which go together), fill and vecflak to get the flak simulation you want, ranging from something that is mostly a cinematic effect to something very lethal.

 

I have tweaked further the explosion strength and skill based error for the time of flight based flak to try very hard to get something that is reasonably representative and also gives reasonable playability. Do be careful how many high skill flak zones are used as it is likely to be very deadly and requires constant vector changes to avoid damage. IE high skill flak zones are probably very AI unfriendly unless you give them orders to jink around somehow.

 

 

Likewise I have slightly changed the vector based flak's rate of fire to be slightly more playable.

 

On the whole I've tried to build something that will damage you and slowly chip away at you rather than kill you on the spot but there is a random factor at work so it's possible that the first flak burst you see is your last regardless of the flak function you use and the skill level of the battery.

 

Hope it works ok for everyone who tries it. Let me know how it goes. Open the script itself to see documentation and of course there is the demo mission to give you examples.

 

Cheers,

Stoney

 

 

<edit> I see from checking the main MIST thread just now that version 3.4 has been released which supersedes v3.3a. Please use version 3.4 instead of 3.3a. Link here for 3.4 http://forums.eagle.ru/showpost.php?p=2090603&postcount=538

flakv2_0.lua

flakexamples.miz


Edited by Stonehouse
sorry tired, uploaded the wrong mission. correct now
Link to post
Share on other sites

New version soon

 

Just an fyi that I've done some more work on this module and have successfully got tof and vector based flak working when attached to a moving unit. I was mainly interested in this for maritime convoy scenarios and having the flak script be able to be attached to a unit via a trigger rather than a zone. My tests used the tanker and dry cargo ships and I was able to attach flak to these ships so enemy aircraft in range are attacked. Few other improvements added like using spherical trigger zones rather than cylindrical ones but the main news really is that I'm nearly done creating a completely new version based around the number of batteries or individual guns determining how many targets can be attacked at one time. My biggest problem with the flak script in use now is that it scales based on the number of enemy aircraft. So a single aircraft will only get a single set of explosions where if 10 aircraft enter the trigger zone you get 10 explosions. The new version will add a new parameter which specifies how many batteries (for time of flight based flak) or how many guns (for vector based flak) and this number will determine how many targets can be attacked in any given cycle. Additionally I'm adding true rate of fire based on skill instead of the statistical approach I use now. Note that this means that if a target is defended by 6 batteries and a single aircraft comes by all 6 will attack it but if more than 6 aircraft go for the target only a max of 6 will get attacked at any one cycle with the target for each battery determined randomly. So the point being that at times some aircraft will be unengaged which I think is much more realistic.

 

I'm hoping this new version will be ready by the end of the weekend for people to try out assuming real life doesn't interfere.

 

Cheers,

Stonehouse


Edited by Stonehouse
Link to post
Share on other sites

Ok I lied lol, actually no I didn't I just got very keen after I got home from work and got it (hopefully) finished. It was a bit rushed so hopefully no bugs and the doco in the script is alright. Let me know if there are problems. Script and mission attached. Use Mist3.4 please.

 

Cheers

Stonehouse

 

<edit> I may need to change the skill based dispersion numbers a bit as some experiments with some friends as guinea pigs tonight demonstrated that as each plane gets killed the flak gets deadlier as the same amount of guns hunt fewer targets..realistic but not so playable if it is not just random bad luck that the first few got hit badly, well actually took direct hits and were converted to flaming fragments.

 

Probably also have to be more careful how many batteries and guns you choose compared to the earlier script versions and skill level usage. Anyway please experiment and give feedback.

flakv3_0.lua

flakexamples2.miz


Edited by Stonehouse
Link to post
Share on other sites
Hey Stonehouse

 

i tried incorporating this tonight into my 3 pigs mission... it's throwing script errors.

 

the .miz is attached.... can you have a peek and see whats up?

 

Cheers!

 

Ok will do.

 

Also spent quite a chunk of time today tuning the rates of fire, error and damage. I found through use of AI aircraft parked on the ramp and set explosions that a strength 9 explosion 10 m in front of a P51d will damage it badly enough for the pilot to get out. From what I have read an 88 shell had a lethal radius of about 30ft or 10m so I've set the tof explosion to 9 and the vector and fill explosion to 10 and then tweaked the rof and spread from there to try to get something that gives pilots a challenge but not so much that people don't want to fly with flak in game.

 

New version below with the usual example.

 

Cheers,

Stoney

flakv3_1.lua

flakexamples3.miz


Edited by Stonehouse
Link to post
Share on other sites
Hey Stonehouse

 

i tried incorporating this tonight into my 3 pigs mission... it's throwing script errors.

 

the .miz is attached.... can you have a peek and see whats up?

 

Cheers!

 

Hi Dooom,

Ok I had a look and from what I can see the errors are due to mist not being loaded for some reason. If you look through your dcs.log for something like

 

INFO SCRIPTING: Mist version 3.4.23 loaded

 

you don't see it and therefore everything using a mist function fails.

 

Without being sure I my gut feel is you have an issue with your non flak related triggers as I hacked your mission down to just the flak zones, your flak trigger conditions and the planes (plus a few) and ground units and it all worked without error and lots of nice flak bursts, so you may have to redo the trigger layers and find which one is at fault. Also perhaps this is caused by an enemy unit being in a flak zone and triggering the flak before MIST finishes loading?

 

Perhaps someone with more experience can have a look and short circuit the process for you. Happy to keep looking at it for you but I reckon it will take some time to find the root cause. Big mission!!

 

Anyway my chopped copy below.

 

Cheers,

Stoney

DCSW_P-51D Drei Schweine_vstoney.miz


Edited by Stonehouse
Link to post
Share on other sites

ok Stone... i'lll try a few loading schedules to see how it plays out - thanks for confirming its on my end.

 

maybe the SAR script is F-n it up.... will report back.

""This was not in the Manual I did not read", cried the Noob" - BMBM, WWIIOL

Link to post
Share on other sites
  • 4 months later...

Hello fellas!!!

 

Incredible mod!!!

 

I would like to use it with helicopters, it should not be very difficult, but, I do not know how to do it.

 

Would you mind to give a try? Regards!!

 

I would also like to use together with the CTTS script, can I put them both??

CTTS.lua


Edited by ESAc_matador
Link to post
Share on other sites

Lol ok but I hope you have waterproof seat covers in your Huey because sitting in one when a flak burst goes off is a seriously tense moment.

 

I didn't worry about it before because I figured helos would always be lower than the min alt for heavy flak but no problem it's a very simple change.

 

New version attached with example mission. I'll update the one in dcs files over the next day or so. Note that the only change was to make helicopters eligible flak targets.

 

Now some pics of what's going to happen hehehe :music_whistling:

 

(ps yes CTTS should be ok I believe)

Screen_141114_175632.thumb.jpg.735625b78f4d21640213c03cda937d30.jpg

flakv3_2.lua

flakexampleshelos.miz

Screen_141114_180151.thumb.jpg.f26dfe6e438257653bead0f19a407d8b.jpg

Screen_141114_175616.thumb.jpg.171d570dfa736e9371fd8d495d1a4da5.jpg

Link to post
Share on other sites

Woowwww!!

 

Perfect!! I tested it and works great. In order to simulate the smoke, I attached the triger to an artillery unit that fires ( to a predefined point, far away where there is no action) when the script is going on and it stops when you are out of the zone, or you kill the unit. Do you have any suggestion? which unit has a great rate of fire in DCS? (this should be artillery or mortars, to make big ammount to smoke) ANy suggestion?

 

In any case. JUST GREAT

Link to post
Share on other sites
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...