I made an OOS vs IS test (update)

This forum is the ideal place for all discussion relating to X4. You will also find additional information from developers here.

Moderator: Moderators for English X Forum

Gregorovitch
Posts: 629
Joined: Mon, 5. Sep 11, 21:18
x4

Re: I made an OOS vs IS test (update)

Post by Gregorovitch » Wed, 2. Dec 20, 00:11

Imperial Good wrote:
Tue, 1. Dec 20, 23:14
Turning off DLSS for in built AI is something most people would accept
I would think that is a highly debatable assumption. Folk who fork out the best part of $1000 for a GPU do so for reason and that is definitely not scaling back it's ability to deliver best possible graphics at highest possible FPS at highest possible resolutions. I would say it's odds on such folk would prefer to throw a measly $100 at a separate unit rather than compromise their $1000 baby.

Another issue is that another group who are likely to be among the most interested in NN base game AIs initially, strategy and 4X players, are often not that interested in high end graphics. They are likely to want to keep their budget GPUs and shell out a measly $100 for a separate AI unit rather than fork out for a high end GPU.

However I do think this crystal ball gazing over what the technical hosting solution will finally be is putting the cart before the horse. The first step in my mind is to make a game with a NN AI, or retrofit a NN AI into an existing game. The latter probably makes the most sense. Not least because the exercise will no doubt throw up all sorts of issues and requirements regarding end user NN hosting than none of us have even thought of yet.

User avatar
Killjaeden
Posts: 5366
Joined: Sun, 3. Sep 06, 18:19
x3tc

Re: I made an OOS vs IS test (update)

Post by Killjaeden » Wed, 2. Dec 20, 00:46

Imperial Good wrote:
Tue, 1. Dec 20, 19:27
They just need GeForce 16, RTX 20 or RTX 30 GPUs as those have Tensor cores which sole purpose is AI acceleration and is how DLSS works.

The issue is that such GPUs are a lot higher requirement than the GeForce 700 that X4 currently needs. Also AMD seems to lack competition in this regard so anyone with an AMD GPU, even brand new, might be out of luck.
If you are discussing about Hardware and GPU limits, then you miss the point of the core of machine learning / neural networks. They are a tool and can be arbitrarily complex. From 10 mathematical operations to get from input to output, up to millions/billions of mathematical operations (millions is what you need for full range image processing, as every pixel is one input value). Just like any ordinary math equation can be arbitrarily complex (e.g. taylor series expansion).

I recommend watching this https://www.youtube.com/watch?v=aircAruvnKk

Predicting hit propability will not lead to a neural network with thousands of operations required, because the amount of input parameters are about 10-15. It's several orders of magnitudes smaller/simpler than a "neural net anti aliasing / whatever" shader would have to calculate per each frame. The latter is what you would need dedicated gpu architecture for, and that is where you will feel the impact quickyl ,esp. on higher resolutions

Besides, not every shot needs to run through the nerual net - since you dont actually have real bullets OOS. You just calculate a more realistic hit propability once, via an equation and multiply that with on-paper DPS to get OOS DPS. The equation being the neural network that was trained on the data gotten from extensive IS combat logging. Mathematical operations in basic NN's are almost always addition or multiplication - both perform significantly better than any other operation. Thus having a 10 Neuron network to calculate the output might actually be less performance intensive than performing a single e^x or log(x) operation.
[ external image ]
X-Tended TC Mod Team Veteran.
Modeller of X3AP Split Acinonyx, Split Drake, Argon Lotan, Teladi Tern. My current work:
Image

Imperial Good
Moderator (English)
Moderator (English)
Posts: 4760
Joined: Fri, 21. Dec 18, 18:23
x4

Re: I made an OOS vs IS test (update)

Post by Imperial Good » Wed, 2. Dec 20, 08:43

