You probably are indeed getting an overflow, because it's not using an integer... it's using a long, in the form of an FInt, which is basically fixed-integer math. You're going to have a lot of problems with that, because the maximum of that is... 12 bits less than a long, IIRC? I don't recall what that works out to, but it's much lower than the int ceiling IIRC.
Revised the following thoughts at the bottom after reading the code more carefully.
What I suggest is that you offset each of these points to the zero position and have them all be relative. So basically if you use their offset (negative or positive) from the center of the battlefield (Engine_AIW2.Instance.CombatCenter), you'll have vastly smaller numbers and use both the positive and negative part of the integer range. There are a variety of kinds of calculations that work best if their math is centered around the actual centerpoint as if the centerpoint were 0,0 in it's own "local coordinate space," anyway.
...But then there are others that work better if all the numbers stay in the positive integer range and never go negative, hence us having the battlefield offset the way it is.
Another option would be to use System.Numerics.Vector4 or similar, and then add them as those. If you do those as vector operations ( centroid /= knockbackCount ), then it actually will run twice as fast as the code you have here does. System.Numerics.Vectors use SIMD, which gives you 2-4 operations for the cost of one, when it comes to the additions and divisions, etc. They also don't have the same sort of precision problems in general.
What they DO have, unfortunately, is a tendency to be slightly different on different machines. So there's a slight drift that will come out of the knockback that will have to be fixed via desync-fixing code that is already planned anyway. So if you can do it with ArcenPoints, that's awesome because that will be deterministic. But if you're having trouble with that, then the alternative is not bad at all.
Revised thoughts on the knockback centroids after re-reading your code:
- It looks like you're already centering this on zero, which makes sense to me. I'm guessing that you're using the sources of knockback as magnitude offsets from the point of the ship, is that correct? So if my ship is at 12444,50660 position, but gets knocked back by 1200,-600 relative to that, that's what is in the knockbackList... I hope? If so, then I can't see how you'd be getting an overflow issue.
- If not, then I can see why the overflow issue is probably happening, and so just subtracting Engine_AIW2.Instance.CombatCenter from every knockbackList.LeftItem before it is added, and then at the end adding Engine_AIW2.Instance.CombatCenter to the centroid, would solve the problem.