OOS combat - how SHOULD it work?

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
PlatinumTech
Posts: 48
Joined: Thu, 27. Sep 07, 20:21
x3tc

Post by PlatinumTech » Wed, 29. Apr 09, 06:35

Missiles are tricky. Speed should be a factor, but so should Type.

I.E.
Seeking 40 m/s missile MUCH higher prob. to hit than
Dumbfire 40 m/s

But then, getting into that, you would probably want to factor in ship speed, and maybe even turning speed. An M2 gets hit a hell of a lot easier than my M5 (if both unarmed, mind).

Then emulating turret defense adds even more. I was thinking something along these lines.

MissileType being a small number, 0.5 for dumbfire, no more than 1.25 for best seeking missiles.

P(MissileHit) = MissileSpeed*MissileType/(NumTurrets*5) + ShipSpeed

Though, it should also take into account distance, somehow, but that might cause a lot of additional CPU.

I ran the numbers through my head with that equation with a few ships and missiles, the numbers came out fairly well to be honest. Strange considering I didn't put much thought into it. Only ran numbers through for 0.5 MissileType dumbfires, not seekers, though I bet it might hold up.

User avatar
wyvern11
Posts: 1703
Joined: Sat, 15. Jul 06, 20:59
x3

Post by wyvern11 » Wed, 29. Apr 09, 07:41

I can only state that oos damage calculation should not become too massive on calculations. original gun damage is taken from a single line of code

if this is blown up a lot, performance will definitely drop, at least during large and eventually lasting battles

I should post an excerpt of oos-combat-log to show how often NPC-to-NPC shootouts really happen (dont have one with me though).