A big issue I have observed currently (3.30, not tested beta yet) is that guns seem to have infinite accuracy in low attention combat. This is why the Rattlesnake obliterates all S and M ships nearby very quickly in low attention levels since these ships start to take the extreme average DPS of the main batteries in damage, despite them seldom hitting when the player is nearby. M ships armed with Plasma guns or the various railguns suffer the same issue as these are guns with high on paper DPS so deal high low attention damage despite being "unable to hit the side of a barn" when the player is nearby. The logic does seem to work sensibly for turrets, with Plasma turrets landing hits infrequently against S and M ships in lower attention combat making Pulse Laser turrets more effective against such ships as is the case of combat near the player.

The K and especially I deal a lot of damage purely due to the large number of good stat turrets. L Gravaton turrets with their faster projectile speed seem to have significantly higher hit rates against smaller targets than plasma turrets in low attention simulations while also having comparable damage per hit. However the fact that a single Rattlesnake with some equipment mods installed on it can solo 2 Ks in the low attention logic shows that the gun logic is likely more inaccurate than the turret logic. Order that Rattlesnake to do the same near the player and it almost certainly will get destroyed.
Gregorovitch wrote:
Wed, 2. Dec 20, 00:11
I would think that is a highly debatable assumption. Folk who fork out the best part of $1000 for a GPU do so for reason and that is definitely not scaling back it's ability to deliver best possible graphics at highest possible FPS at highest possible resolutions. I would say it's odds on such folk would prefer to throw a measly $100 at a separate unit rather than compromise their $1000 baby.

Another issue is that another group who are likely to be among the most interested in NN base game AIs initially, strategy and 4X players, are often not that interested in high end graphics. They are likely to want to keep their budget GPUs and shell out a measly $100 for a separate AI unit rather than fork out for a high end GPU.
Decent AI and GPU performance is available in a $300 package now in the form of the RTX 3060 Ti. Nvidia is already pushing that the tensor cores can be used for more than just DLSS, such as real-time automatic background removal for webcams as well as voice chat noise cancellation, all with minimal impact on game frame rate. Again there is no need for a separate $100 addon card and all the potential problems it can bring (worse airflow for the GPU, possibly PCIe bifurcation if another addon card is being used already, buggy drivers, proprietary APIs). The main issue is neither Intel or AMD have a competitive solution for this yet and only recent GPUs from Nvidia offer this feature.
Killjaeden wrote:
Wed, 2. Dec 20, 00:46
Predicting hit propability will not lead to a neural network with thousands of operations required, because the amount of input parameters are about 10-15. It's several orders of magnitudes smaller/simpler than a "neural net anti aliasing / whatever" shader would have to calculate per each frame. The latter is what you would need dedicated gpu architecture for, and that is where you will feel the impact quickyl ,esp. on higher resolutions
I suspect you are vastly underestimating the number of variables needed for a vaguely accurate low attention simulation. Below is a list of the variables the AI would need to factor in (be fed) for just a single ship.
  • Position (3 values)
  • Facing (a quaternion or other representative form)
  • Ship shape (possibly a large number of variables, but at the very least would be a single pre-determined class field)
  • Ship boost performance (possibly 3-5 values)
  • Ship flight characteristics (possibly 6-9 values)
  • Weapon characteristics (Possibly 15 per weapon including everything from firing characteristics to firing arc and position on the ship or maybe another neural network to condense those to a single set of arbitrary weapon performance values)
  • Ship skill (1 value)
  • Pilot faction (1 value)
Now this is just per ship. For the simulation to be accurate it would need to factor in possibly dozens of ships at the same time to accommodate for how they interact with each other. This could easily be thousands of input parameters by the end. If an attempt is made to condense input values to a select few and use a small neural network, then chances are the output will be not much better than currently, with it more accurately handling some situations but others, especially edge cases, possibly being handled less accurately or becoming out right broken. Debugging such issues also becomes very difficult since the transform of inputs applied by the neural network function is not bound by prove-able logic like traditional code is. If neural networks were easy and performant, everyone would be using them for a lot of things by now.

I still think the most reasonable current solution is to develop several dozen test cases which represent a variety of combat situations which can be run both in very high attention (as if player was in them) and in varying levels of lower attention (in sector but far away, in map view, far away in map view and in background) to help debug and create better simulation logic for combat. The logic can then be adjusted until most of the test cases have results which are fairly close to the very high attention results. If necessary metadata could be added to weapon and ship data specifically for low attention simulation calculations which could help adjust hit rates or damage to be more accurate.

