Baret / pltcmd

Control military units only with your radio
MIT License
4 stars 0 forks source link

Add range for combat #113

Closed Loomie closed 4 years ago

Loomie commented 4 years ago

Currently two elements must be on adjacent tiles to fight. Add weapon ranges to enable fighting depending on weapons (like snipers can engage enemies from a larger distance).

Related:

112

Baret commented 4 years ago

I'd like to suggest a simple system that adds some variety to ranged combat: The Range of a Weapon has 3 properties: min, effective and max that affect the damage dealt.

Loomie commented 4 years ago

The range should also affect the accuracy of the weapon. A pistol may not hit anything on 500 meters, but a marksman rifle has good chances to hit the same target.

Baret commented 4 years ago

Yup, agreed. Maybe for simplicity's sake we apply the range factor to both, damage and accuracy. And when we realize that it doesn't work out we implement a rangemodifier for damage and one for accuracy.

Loomie commented 4 years ago

I tried to come up with a formula for calcuating the accuracy based on range. It should only drop low at the beginning and more at the end.

Because I didn't found such a thing in the frist place, I searched the internet and found some interesting readings. They are about ballistics which is a bit too much, but that's what we want to abstract.

Links an findings:

For me the most interesting fact is that the accuracy can be described as a cone. The range and angle describe the area that may be hit on that range. So on the other side (of the shooter) we need the size of the target. Then the ratio of target size to disperion area makes up the chance to hit at the given range.

Another finding is that the angle of the offset for an range is given in (NATO) mil.

To test the surface area of the target against the scatter area seems intuitiv. The graph looks as follows for 7 mil (0.7 m diameter at a distance of 100 m): pltcmd-range-accuracy-testinggraph

The first values are capped at 100% as the area to hit is larger as the scatter. Then there is a strong fall and afterwards the drop slows down. I have choosen the mil value so that the 50% marks are almost the same (around 470 m). I think it is good that below this range the accuracy is significant higher. Although the drop is very strong, it describes that the weapon (system) is precise enough to hit but the shooter gets problems to aim accurately at longer range (a small error in aim results in a large error to hit).

Its not perfect and does not include all variables for shooting at ranges. But I think it is a good start for ranged shots.

Baret commented 4 years ago

I thought my approach was a good and simple start, so well xD Great work! We can always go for more complicated solutions so go for it if you want =D

I will start #81 after I restructured the GameView (#75)

Loomie commented 4 years ago

The basics are done. Will be improved in #81