Home » Stars! 2.6/7 » The Academy » Chance to hit (Heavy) minefields much lower than documented?
Chance to hit (Heavy) minefields much lower than documented? 
Sun, 12 August 2018 10:22 

mrvan   Officer Cadet 1st Year  Messages: 220
Registered: May 2014  

There seems to be something wrong with the documentation, or mine fields don't work like I think they do.
Scenario: there's an SD heavy mine field, 200 mines (14ly radius). I'm sending 50 scouts (splitall) through the field at warp 9 (PRT=HE, shouldn't affect minefield travel?)
Warp 9 is 3 above safe, so chance to hit should be 3% per ly, or 97% chance to miss and travelling 28 ly through the field should give a hit rate of 1  (.97^28) = 57.4% (which is also what the STARS!.XLS mine fields tab gives)
So, I'd expect at least initially to lose about 1 in 2 scouts until the field is significantly smaller. The Chaff Sweep helper program also says that 47 chaff at W9 should clear the field with 19 hits.
This indeed works out if I place the mine field such that I can calculate a line straight through the center, e.g. exactly W or SW: I lose about 20 scouts and the field is cleared.
What is strange, however, is that if I put the mine field in a more or less random location WSW of the scouts, and point the waypoint through the middle as good as I can, I lose only 10 scouts and 810ly radius remains. I've repeated this 50 times, I lose mean=10.3 scouts (sd=2.4), so it's certainly not an RNG accident. I could imagine that I just missed the center, but that shouldn't leave an 8ly field.
I also placed the field at a different location about SSW of the scouts, this lead to losing mean=15 scouts, still leaving a significant field alive.
Pictures: https://imgur.com/a/vYlN4ph
So, it seems that the chance to hit a (heavy) mine field is much lower than I would expect based on the documentation... Did anyone notice this before? Any clue why this would happen? Or am I doing something wrong?
And a related question: does anyone know exactly how the engine checks the amount of lightyears in a field? I wrote a little chaff sweeper simulation (so I can simulate more complex setups, e.g. hitting two fields in a row, sweeping overlapping fields, etc.) by solving the quadratic equation for the intersection line  circle and calculating the length of the intersection. It works more or less as expected after rounding some things up, but gets slightly different results than running it in stars! itself.
[I thought it might be the case that it travels on whole integer points, so diagonal travel might "skip" some points, but traveling fully diagonally (straight SW) goes as expected. ]
[Edit: I thought that maybe the discrepancy was caused somehow because the game would check whether integer roundedlocations after each ly would be in the field, but that doesn't really matter]
[Updated on: Mon, 13 August 2018 05:25] Report message to a moderator



Re: Chance to hit (Heavy) minefields much lower than documented? 
Wed, 15 August 2018 03:23 

antey007   Crewman 2nd Class  Messages: 15
Registered: August 2015  

I suggest conducting a study using a method that I call an iterative semiautomatic testbed (ISAT).
For this we do the following:
Step 1. Preparation.
Create a small test bed (a small universe, 2 players, no random events). In it one of the players makes a minefield, the other gives the command to one fleet (1 chaff) to cross the minefield at high speed. In this case, a decrease in the size of the minefield will not affect the chance of hitting.
Save the order in the xfile, but do not generate.
Place this testbed in a folder, for example stars \ isat \ src
Step 2. Iterative generation.
You can write in your favorite programming language a small utility that will perform the specified actions the right number of times.
In windows, I use the Autotest.bat file for this:
del /q res\*
for /l %%i in (1,1,1000) do (
echo gen %%i of 1000
copy src\* . > nul
dir /b *.hst > list.txt
f:\games\stars\starsjrc4.exe g1 b list.txt
move *.m1 res\%%i.m1
)
I think it's easy to understand.
As a result, we get a large number of mfiles (1.m1, 2.m2, ..., 1000.m1) in the folder stars \ isat \ res.
Step 3. Analysis of the results.
Usually, this is the most difficult stage.
But in this problem, I think, you can do this:
The block size with the fleet (FLEETBLOCK) is different from the block size with salvage (OBJECTBLOCK). So just look at the size of the resulting files.
Mfiles, in which the fleet safely flew through the minefield, will have one size.
Mfiles, in which the ship is annihilated in a minefield, will have a different size. Сonsider the number of such files, their ratio to the total number of iterations will be the probability of an explosion in a minefield.
PS. This method can be used in a variety of other simple tasks. For example:
 an estimation of torpedo hit probability
 an estimation of hidden ship detection probability in a SDrace minefield
 an estimation of ship annihilation probability in case of overgating
and so on.
[Updated on: Wed, 15 August 2018 03:40] Report message to a moderator



Re: Chance to hit (Heavy) minefields much lower than documented? 
Wed, 15 August 2018 03:49 

mrvan   Officer Cadet 1st Year  Messages: 220
Registered: May 2014  

Thanks for the reply. This is approximately what I'm doing. You didn't really think I made the 50 trials by hand, right? . Doing it with just one scout per mine field to get actual odds is a good idea though.
What is much easier than analysing the m1 file is getting a fleet report and inspecting that. My setup is here: https://gist.github.com/vanatteveldt/1517f8d38c0e818af2e062f 50dcabb6e (in R, using wine to call stars!)
I'll do a test run with multiple field locations and a single scout per field, that should give results pretty quickly.
First results. Setup: 4 heavy fields around player #2's HW, each 100 mines, more or less random directions. 1 scout set to fly through the center of each field at W9. https://imgur.com/a/XsF0Lop
Ran 500 iterations, recorded survival of each ship after each run.
Expected results: chance to hit 45.62% [from STARS.XLS; check: W9 is 3 above safe, so 97% chance of missing. 10 radius field, so 20ly travel, chance to hit = 1  (.97**20) = 0.4562]
Actual results:
name chance_hit
<chr> <dbl>
1 Bulushi Test NE 0.190
2 Bulushi Test NW 0.178
3 Bulushi Test SE 0.316
4 Bulushi Test SW 0.264
[n=500 iterations, 1 trial per iteration per direction, chance_hit = 1  (#survivors / 500) ]
So, chance to hit is 19  32%, rather than expected 45%.
Edit2: Second batch of results, for only cardinal / true diagonal directions. Same setup, so same expected chance to hit:
name chance_hit
Bulushi Test E 0.382
Bulushi Test N 0.
Bulushi Test NW 0.192
Bulushi Test SW 0.326
[n=500 iterations, 1 trial per iteration per direction, chance_hit = 1  (#survivors / 500) ]
So, moving N gives a 0% chance to hit (unsurprising given NS mine travel bug, although it was unclear to me whether that also affected heavy mines). Moving straight east gives a relatively high chance to hit, although it is still substantially less than 46%. I'll try with more iterations when I get home. Going diagonal NW gives low chance to hit, SW medium
Tentative conclusion: chance to hit heavy minefields is lower than reported and depends on direction of travel or some unknown parameter. Which is kinda weird?
Could the results be chance? Chance of getting less than 40% hits (200 / 500) is 0.005%, chance of getting less than 20% hits (100/500) is < 0.000001 (https://stattrek.com/onlinecalculator/binomial.aspx)
These results don't make any sense to me. With 500 iterations the difference between e.g. .33 and .38 could well be chance, 95% confidence interval around .326 is .285  .369; but difference between .382 and .192 doesn't seem likely to arise by chance. I'll run 10k iterations tonight, that should reduce confidence intervals to +/ 1%. [http://statpages.info/confint.html]
I'll also test with normal mine fields and with larger heavy fields, see if the pattern is the same. What other parameters could be relevant?
Anyone with a possible explanation for these results?
Links to scenario setups:
 scenario with random locations: https://www.dropbox.com/sh/twhdewil9oop3lk/AAAcXbSJTKJPz5_SF 3XTVQnpa?dl=0
 scenario with cardinal/diagonal relations: https://www.dropbox.com/sh/twhdewil9oop3lk/AAAcXbSJTKJPz5_SF 3XTVQnpa?dl=0
[Updated on: Wed, 15 August 2018 06:36] Report message to a moderator



Re: Chance to hit (Heavy) minefields much lower than documented? 
Wed, 15 August 2018 11:56 

antey007   Crewman 2nd Class  Messages: 15
Registered: August 2015  

The experiment is not entirely correct.
As I know, minefields work with minimal necessary warp instead of actual warp.
So, at a distance of less than 49 (or 50) ly, W7 is minimal necessary warp, 1 above safe, so 99% chance of missing. 10 radius field, so 20ly travel, chance to hit = 1  (.99**20) = 0.1821
At a distance of less than 64 (or 65) ly, W8 is minimal necessary warp, 2 above safe, so 98% chance of missing. 10 radius field, so 20ly travel, chance to hit = 1  (.98**20) = 0.3324
Links to scenario setups is invalid: xy file is missing, you can not do anything without it.
[Updated on: Wed, 15 August 2018 12:00] Report message to a moderator


 
Re: Chance to hit (Heavy) minefields much lower than documented? 
Wed, 15 August 2018 13:51 

mrvan   Officer Cadet 1st Year  Messages: 220
Registered: May 2014  

Right, that seems to have solved it. I set the fleets on waypoints at least 65ly away. The heavy fields are now r=9ly, so expected hit% is 42%. Four random directions gave 4043% chance of hit after 500 trials, which is within chance.
Thanks for the pointer, I never thought to vary the waypoint distance...
Report message to a moderator



Goto Forum:
Current Time: Sat Apr 20 13:04:16 EDT 2024