Gregorovitch
Posts: 629
Joined: Mon, 5. Sep 11, 21:18
x4

Re: I made an OOS vs IS test (update)

Post by Gregorovitch » Wed, 2. Dec 20, 14:32

Imperial Good wrote:
Wed, 2. Dec 20, 08:43
Decent AI and GPU performance is available in a $300 package now in the form of the RTX 3060 Ti. Nvidia is already pushing that the tensor cores can be used for more than just DLSS, such as real-time automatic background removal for webcams as well as voice chat noise cancellation, all with minimal impact on game frame rate. Again there is no need for a separate $100 addon card and all the potential problems it can bring (worse airflow for the GPU, possibly PCIe bifurcation if another addon card is being used already, buggy drivers, proprietary APIs). The main issue is neither Intel or AMD have a competitive solution for this yet and only recent GPUs from Nvidia offer this feature.
I confess you are making a very strong case for this. There is no doubt you are right that using existing GPUs for game AI is the line of least resistance providing it works well enough. It's fortunate that Nvidia cards are so popular and likely to remain so in the near future. I would think AMD and Intel would be forced to follow Nvidia post haste if it worked.

User avatar
Killjaeden
Posts: 5366
Joined: Sun, 3. Sep 06, 18:19
x3tc

Re: I made an OOS vs IS test (update)

Post by Killjaeden » Wed, 2. Dec 20, 18:30

This whole thing could be a nice task for a bachelor thesis for computer science/gaming related degree... If ES would approach a professor of a university with such areas , im sure they could find some applicants.
Imperial Good wrote:
Wed, 2. Dec 20, 08:43
I suspect you are vastly underestimating the number of variables needed for a vaguely accurate low attention simulation. Below is a list of the variables the AI would need to factor in (be fed) for just a single ship.
>LIST<
Now this is just per ship. For the simulation to be accurate it would need to factor in possibly dozens of ships at the same time to accommodate for how they interact with each other.
First of all in OOS movement/rotation and their derivatives can be decoupled from the actual damage simulation. You can give the appearance OOS that a small ship is flying around a larger one during combat when you look at the map. But that doesnt mean damage calculation needs to fit this visual representation - or that the actual ship movement is simulated like it is IS. You can in fact ignore it in a lot of prime cases (such as dogfights).

Facing of the target is irrelevant for dogfights at large time scale, because it changes so fast that its no longer relevant OOS. It only matters if the target is engaged in a dogfight or not. In the later case it will travel in a straight line 95% of the time. Could change if AI is someday overhauled to perform space ballet, or actively tries not to get hit at far range - but i dont see that happening.
Range to target is relevant, yes. Doesnt matter what the coordinates of the vector are, because there is no gravity / bullet drop to consider. And most stuff in X4 plays out on a 2D plane anyway... (unfortunate for variety, fortunate for system simplifications).

turret rotations speed, bullet speed and max range is the only thing you need for weapons. You just need to find out hit propability and "time you have for shooting at the enemy". Yes you need to know what turrets are on the ship, but that is not a parameter how likely it is "to hit".
Facing of the ship only is relevant for if it can deal damage or not - and only relevant for capitals, because they turn slowly. If turrets are supposed to shoot where they facing, then this can too be simplified to 6 directions (forward, right, up, etc) - where 2 (up, down) are in most cases ignorable, since almost everything plays in 2D plane. If OOS for a capital and range to target is high, one can also just assume that the capital ship chooses a favorable facing, where at least 1 usefull direction with amount of turrets is effective. And if OOS and capital, but fighter target dogfighting the capital, one can assume that only one direction or 2 can fire, pick the side randomly, and then each turret of that side is allowed to roll for damage... (unless it already rolled for another target in one "OOS firecycle").
A detailed ship shape other than general dimensions (average surface area) would be ridiculous to include in low detail simulation.