concerning missiles:
- oos-fight of two ships should not take too much time (let's say 10 combat rounds)
- to achieve this the combatants have to deal out roughly a tenth to an eighth of their own shield strength of damage per round
- even a heavy torpedo will only add a further tenth to that
- in other words you might not notice the difference of actual behaviour (always hit) to new one (your p(missilehit))

I would probably completely leave out every missile dealing out less than say 50K of damage (Who cares what happens to a fighter / TS-class ship oos anyway?)

@gazz:
I would think to do some time-integration to get rid of bullet speed and firing rate altogether. we should decide which values go into the damage-dealing equation first

- is it target nimbleness (constant per shipclass/objectclass)?
- is it attacker nimbleness (...)?
- is it some classification of laserspeed ?
...

EDIT
if f.e. the probability to hit a scout from a destroyer is too low, then the M2 will be easy prey like in original system because i'm not too positive about multiple targets damageing
Redest du noch - oder denkst du schon ?

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Wed, 29. Apr 09, 10:42

wyvern11 wrote:concerning missiles:
- oos-fight of two ships should not take too much time (let's say 10 combat rounds)
- to achieve this the combatants have to deal out roughly a tenth to an eighth of their own shield strength of damage per round
- even a heavy torpedo will only add a further tenth to that
- in other words you might not notice the difference of actual behaviour (always hit) to new one (your p(missilehit))

I would probably completely leave out every missile dealing out less than say 50K of damage (Who cares what happens to a fighter / TS-class ship oos anyway?)
I'd actually prefer an at least simplified system for missiles.
Speed of the missile (ware) is known to the script as well as all flags like Swarm or Dumbfire.
With ship speed, missile speed, and number of turrets it should not be hard to get a hit %.
If no hit is calculated, the missile is removed from the cargo bay instead of fired.

This is far simpler then what ships use to determine which missile to fire in the first place.

I would think to do some time-integration to get rid of bullet speed and firing rate altogether. we should decide which values go into the damage-dealing equation first

- is it target nimbleness (constant per shipclass/objectclass)?
- is it attacker nimbleness (...)?
- is it some classification of laserspeed ?
...
Yeah. The factors I listed in the first post are just what is readily available to a script. I wouldn't want to use all of them. =P

I wouldn't use any kind of attacker maneuverability. If it has turrets, none of that matters. If it has fixed cockpit lasers, it's probably agile enough to line them up. (even M7 can... to a degree)
Maybe assign cockpit lasers a lower damage value to indirectly reflect that they hit less often. Their firing arc (for AI ships) is less than 180° and fighters spend most of their time flying away from the ship and evading instead of doing attack runs.

For the target maneuverability / size / everything, the ship object class should do. Little / big / huge ship.
M6/M8 are big ship, the rest are obvious.

The reason why I proposed 3 laser classes instead of 2 are the M6. They can very well be attacked with capital ship lasers.
The hit % is lower but PPC is perfectly able to shoot M6. MARS does it all the time.
They don't really fit in the other categories, either. For anti-fighter lasers they are too well shielded but for a capital ship they evade far too well to be lumped in the same category as M2.

if f.e. the probability to hit a scout from a destroyer is too low, then the M2 will be easy prey like in original system because i'm not too positive about multiple targets damageing
As outlined here,
http://forum.egosoft.com/viewtopic.php? ... 49#2864449

a "return fire" system could let the M2 fire back whenever a fighter has attacked. This would be triggered directly by the fighter's attack script and eliminate the need for "multi-target" capability and far more complicated attack scripts.
Maybe limit this ability to "light lasers" to add an incentive to equip an M2's turret with anti-fighter pea shooters.
Since light lasers wouldn't have massive firepower, this "always fire back" may not alter total firepower that much.
Could limit the return fire to the number of "light turrets", reset every time the M2 itself fires at something, but I don't think that bit of complexity is necessary.

Under the current system, if 20 fighters attack an M2, 19 of them are completely safe in the first round because the M2 can only attack one of them. Ergo you always get 20 combat rounds with an average of 20 attacking fighters.
What I'd like to see is that something like an Osaka outfitted with Flak all around would do better against fighters then maybe a Python.
Last edited by Gazz on Wed, 29. Apr 09, 12:23, edited 1 time in total.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

User avatar
wyvern11
Posts: 1703
Joined: Sat, 15. Jul 06, 20:59
x3

Post by wyvern11 » Wed, 29. Apr 09, 12:22

OK, then

a step earlier than

"what is possible to do" :

"what does one want oos to have maybe regardless if it is possible"

return fire sounds good!! fighter defense really s****. From a tabletop-game-viewpoint this would look realistic: fighter screen guns work independently from the artillery
Maybe limit this ability to "light lasers" to add an incentive to equip an M2's turret with anti-fighter pea shooters.
I'd find it clever to limit pea shooters exactly to peas and big guns for big targets - this is easier and everybody would understand it. Fit a Destroyer with cap-ship-weapons only, you better think of a fighter cover...
Redest du noch - oder denkst du schon ?

MutantDwarf
Posts: 711
Joined: Tue, 20. Jun 06, 02:29
x4

Post by MutantDwarf » Wed, 29. Apr 09, 15:03

In your script for returning fire on fighters, it shouldn't be just the ship that was attacked that returns fire - it should also check other ships in the same battlegroup and see if they can fire on the fighter as well, should it survive the initial return fire volley. This way you could have dedicated fighter-defense ships protecting big M1s or M2s with primarily anti-capital weapons.

Of course, this would only save runtime compared with a script that searches for all targets if there's a quick way to parse through a battlegroup looking for anti-fighter ships. This should be possible, however - you could pre-load that information before a battle.

This also might be a good part of the script to limit to battles involving Player ships.

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Wed, 29. Apr 09, 16:50

MutantDwarf wrote:In your script for returning fire on fighters, it shouldn't be just the ship that was attacked that returns fire - it should also check other ships in the same battlegroup and see if they can etc. etc.
No.
A complete redesign of the ES combat scripts is not the intention here.

Return fire (does this or reactive fire sound better? =)perfectly fits into the current system without requiring the least bit of target searching/evaluating/chosing.
The things you want lead to the CPU load growing exponentially with the number of ships "in range". The plain return fire system only grows linearry.

If you have a vision of a completely different concept of combat, warm up your scripting skills!
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

MutantDwarf
Posts: 711
Joined: Tue, 20. Jun 06, 02:29
x4

Post by MutantDwarf » Wed, 29. Apr 09, 18:40

Not the way I described it - it would only grow linearly. The 'attack' script first has the ship it attacked return fire, then will check a pre-defined set of antifighter ships that are in the same group as the attacked ship, determine if they're in range, and then have them return fire as well. Yes, this will increase the number of script calls - but not exponentially.

This would only be exponential if ships returning fire called the 'return fire' portion of the script themselves, but I didn't think they would. Then again, that might be something you'd like to keep.



Another way to reduce the CPU load would be to stick fighters into groups that all act the same way. This would work a lot like in Homeworld 2 or some other Real Time Strategy games - the script calculates weapons, attacks, damage, etc as if all the fighters in a group were just one single ship. When the fighter group is attacked, damage to it would be assigned more or less randomly through the group, and if one fighter in the group dies then you remove its weapons from the group's total weapon capacity.

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Wed, 29. Apr 09, 19:33

MutantDwarf wrote:Not the way I described it - it would only grow linearly.
You basically want firing at targets of opportunity. Whether in a return fire situation or at another time makes no difference for that purpose.

If 2 fleets of 4 ships each fight each other that's 4 x 4 checks = 16. (give or take a few)

For 2 fleets of 50 ships each it's 2500 checks every combat round since every attack of ship 1-50 could lead to a counterattack (that is the word I was looking for!) by 50 other ships.
Trying to cap exponential growth like that would add another layer of overhead which is simply not needed if a less fancy linear system is used.

MutantDwarf wrote:Another way to reduce the CPU load would be to stick fighters into groups that all act the same way. This would work a lot like in Homeworld 2 or some other Real Time Strategy games
Like I said. If you wish to completely rewrite all X3 combat scripts from the ground up, that can be on your feature list.
Right now the basic concept has the wrong structure for this.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

User avatar
wyvern11
Posts: 1703
Joined: Sat, 15. Jul 06, 20:59
x3

Post by wyvern11 » Wed, 29. Apr 09, 20:54

N=35631 oos-hit-events, regular playing, sinza on and off

- average delta time dt between two oos fighting events (NPC-ships only):

dt=0,95sec playing time

- 96% of all delta times are less or equal 3 seconds playing time

- roughly 17000 events have dt=0 - two simultaneous hits


This does not leave much space for security waits. to be on the save side I'd think the damage calculating script should terminate well below half a second - not much loops and array lookups possible.

If more player ships are involved - things are different :

generated a fight in every possible sector (2M6 against a destroyer), maximum parallelity count :

playing time - no of events in this second
627873 71
627866 67
627871 67
627867 65
627870 65
627899 60
627898 59
627897 58
Redest du noch - oder denkst du schon ?

User avatar
ezra-r
Posts: 3420
Joined: Fri, 14. Oct 05, 21:04
x4

Post by ezra-r » Wed, 29. Apr 09, 20:58

first I apologize for my clueless non-technical feedback as I am just a player and know nothing about developing but I'd like to say....

Should/Could it be made much slower to allow player reaction in many cases too?

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Wed, 29. Apr 09, 21:06

ezra-r wrote:Should/Could it be made much slower to allow player reaction in many cases too?
This sounds more like a case for the (Reunion) Navigation Override System.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

User avatar
wyvern11
Posts: 1703
Joined: Sat, 15. Jul 06, 20:59
x3

Post by wyvern11 » Thu, 30. Apr 09, 07:27

I doubt it could be made slower. Given the rate of oos-events I found out (see my last post), it would be likely, that over playing time a buildup of unresolved oos-battles (NPC-NPC and Player-NPC) would occur.

Maybe I can find some solid numbers as to how long a given battle has taken (capital ship battles terminate soon, because of the massive amount of damage done)
Redest du noch - oder denkst du schon ?

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Fri, 1. May 09, 13:56

Well, your armageddon scenario might be a problem but at the same time - proves that it isn't. =)

The fact that you got the count at all means that X3 did manage to execute those 65 library calls (a.fight.script.fire) per second while running the rest of the game.

The OOS "tabletop" game I am thinking about should be roughly the same number of lines.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

User avatar
wyvern11
Posts: 1703
Joined: Sat, 15. Jul 06, 20:59
x3

Post by wyvern11 » Fri, 1. May 09, 20:58

glad I could make you happy on may day. actually i was quite impressed about the possible parallelity (given the 14000 odd scripts running elsewhere)

my doubts were expressed about slowing down the battles to allow player influence (the buildup occuring due to waitstates, not to lagging). i'm quite sure, that there exists a slim and effective way to genialize oos-combat that it better reflects combatant strength.

(else i wouldn't be here ;-)
Redest du noch - oder denkst du schon ?

Snakeegg
Posts: 282
Joined: Sat, 27. Sep 08, 04:51
x3tc

Post by Snakeegg » Sun, 3. May 09, 19:58

At first, excuse my bad english (maybe I haven`t read this thread always correctly)!

I have an idea and maybe it`s usefull (I have no idea of scripting),if practicable.
How is it about divide larger ships in several parts (possibly orientated on the number of turrets), so that the ship only is killed, if all "parts" of it are killed. The effect is , that those horrible one-hit-wonders are very less possible. Also possible, that these "parts"(turrets) fight like a single ship - 1 hit/round.

Gruß (greetings) Snakeegg!

P.s.: @Gazz: Falls mein englisch zu unverständlich war, könnt ich`s nochmal auf deutsch versuchen.
Sorgfältig ausgesuchte Scripts erhöhen den Spielspass !

orion84
Posts: 162
Joined: Thu, 30. Apr 09, 16:14
x4

Post by orion84 » Tue, 5. May 09, 05:07

Good day Gazz, quite a quest you've got going. I'd just like to add my 2 cents. You can use all or parts of it, i don't really care, i just hope it sheds a little light. Or don't use it at all. Hahaha.

Using a scenario to make tweaks and find potential exploits will help. For me and some other players, OOS is something that gives a little back to the poor AI, since they will lose almost all the time IS. I don't want whatever comes out of this to exploit the AI further making it too easy.

So the constraints:

1. KISS - keep it simple and stupid (and economical)
2. to try and replicate IS combat

Simple Scenario: You're looking at your weed megaplex in Split Fire, you've got 2 Boreas on sector defense, positioned on the north and east gate, named alpha and bravo respectively. They're camped out on the gates with defend position. You've got another Boreas near the center of the sector named Stupidhead with command: attack all.

Then a number of blastclaw pirates go through the south gate. First its a wing of 4, but more keep coming. By this point, Stupidhead throttles its engines to engage the threat, with alpha and bravo sitting nicely by their gates. As Stupidhead closes the distance, you soon realize that 30 blastclaws have come through the gate, and are beelining towards stupidhead.. the nutter. Enter combat.

Combat
*I've been thinking about it over and over and maybe it would be a better idea (following KISS principle) to go ahead and let all turrents fire. why? In the above scenario, at one point during combat, ALL turrets will eventually be firing at the swarm of M3's.

To simplify damage done in accordance to laser category, without having to code too much instructions for range/projectile speed, and to deal with large and variable sized ships (Pheonix in mind), damage is dealt over an area circumferential to the ship. How and why?

In the above scenario, no matter what the size of the ship, the icon that represents it is a constant. And more often than not, a M2 with gauss cannons will not fire on the target until it the icons overlap each other. Having a pheonix and boreas in the same room shouldn't matter, all M2 classes have their own range. This can also reflect actual IS situations as pilots in fighters won't engage their weapons until in firing range. So a table can be made. Grouped by ship size

*rough but can be adjusted*
M1 = range of 10km to account for launching fighter escorts (carriers should play a more AWACS role)
M2 = 6-7 km radius
M3,M4,M5 = 2 km
M6,M7 = 4 km
-leaving M7M/M8 out because this is another thought that needs tackling as well.

This table will form the ceiling for damage rolls that will be done in the 5 second combat roll. Using this range can negate the need for laser speed/range/etc because realistically, once you're within range of a destroyer's turrets, and you're in an M3, you'll be strafing to get in firing range. This table will be the called the combat area of the ship. Ships without targets in this range effectively cannot enter combat for that 5 second round. This should give larger ships the advantage to hit targets as they close in.

Back to the scenario: "fortunately for Stupidhead whose outiftted for OOS defense (PPC all around), the pirates are coming in a steady stream, with 1 km or 2 between every wing of 4-7. However, the range of his PPC does not play into the ensuing combat."

In a regular OOS, the boreas might win with barely a scratch on the paint, but in IS the captain might do a little more than sweat.
-hence-
The range table should allow larger ships to use the larger weapons to an obvious advantage.

ok, now lasers. the goal i had in mind was to let weapons do what they're supposed to, and bring they're strengths and weaknesses to the OOS table. Keeping in mind range tables as MAX range for a ship that can mount a laser in a turret. A laser can simply subtract from this value to provide semi-realistic weapon usage (e.g. M2 outfitted with PBE as compared to PPC) I like the idea of classifying lasers as either light or heavy. perhaps throw in a medium for the M6,M7 weapons.

To balance combat, I believe in keeping the current system and let ALL LASERS HIT ANYWAY. Let me explain... A laser can hit many targets, in OOS this number can be restricted to size, AND how many instances of damage_to_be_dealt are rolled per combat round.

PPC are slow but huge damage dealers meant for cap ships. However a player would never commit a sole M2 to fight 3 M2's.. So while PPC accuracy will hit their targets, they will be limited to how many targets they will actually hit. Suppose XL weapons or heavy weapons are only given a number to decide how many targets the salvo from these weapons will hit. Lets say that its only 2, it might be able to bring a little realism. And in a 5 second round, it can only be allowed to fire 2-3 times.
So damage calculation during a round can be summed up as damage to be dealt.

back to the scenario: "with stupidhead kited out with PPC, he makes short work of the first ship in range, making you think twice if it ever existed.. the remaining 3 in the wing are able to deal their damage -> slight shield drop in stupidhead"

Now although its unreal to give each PPC in the universe 2 targets. But with the combat area, the number can be applied to the range of the ship, targets within that range, with all PPC firing, and only being able to hit 2 targets in that round of combat, only being able to fire 2-3 times per round.
*what it would look like, guesstimates*
if, 1 PPC = 10k shield/hull dmg
10 PPC = 100k damage
then, 2 salvos per round, 2 targets per round
200k worth of damage to be distributed evenly among 2 targets at a ship range of 7 km.. rendering the incoming fighters into dust before they can enter combat
*the number can be adjusted or played with for better accuracy*
*threat acquisition to be discussed later*

Result: Go forward PPC's when faced with a cap ship, as the loadout only hits 2. So against 30 blastclaws? might take some many rounds.

So a boreas being attacked by 4 blastclaw is an obvious win in this combat system, because in 10 seconds, effectively the threat is destroyed.

Where's the balance? To keep the player wanting to use anti-fighter weapons for fighters. The number of salvos per round and the number of targets that can be hit increase with the decrease or "lighter" class of weapon. Suppose FAA/CFA were outfitted. To account for speed/range lighter weapons such as these can hit twice(?) as many targets, or triple, or quadruple (whatever adds balance), while reducing the range that the weapon can fire. (PPC in front, flak on the side -> PPC will take out the first 2 M3's in one round, more M3 close distance to firing range, PPC take out two more, and flak start dealing damage while M2 starts receiving it... effectively 2 rounds of combat)

Result? While mounting ppc on a M2 on sector defense might kill 2 fighters every round, the overkill that these weapons do to fighters might be thought over, considering mounting flak instead can do more appropriate (albeit smaller) damage to more targets.

in effect, this new OOS combat has 4 rules.
1. combat area (range of ship/as the ceiling, or base, whichever you fancy)
2. Weapon range/damage on ship per round
3. all weapons fire and hit 100%
4. Combat is entered/left using rule 1 ship range.

Now i thought up a little more to tweak target acquisition/threat assessment to give a little more functionality to the player and his assets but i want to see what you think first.

I obviously don't know how to code, but i do have a rough logic going. Again 2 objectives is to provide a decent balance and to keep it simple, without having the computer go through too many instructions to be an effective OOS combat system.

Good luck to me, and hope you can keep up with the logic. Now if you feel that I'm not posting any help, keep in mind my lack of scripting knowledge prevents me to understanding you any more than your desire to improve OOS combat. So, if nothing here helps you then thats ok, but what you can do is use the idea to further your own development of ideas for this script.

Cheers!
***modified***

orion84
Posts: 162
Joined: Thu, 30. Apr 09, 16:14
x4

Post by orion84 » Tue, 5. May 09, 07:48

Combat Revisited

In retrospect, i was trying to aim for a table top combat play like Magic The Gathering. Combat was resolved in 3 phases, ending one round or turn, with it being as simple as possible. for those unfamiliar:

1st phase: declaring attackers/defenders
2nd phase: application of specials/instances/special conditions
3rd phase: conclusion/resolution

In theory, scripts required to do all of that can be summed into one round of OOS combat. With it repeating until either party in combat is destroyed/fled.

It might be simpler to keep damage and damage affecting factors to a minimum, focused on player assets, to minimize CPU load.

I don't know how mounting different weapons on a ship and then calculating damage will affect CPU load if any additional load will be introduced.

What i didn't mention earlier in regards to this idea was target acquisition/threat assessment.

Threat Assessment/Target Acquisition

To reinforce some of the ideas mentioned in my earlier post in regards to combat, a simple measure on the part of the AI pilot can be used to assess targets and choose its fire.

Since a table will exist to categorize ship classes, the same table can be used as threat assessment. Since a PPC/GC and other XL weapons can only hit 2 targets in a given round, the player ship can do a check to see what the biggest threat is and fire on that instead.

--> i'm actually borrowing this idea from Azz's PilotAI for X3:R which improved OOS combat to a more sensible level.
http://forum.egosoft.com/viewtopic.php?t=182897

what i'm taking is just threat assessment. The leader of a wing, regardless of composition, or lone ships, can make assessments of the targets within its scanner range (which can be toggled by the current command its been issued, e.g. attack all, blah blah) Using this can enhance the combat system without adding too much load: the bigger the ship, the higher the threat. Total threat is a concept that could be used but i don't think its too important right now. Supposing the enemy formation had a M7 in front of 8 M3's, and you had a lone M2. Once enemies enter scanner range, the M2 can immediately identify the M7 as the larger threat, and will use the PPC's it has to focus its fire on that target. Assuming 2 targets per salvo for the PPC's, using the threat assessment the pilot will choose to allocate damage from the PPC's all towards the M7, since it is the larger threat of the entire flotilla. If the M2 is equipped with different weapons, the pilot will still aim all its armament at the M7. This will apply each round until the target is removed from combat one way or another. Once removed and if the M2 is still standing, it will use its remaining armament to go down the ladder of threats and equally distribute the damage following weapon rules (PPCs hit 2 fighters per round).

At least this will prevent the M2 from chasing an M4 with a bigger ship in the combat area.

*Wingmen/escorts already follow their leaders in dealing with targets so there's no need to run any special codes for them.*

In terms of scaling this skirmish to a larger one, and i'm assuming the average player doesn't just dump 10 M2's in a sector with commands attack all (but even then the threat assessment will all lead to the same conclusion) i don't think it might put too much strain on the clocks.
***modified***

User avatar
wyvern11
Posts: 1703
Joined: Sat, 15. Jul 06, 20:59
x3

Post by wyvern11 » Tue, 5. May 09, 10:49

@gazz
The OOS "tabletop" game I am thinking about should be roughly the same number of lines.
lets hear what you're thinking about :wink:

concerning cpu-workload: one has to take into account the load generated by the regular "..... fire lasers on target ..." as well. internal logoc must at least do a weapon-array-loop, a random(5), a random(30), an erroneous ammo-check, an erroneous turret multiplication and some summation for shield and hull damage.

roughly the same calcs should be possible in a script without having much more workload to do (assuming script logic not to be much slower than inbuild logic)

@all : some summing up of arguments

oos how it should work
- should have a predefined matrix of weapon with set of parameters like damage(-class), range(-class), target-of-choice, possibly effectivity modifier per ship class, possibly bullet speed(-class).
- for balancing reasons this matrix might be made up from scratch
- for workload reasons matrix should have as few parameters as possible
- return fire should probably be used, if feasible.
- if so return fire should probably have a target-count limit / hit rate below 1 that large fighter groups get a chance for balancing
- fire control should probably assign targets as most dangerous first

feel free to add details, discuss, oppose or affirm summary
Redest du noch - oder denkst du schon ?

MutantDwarf
Posts: 711
Joined: Tue, 20. Jun 06, 02:29
x4

Post by MutantDwarf » Tue, 5. May 09, 11:20

I've come up with what I think is a pretty good way to determine how many shots hit in Out of Sector battles. It's very quick to calculate at runtime and should be relatively accurate to boot.

Below the damage calculation bit I included some thoughts on target selection.

Damage Calculation in OOS Combat
This is inspired by the GURPS pen-and-paper role playing game.

Each laser will have a precomputed Accuracy Modifier (Acc)
Each laser will have a precomputed Rate of Fire Modifier (RoF)
Each ship will have a precomputed Size Modifier (SM)
Each ship will also have a precomputed Handling and Speed Modifier (Hnd)

Acc should be computed based on bullet speed and laser range
SM should be computed based on ship size
Hnd should depend almost entirely on ship maximum speed


The Primary Equation
%Hits = (3d6+Acc+RoF+SM-Hnd-11)*100/(RoF*2)

The only thing that needs to be calculated at runtime are three random variables. 3d6 means '3 random numbers with a uniform distribution between 1 and 6' or, put more simply, '3 six sided dice'. You use 3d6 in order to ensure a normal distribution. In player-involved battles, I would use this method – the randomness helps make it more accurate. Alternatively, you can drop the randomness entirely and make the calculation:

%Hits = (Acc+RoF+SM-Hnd)*100/(RoF*2)

The second calculation results in slightly more damage overall (average of 3d6 is 10.5, not 11), but the simplicity helps its case. It also, however, makes it impossible for some ships to ever hit their targets when in reality they’d have some small chance of hitting, while some other ships will always be hit and damage quite a lot when they’d normally have some small chance of evading some of the damage.

The maximum %Hits is 100 and the minimum is 0

The amount of damage done is DPS*%Hits*RoundLength


I would not include Area of Effect damage - it's too difficult to deal with. Other special damage effects (PBGs, specifically) might need some special treatment, but I don't think it should be too hard to adapt - I don't have enough experience with X3TC to say how, as I haven't used those special weapons yet.


SM and Speed/Range Modifier
SM and the speed/range modifiers should follow this progression:

3: 1
5: 2
7: 3
10: 4
15: 5
20: 6
30: 7

That way, if a ship has a speed of 300 meters/second, it would have a Hnd of 13, while a Goner Aran with its ~10 meter/second drive will have a Hnd of 4. Meanwhile, an M5 with a size of 30 will have an SM of 7 while an M2 with a size of 2,000 will have an SM of 18. A laser with a range (adjusted for the ship it's installed in) of 3000 meters will have a range modifier based on a range of 3000/2 = 1500 meters, to get an estimation for average engagement range. That range modifier would be 17.

The Acc modifier for Bullet speed should also follow this table.


Rate of Fire Modifier
RoF should be based on the following table:

1-2: +0
3-5: +1
6-11: +2
12-24: +3
25-49: +4
50-99: +5
100-199: +6

And so on - each doubling increases RoF by one. RoF is based on the number of lasers in the turret as well as the RoF of the laser basetype - so a laser that has a nominal RoF of 200 that's put in a turret with seven other lasers of the same type will have an RoF based on a 1600 shot/second rate of fire. That 1600 shot/second rate of fire yields an RoF of +10.

A further note: Rate of Fire should be scaled based on the size of the ship's power generator. If it can't sustain a full RoF barrage, simply limit its RoF to the number of shots per round it can sustain. This change in RoF will then directly lead to lower amounts of damage done.


Example One – M5 Discoverer versus M3 Nova
Here's an example, with a 20 meter M5 with four IREs firing at a 30 meter M3 using ten second turns:

IRE Range = 1390 + 2/3 * 20 = 1403 m
(we add the 2/3 * 20 because bigger ships can have larger range)
IRE Bullet Speed = 1162 m/s
IRE Rate of Fire = 400 shots/m = 6 shots/s = 60 shots/turn
IRE Shield Damage = 220

M3 Nova Size = 30m
M3 Nova Speed = 190 m/s


Acc = 16 (Bullet Speed) - 15 (Range/2) = +1
RoF = +6 (240 shots/turn)
Hnd = +11
SM = +7

%Hits = (Acc+RoF+SM-Hnd)*100/(RoF*2)
%Hits = (1+6+7-11)*100/(6*2) = 25%

25% of all shots fired at the Nova will hit, meaning it will take: 220*240*0.25=13,200 shield damage


Example 2 – M2 Tyr versus M5 Discoverer
If this was a Terran M2 firing 6 PSPs at the 20m M5, it would be something like this:

PSP Range = 6420 + 2/3 * 2000 = 7753 m
PSP Bullet Speed = 321 m/s
PSP RoF = 6 shots/m = 0.1 shots/s = 1 shot/turn
PSP Shield Damage = Who cares? One hit and the M5 is fried

M5 Disco Size = 20m
M5 Disco Speed = 346 m/s

Acc = 13 (Speed) - 19 (Range) = -6
RoF = +2 (6 shots/turn)
Hnd = +13 (Speed)
SM = +6

%Hits = (-6+2+6-13)*100/4 = -1100/4 = -275%

There is no possibility that the M2 will hit the M5 with his PSPs.


Example 3 – M2 Tyr versus M2 Kha’ak Destroyer
On the other hand, if he was firing on a Kha'ak M2:

Kha'ak M2 Size = 2000
Kha'ak M2 Speed = 63

Hnd = +8
SM = +18

%Hits = (-6+2+18-8)*100/4 = 600/4 = 150%

All 100% of the fired shots impact the target.





Target Selection
For NPC battles, I'd also use Gazz's idea of returning fire to simplify target-selection and fighter suppression, with a limit on the number of times a ship can return fire in a round.

For player-involved battles, I'd like to explore a more intelligent target selection method, however - have each turret independently select targets and remove the return fire bit, because returning fire in that fashion will result in a higher perceived RoF than the ship is really capable of producing, especially if each turret is able to choose its own target.

I'm thinking a priority queue implementation for target selection might not be a bad idea. Have three separate queues - one for Huge Ships (M1, M2 types), one for Big Ships (M6, TM, maybe TL types), and one for Small Ships (Fighters). If you can, you want to focus all of your fire on the target that can do the most damage but has the lowest durability - and you want all of your turrets and ships capable of engaging that target to focus on it, too. The Priority setting in each Queue will be DPS/(Shield + Hull Strength) - the ship that can do the most damage for its hull strength will be at the top of its queue. Each laser will be optimized for Huge, Big, or Small Ships - this should be based on Acc, RoF, and damage per shot.

Once combat is joined, I would ignore range, so long as the current range to target is below a certain amount - say, ten or twenty kilometers. If the highest-priority target is more than ten kilometers away, then it can search for a lower-priority target of opportunity. If a target is destroyed, it is removed from the priority queue and the next ship/turret in the sequence will target the ship with the next-highest priority.

If a ship/turret is capable of destroying its current target in less than one full RoF barrage, it should be able to split its RoF between multiple ships – this way a Terran M2 kitted out with a full load of SSCs can blow away entire waves of M5 ships in its ten-second turn, and things like that.

It might be a good idea to ignore missiles in Out of Sector combat except for M7Ms and M8s – in those cases, I’d use a script very similar to the Missile Turret script here: http://forum.egosoft.com/viewtopic.php?t=245070

If you don’t wish to ignore missiles, a more complicated script for determining when to fire missiles and which missile to fire is probably required – and determining if that missile hits or is blasted away by missile defense is yet another thing to be worried about. The Missile Turret script is probably a good start.

This does bring to mind a solution to the ‘attack signal’ problem, however – since missiles hit instantly with a 100% success rate, have any ship that fires on another ship in a round also fire a very low damage missile at that target. This way SIGNAL_ATTACKED is thrown.

orion84
Posts: 162
Joined: Thu, 30. Apr 09, 16:14
x4

Post by orion84 » Tue, 5. May 09, 13:38

I used to play GURPS. haha. Anyway..

For reference for future posters, etc. I'll add this just in case anyone needs a background into OOS.
http://forum.egosoft.com/viewtopic.php?t=182101

I think missiles can be handled if ever there is a matrix for the kind of laser mounted on a turret. Take for instance the damage tables presented by MutantDwarf, particularly RoF. Since missiles will always hit in the current system, any new OOS system that implements a more efficient damage distribution based on weapon/laser stats can be used as a base for dealing with them. E.g. a higher RoF could introduce a percentage that the missile will have to roll against to score a hit.. damage follows. This can be adapted for swarm missiles as well as each warhead will have to roll against this modifier. In the end, its a bit respective to actual IS where a good fighter pilot with no turret can use smaller lasers to shoot missiles.

Using RoF: Higher RoF, higher chance of shooting a missile down, since current turret command of missile defense will ignore the current target and fire at an incoming missile if there is one.
wyvern11 wrote:oos how it should work
- should have a predefined matrix of weapon with set of parameters like damage(-class), range(-class), target-of-choice, possibly effectivity modifier per ship class, possibly bullet speed(-class).
- for balancing reasons this matrix might be made up from scratch
- for workload reasons matrix should have as few parameters as possible
- return fire should probably be used, if feasible.
- if so return fire should probably have a target-count limit / hit rate below 1 that large fighter groups get a chance for balancing
- fire control should probably assign targets as most dangerous first
I think what could also be considered in deciding how OOS should work is:

-System should allow flexibility for the player to decide what and how to deal with OOS battles.
Ideally, pesky situations of OOS stems from the circumstances player assets are put onto the "table" along with what commands said assets are given. And also i want to avoid heavy reliance on big ships for OOS, since in the current system a decent sized wing of M3's attacking targets of a big meat shield (M7) can stop anything (which for me solved my OOS problems). Losses are still expected but not as painful as a purchased/capped M2 :evil:

-the return fire would work great for non-combatants (ts,tp,tl,etc) being attacked, since it would give them a "fighting chance". However combat should be avoided anyway.

------

@wyvern11, gazz, or anyone with experience in streamlining thread/instruction execution

What would be more economical on a machine? With the "table-top" approach, a simple and economic way it can be reproduced could be:
1. Combatants "square-off" with calculations and rolls done based on pre-defined tables before actual combat to get the many values and parameters that will be used to derive damage received, e.g. damage to hull ratios, shield resistance, armament matrices, missile supply, blah blah. Kind of like a "i showed you mine, now show me yours". Since we seem to be leaning towards using current seconds to measure rounds with a respite between rounds. And then at the end of the round damage is effectively dealt.

2. Combatants' armaments, stats, etc produce micro-instructions that allow for things like first-strike (destroying a target before it had a chance to fire, M5 vs M2), affecting maneuverability and presenting evasion variables against weapon speed. Weapon speed against craft agility, etc etc. Generally would give OOS a more real-time, and coincidentally a more realistic approach.

3. Since table-top combat has been around, maybe we could shop around for a type of system in current use and just implement it to suit the current environment of the game? Cardgames? Warhammer? GURPS? D&D? Hahaha. Clues could be lying around somewhere in there.

Cheers.
***modified***

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”