Yankes, plz keep responding. What I want to do is b)Teach AI to avoid obstacles when shooting and maybe when moving. It is my opinion that the best way to do this is the following:
- When in setupEscape(), the AI will consider enemy units against which it has cover as only a fraction of a spotter.
- When in findFirePoint(), the AI will prefer not to shoot at targets it is unlikely to hit.
- For the player's convenience, UFOextender accuracy should show the chance that the shot will actually hit. Otherwise, a realistic partial cover system will just be confusing as you have no idea how good cover is.
I consider all three elements of this essential to a decent realistic partial cover system. They are all fairly easy to implement, but in all three I am missing one key component:
a function which determines a shot's actual chance to hit. The key is surely in applyAccuracy(), but I don't understand the math in applyAccuracy(), so that's where I need your help. I can implement everything else and give you the tools to balance it further.
Imo vanilla hit deviation isn't big enough for partial cover to matter (do some tests in debug mode if you like), and that's why the AI works well without understanding partial cover at all: it doesn't matter. But vanilla should stay vanilla. Which is why I also suggest allowing modders to add hit deviation between 10-50, but that is a secondary concern and pretty trivial to implement, albeit possibly difficult to balance.
------------------------------------------------------------------------------------------------------------------------------------------
The difficulty of that final component is the main reason I originally went with the "artificial" method. If the function is impossible to implement, I would like to resume my work on the "artificial" method, because having artificial cover is better than the vanilla approach of having almost no partial cover. At least as a modding option, assuming it doesn't cause glitches in the engine. However that won't mean much if it's a separate fork that never gets updated while the main branch gets all the updates, so I won't do it unless there's a chance it will be merged into the main branch.Also keep in mind that the "artificial" method is used by FiraxisCOM and Xenonauts, but the "realistic" method has only successfully been implemented by Phoenix Point. 96COM and by extension OpenXCOM does not really have partial cover, so it gets away without the AI knowing about it. So if you can't implement the "realistic" method of accuracy prediction, please support my attempt to implement the "artificial" method by merging it once it is complete (if it is not buggy).