Pilot faction ? lol... since when do certain races hit better? The NN isnt supposed to tell what the ship should do either. The NN is just the formula for hit chance and practical DPS.
The logic can then be adjusted until most of the test cases have results which are fairly close to the very high attention results.
I dont understand why you reject NN as too complicated/ too many parameters but handwave "create some logic, and then adjust it" around just like that. "Just perform a bit of magic, create a formula for life, the universe and everything and then you get the result" is what you are saying there. To find the connections between the different parameters manually, and cover every edge case will be near impossible, if you apply the same criteria that you stated for the NN.
You can perform some abstractions and general statements, for example that hit propability is a function bullet travel time + range + evasive potential of the target + targetsize + projectile hitbox + flight behaviour state (dogfighting or flying in a straight line). You know that the more time it takes, the more time the enemy has to accidentally perform some maneuver that throws off your aim (because AI are not actively trying to evade shots... at least for now). But thats about it - start guessing. For a NN you can use this relation to structure it / give initial guesses with this information.

But apart from that, good luck guessing a formula that "just works" for all test cases - even if you have all the raw data you could think off. No matter what you guess, it wont fit all. The behaviour you want to simulate wont do you the favor of behaving linearly...

If i had time and access to source code i would love to have a gander...
[ external image ]
X-Tended TC Mod Team Veteran.
Modeller of X3AP Split Acinonyx, Split Drake, Argon Lotan, Teladi Tern. My current work:
Image

Imperial Good
Moderator (English)
Moderator (English)
Posts: 4760
Joined: Fri, 21. Dec 18, 18:23
x4

Re: I made an OOS vs IS test (update)

Post by Imperial Good » Wed, 2. Dec 20, 22:32

Killjaeden wrote:
Wed, 2. Dec 20, 18:30
Facing of the target is irrelevant for dogfights at large time scale, because it changes so fast that its no longer relevant OOS.
I think it is quite relevant so as to factor in ships trying to flee.
Killjaeden wrote:
Wed, 2. Dec 20, 18:30
Range to target is relevant, yes. Doesnt matter what the coordinates of the vector are, because there is no gravity / bullet drop to consider. And most stuff in X4 plays out on a 2D plane anyway... (unfortunate for variety, fortunate for system simplifications).
It is very much relevant since guns can only shoot forward and turrets have limited fire arcs. The current simulation factors this in but in quartiles. This is so that ships with poor rear turret coverage are less effective against targets behind them than when in front. The behaviour of attacking from behind has to be considered.
Killjaeden wrote:
Wed, 2. Dec 20, 18:30
A detailed ship shape other than general dimensions (average surface area) would be ridiculous to include in low detail simulation.
But is needed since it plays an important part of in sector combat. Something like a Xenon I is a huge bullet sponge, assuming the turret targeting is working.
Killjaeden wrote:
Wed, 2. Dec 20, 18:30
Pilot faction ? lol... since when do certain races hit better? The NN isnt supposed to tell what the ship should do either. The NN is just the formula for hit chance and practical DPS.
The combat maneuvers used depend on pilot race and skill. Without proof that this has no influence on combat results near the player it would need to be considered. This has been the case since X4 released.
Killjaeden wrote:
Wed, 2. Dec 20, 18:30
But apart from that, good luck guessing a formula that "just works" for all test cases - even if you have all the raw data you could think off. No matter what you guess, it wont fit all. The behaviour you want to simulate wont do you the favor of behaving linearly...
Which is why I would imagine gathering some statistical data would be the way to go. This statistical data can then be placed in discontinuous lookup tables and help resolve a good approximation without having to derive continuous functions. Unlike neural networks, the result and logic involved is transparent and so can be verifiable. These tables could even be specified on a per ship basis for more flexibility.
Gregorovitch wrote:
Wed, 2. Dec 20, 14:32
I would think AMD and Intel would be forced to follow Nvidia post haste if it worked.
AMD apparently is with their implementation of a DLSS competitor. But it still is nowhere to be seen... It might be that their new GPUs even have tensor core like hardware built into them, just developers currently have no way to utilize them efficiently currently. Intel still does not make a competitive discrete GPU, and as such it is also entirely possible that when they do theirs will come with such features. Intel is already pushing AI related things on their newer CPUs, including AVX512 extensions (proprietary to them) to help with AI related execution.

