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
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Tue, 28. Apr 09, 23:53

wyvern11 wrote:my opinion is Keep It Simple and Stupid:
It has to be KISS to have any hope or working for all OOS fights.

- one should agree on a balanced table of weapon damages (we should make that one up from scratch probably, no firing rates perhaps)
I wouldn't want to calculate all weapons at runtime.
Every X minutes (or based on other conditions) a ship is evaluated and the weapons divided into light / medium / heavy lasers.
Maybe just light / heavy if we can simplify it enough.

- since there is no direction oos we should postulate that 2-3 turrets have the target in firing arc
Can do that even easier. Every turret has a 180° firing arc so there is a 50 % chance it can fire. =)
ship firepower = ship firepower / 2
- we should not put too much stress on range - those shooting further than 2K are long range, other short range

- base damage should be calculated as average over all guns in arc in range * no of guns in arc in range

- multiply a random, say 3-8

- get the initial table such high, that 3-5 average hits kill an opponent ship of same class
If we dump all lasers into the 3 afforementioned classes we have something like tabletop tules.

If a ship has
120500 DPS heavy lasers,
30200 DPS medium lasers,
28000 DPS light lasers,

then object class "small ship" would get hit fully by the light lasers, 30% chance for med lasers, 10 % chance for heavy.

big ship gets hit at a 30 % chance with heavy, fully with med + light lasers.

2 or 3 dice rolls and the combat round is done. Maybe work with flat damage values and incorporate the randomness into the hit percentage, avoiding another step.

Each of the 3 laser classes should have it's own laser range because "small" lasers could be anything from <1 to over 6 km.
Some weapons like Lasertowers need their proper range of 6km to be useful at all even though their laser is a "small" one.

OOS in vanilla is extremely random and rather unlucky for ships larger than a corvette because even corvettes have a good chance for a crippling hit on a destroyer.
Exactly. I'd like to avoid an M2 getting instakilled by an M6 that conveniently fits into the M2's galley.

if you special balance some given ships at least some people will find their favorite craft outgunned / overpowered
Prefabricated tables for lasers or ships are a bad idea.
Rules and formulas can build a sturdy system without creating a maintainance nightmare like individual damage tables for 300 shiptypes.
Last edited by Gazz on Wed, 29. Apr 09, 00:03, 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, 00:03

lets see
If a ship has
120500 DPS heavy lasers,
30200 DPS medium lasers,
28000 DPS light lasers,

then object class "small ship" would get hit fully by the light lasers, 30% chance for med lasers, 10 % chance for heavy.

big ship gets hit at a 30 % chance with heavy, fully with med + light.
expectancy of damage per 5 sec for big ship is like
5s*0,3*120500 DPS + 5s*1*60000 DPS = 160000+60000 = 240000

this is
a) rather low (expectancy of combat duration is about like 40sec +)
b) small and medium lasers might seem overrated
c) difference between medium and small is very small - so one might possibly leave it out
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, 00:08

Oh, I completely made up those numbers.

What the exact numbers will be is another matter entirely.
Since a lot of laser bullets miss in combat, actual damage is a guesstimated 30 % of the theoretical laser DPS.
wyvern11 wrote:c) difference between medium and small is very small - so one might possibly leave it out
Yeah, it's the bullet speed difference between light lasers like Flak / PRG and medium ones like CIG / ISR (400-500 m/s)

The mediums would hit fighters somewhat worse but have a range advantage over approaching fighters and work well against M6 and M8.
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.

pelador
Posts: 1399
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by pelador » Wed, 29. Apr 09, 00:31

Dont forget missiles. Which Gazz did mention in the starting post.

I know that might not be very helpfull as is, but I think there is potential for including them more effectively OOS. So the stats need to potentially include them in design conceptualisation.

Dumminion
Posts: 38
Joined: Sun, 26. Apr 09, 22:22

Post by Dumminion » Wed, 29. Apr 09, 03:35

On a second thought, a factor of a complete miss per size of ship is more important, then fewer damage per ship size or ship speed.
Big ships should attack multiple targets per round, based on the number of turrets.
Missiles could miss 50% of the time. (This should'nt cost to much cpu time.)
Maybe bassed on missile speed?

How about the use of a second core to calculate the OOS damge model and add the result to the script engine? ^^

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 !

Post Reply

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