User avatar
Killjaeden
Posts: 5366
Joined: Sun, 3. Sep 06, 18:19
x3tc

Re: I made an OOS vs IS test (update)

Post by Killjaeden » Thu, 3. Dec 20, 00:20

Imperial Good wrote:
Wed, 2. Dec 20, 22:32
detailed ship shape >>> But is needed since it plays an important part of in sector combat. Something like a Xenon I is a huge bullet sponge, assuming the turret targeting is working.
You dont need to know that there is a 2m protrusion at the bow, and a 1m hole in the middle. You need to know how well you can hit it. And an average surface area value (which would be large on Xenon I) takes care of that well enough, or better said - chances for hitting a moving xenon I are almost 100%. If by sponge you mean "bullet occlusion" (things taking cover behind each other) - forget it.
Its not going to happen OOS. You cant expect the exact same results OOS. The whole point of OOS combat being a SIMPLIFICATION to safe performance. If you cant let go of some things you wont get a performance cost reduction...

If you would want to sample data for that, you can essentially also just dump the entire game memory of that battle into a file constantly... But you wont get any wiser from it, because its way too much to digest. Sure if a neural networks is presented with this garbage pile of unspecific data, it will take a gazillion neurons and years of cpu time to make heads or tails of it. Preliminary data selection and abstraction is absolutely required.
Imperial Good wrote:
Wed, 2. Dec 20, 22:32
Facing of the target>>>I think it is quite relevant so as to factor in ships trying to flee.
You can get fleeing state from his behaviour script, as a boolean. Dont need to check orientation for that and try to figure out if it's fleeing. And if it is fleeing, then again its not going to perform the same extreme turns as it would in a dogfight -> hitchance will be higher. So its simply a matter of "what state is this ship in" (active dogfight, or a "goto" objective, or stationary)
poor rear turret coverage are less effective
fighters do not intentionally try to stay in the rear turret coverage. They just randomly end up there or not. Thus if you pick a random turret "array" for a facing to apply his DPS, if rear is picked, damage will be automatically less, because its fewer turrets ... That is to say - treat fighters attacking a capital according to Heisenberg ;) They like electrons around the atom core, randomly here or there.
Imperial Good wrote:
Wed, 2. Dec 20, 22:32
coordinates of the vector >>>It is very much relevant since guns can only shoot forward and turrets have limited fire arcs. The current simulation factors this in but in quartiles. This is so that ships with poor rear turret coverage are less effective against targets
Chance of a fired bullet hitting is not affected by vector coordinates.
Can it fire on front weapons or not is irrelevant for maneuverable objects. Fighters, they turn fast enough, that you can assume they will eventually (after attack run manuever) have firing solution for x amount of seconds. That means you can get a statistical average time it takes to get one attack run, (while in dogfighting range obviously) on a specific target type (large slow vs small nimble is not the same).
lookup tables
Statistical data being required, that we can all agree. Cant simulate/aproximate something properly if you dont understand it.
However, your suggestion that lookup tables would be possible or transparent... ehh again, are you forgetting what you brought up yourself?
10 independant parameters that all affect the result (nonlinearly) lead to a 10-dimensional matrix. The amount of memory required could be quite silly, and the table lookup having to sift through large matrices and perform 10-dimensional interpolation might not be faster than having a trained NN of low complexity calculate a result.
And idk what multidimensional beeing you are, but the best i can achieve is visually process a 3 dimensional matrix, with momentary glimpses into a 4th one (3Dimensions changing over time)... a 10 dimensional matrix is far from transparent to comprehend for ordinary humans... and in a previous reply you said how many things one shall need in your opinion to consider in addition to what i mentioned below the OP - so for your standards, it might be approaching a 30 dimensional matrix or higher.
[ external image ]
X-Tended TC Mod Team Veteran.
Modeller of X3AP Split Acinonyx, Split Drake, Argon Lotan, Teladi Tern. My current work:
Image

Post Reply

Return to “X4: Foundations”