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: 12430
Joined: Fri, 13. Jan 06, 17:39
x3tc

OOS combat - how SHOULD it work?

Post by Gazz » Sat, 25. Apr 09, 21:07

We know that OOS combat is highly random with rare but ridiculously high damage spikes.

In order to replace the current system (fire lasers of turret null) there are several problems to overcome.
  1. get attacker
    Any "scripted" damage is not caused by THIS as far as the engine is concerned.
    Therefore, a ship can not respond to such an "attack", neither does SIGNAL_ATTACKED fire.
    set attacker may have to be used somehow to force the current attacker. No idea on the signal.
  2. Any DPS accounting/creating script must be highly optimised or it may use massive amounts of CPU power.
    Any realistic (aka complicated) system is hard to precompute.
  3. Creating damage:
    What damage is done, what hit percentage do lasers have, etc.

    Let's assume these variables are known:
    • Laser Shield DPS
    • Laser Hull DPS
    • Laser range (add 2/3 of THIS get size ?)
    • Laser bullet speed
    • Laser special type (PSG, Flamer)
    • Ship size
      Possibly important since a Phoenix' lasers have an extra 2km reach from the ship's "position"
    • Target object class
    • Target size
    • Target speed
    Should PSG cause AE damage and if so, how?
  4. Missiles.
    Right now there is no defense against them.
    A (dumbfire) Tornado will hit an M5 with 100 % certainty at 20 km range.
    A cap ship with 6 turrets has no chance to intercept even the slowest incoming missile.

    Stats known about missiles:
    • Speed
    • Range
    • all flags, such as Dumbfire or Swarm
The only system I can imagine to work is to precompute a simple damage table for each ship, then apply what's in there.
This table could be updated 1 (or less) minutes after the ship goes OOS, then rechecked once after 5 and 10 minutes.
After that, no more changes are to be expected.

As a result of that, does the OOS weapon changing of AI ships need tweaking to be competitive with "properly" equipped player ships?

What exactly such a table should contain is the big question...
The more that has to be dynamically calculated at runtime (during combat) the bigger the slowdown.

Can weapons and/or targets be grouped into a few classes? If so, by which system?


I expect that cobbleing together a concept that at least works on paper will require more than a few bright ideas.
Oh, and vague white noise posts like "it should work like IS" are not going to be helpful. Thank you.
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
Sartorie
Posts: 384
Joined: Sat, 10. Apr 04, 13:05
x3tc

Post by Sartorie » Sat, 25. Apr 09, 21:45

One of the main problem OOS has is that it is turn based which means in every turn each ships fires once with all it's weaponry at their target. Ideally each turret should be able to fire on it's own so a M2 does not use up all it's firepower on a single M5.

Tables with precomputed damage / hit / evasion values are a good idea to keep math to a minimum. One important thing to consider is the ships laser generator - a weak generator should give malus to laser damage.

As for 1. you can send ships signals though I have never tried that with SIGNAL_ATTACKED

I am very interested what you come up with on this :) good luck

User avatar
apricotslice
Posts: 13649
Joined: Sun, 16. May 04, 13:01
x3ap

Post by apricotslice » Sun, 26. Apr 09, 15:09

Part of the trick is to mimic IS combat as far as how many ships are in range of the target to fire at any one time, and how many of those ships are headed away from the target and thus cannot fire.

Part of the problem is that oos now, 6 M3's all fire at an M2 at once, and the M2 fires at a single M3. But in IS, only 2 of those 6 M3's will be in firing range and pointing at the target, while the M2 could have 4 of the M3's targetted using different turrents.

So maybe what oos needs is some realistic randomising of the variables, so that some random realism comes into it.

Make assumptions of how many ships are in range and able to fire, how many are heading away and only have a rear turrent firing, and how many are in range of the targets various turrents.

So instead of 6 vs 1 per turn, its something random but closer to IS combat in how ships end up all over the sector while attacking, and who can fire on what when.

Also, guns need to be considered. PPC's cant hit a M5, and air's will not damage an M6. So this needs to be part of the equation.

If an M2 is wrongly kitted out for whats attacking it, it should be owned given enough time. But if its being attacked by M4's and M5's, and its kitted with rapid file rapid move guns, then it should wipe them quickly through sheer firepower. And an M2 taking on another M2, but loaded for fighters, should be history quickly.

pelador
Posts: 1230
Joined: Wed, 6. Nov 02, 21:31
x3tc

Post by pelador » Sun, 26. Apr 09, 15:16

SIGNAL_ATTACKED does work OOS but I have noticed it reverts very quickly back to current "jobs" on AI behaviour. But that depends on how the reputation levels are and what current job behaviour is set and how it respond as a result in vanilla.

So if a signal is used I imagine it needs to have AI "objectives" incorporated to fully respond to aggresive situations. But as Gazz points out this in effect removes the current AI behaviour. Wether that is relevant is another matter but may effect AL plugins or other behaviour if not incorporated.

However, applying it to one ship combat command process such as "attack all enemies" doesnt really make sense to me as it limits OOS capabilities. Ideally it needs to plug into all or "take over" ship behaviour for the duration of combat and revert. Which makes sense to me if its a task 0 interupt.

User avatar
Gazz
Posts: 12430
Joined: Fri, 13. Jan 06, 17:39
x3tc

Post by Gazz » Sun, 26. Apr 09, 18:21

pelador wrote:SIGNAL_ATTACKED does work OOS but I have noticed it reverts very quickly back to current "jobs" on AI behaviour. But that depends on how the reputation levels are and what current job behaviour is set and how it respond as a result in vanilla.
Being "the attacker" also depends on the amount of damage done and/or distance to the target.
I suspect that $Damage.Done decays over time.

None of that is accessible or even transparent to scripts.

The only workaround to properly simulate "correct" damage is to rearrange the installed lasers on the attacking ship, fire 1 turret with 1 small laser often enough to do $Desired.Damage, then rearrange the lasers back.
This would need to be done for every single shot.
Then a ship would have "done the damage" and the attacker/signal would be set apropriately.
And it would be a terribly crude and bulky system.

apricotslice wrote:Part of the trick is to mimic IS combat as far as how many ships are in range of the target to fire at any one time, and how many of those ships are headed away from the target and thus cannot fire.
Ship's orientation would be a royal pain in the bastu so I wouldn't touch it.
For fixed cockpit guns, use maybe 1/3 of the total damage and call it good.
Or full damage at > 2/3 Laser range, 1/4 damage below that.
That would already get complicated, though...
Best would be a flat fee of 1/3 damage for cockpit guns.
Maybe full damage for the first attack on this target. That would work.

For any turrets, divide the maximum firepower by 2. That all turrets can fire at the same target is silly.

Independantly tracking turrets would most certainly be a no go. This would inflate the previously 1 line of script into full blown target acquisition for targets of opportunity.
Hmm. Tabletop rules!
What could be done is allowing "return fire" if a ship (like a fighter) attacks a big ship with turrets.
During the fighters attack (well, directly after), the big ship could do a little return fire.
That would implement multiple target acquisition and tracking without having to do any... acquisition and tracking. =)

Kinda like an action point system like in UFO/Fallout/Jagged Alliance.
OOS turns are kinda long. It can take 10 or more seconds between fire orders.
Time elapsed since last shot is easy to find.
So... If cap ship has fired 5 seconds ago it would have a potential 5 seconds of fire available at this moment if it got it's turn now.
If a fighter attacks it, the cap ship gets 1 second of return fire, adding 1 to the time when it fired the last shot.
So for all following calculations it has now fired 4 seconds ago and 4 action points available for attacking something.
And lets face it - 1 second of fire from an M2 is plenty to worry an M4 pilot.

This would give cap ships "multiple target capability" without creating an instant killing zone around them because each shot of return fire at a missile or fighter substracts a sizable chunk of it's firepower.
Last edited by Gazz on Sun, 26. Apr 09, 20:47, edited 2 times 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.

pelador
Posts: 1230
Joined: Wed, 6. Nov 02, 21:31
x3tc

Post by pelador » Sun, 26. Apr 09, 18:29

Indeed we could really do with a "get last damager" and an associated signal for each itteration in the script engine.

Accidents and other damage not directly related to combat I assume would be overlooked however OOS due to collision avoidance so would the damage amount be irrelevant for threat recognition, as its a case of wether the ship is simply attacked that a responce to a threat is required? (Hence use of SIGNAL_ATTACKED to a custom process to only apply if OOS).

Correct me if I'm wrong however, I imagine you have the best combat experince with weapon useage. But just wondering if the above might simplify threat recognition OOS. After all simplicity is key for scalability as there are more OOS sectors than IS.

someone else
Posts: 2970
Joined: Sun, 18. Jun 06, 13:37
x3tc

Post by someone else » Sun, 26. Apr 09, 19:43

I want to see a better OOS fight!!!

just a thought... I'm not a scripter nor a modder... but... this is my idea:

maybe you can implement a more CPU draining (and thus more realistic) OOS script used ONLY for combat involving Player owned ships OOS, and leave the crappy Egosoft scripts to run for the NPC-only battles that the player will never see.

How much player owned ship can fight OOS? not a lot! = not a lot of CPU drain.

feel free to ignore me if it's stupid... :D
Trade, Fight, Build, Think, Modify.
Ship Rebalance Mod
OOS Rebalance
Resized Aldrin Big Rock
SIDE/TOP/FRONT Ship Size Comparison
Remember young Padawan: money stolen can be, time cannot.

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

Post by MutantDwarf » Sun, 26. Apr 09, 19:48

That sounds like an excellent idea. It woulds till require a lot of CPU power if you have huge numbers of ships all getting into OOS fights at once, but hopefully it won't be too much of a problem.

User avatar
Gazz
Posts: 12430
Joined: Fri, 13. Jan 06, 17:39
x3tc

Post by Gazz » Sun, 26. Apr 09, 19:52

someone else wrote:maybe you can implement a more CPU draining (and thus more realistic) OOS script used ONLY for combat involving Player owned ships OOS, and leave the crappy Egosoft scripts to run for the NPC-only battles that the player will never see.
That's actually a pretty good idea.
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
enenra
Posts: 6174
Joined: Fri, 8. Apr 05, 19:09
x4

Post by enenra » Sun, 26. Apr 09, 20:49

Gazz wrote:
someone else wrote:maybe you can implement a more CPU draining (and thus more realistic) OOS script used ONLY for combat involving Player owned ships OOS, and leave the crappy Egosoft scripts to run for the NPC-only battles that the player will never see.
That's actually a pretty good idea.
Though it would mean that the race military would still have no chance against Qs.

Maybe associate this new system also with certain ship types which are unbalanced in OOS combat?

User avatar
Gazz
Posts: 12430
Joined: Fri, 13. Jan 06, 17:39
x3tc

Post by Gazz » Sun, 26. Apr 09, 21:02

enenra wrote:Though it would mean that the race military would still have no chance against Qs.
Neither do Qs have a chance against race military ships. =)

Qs got their bad rep only because them fighting against cap ships is a common and therefore well documented occurrence and a Q with a good damage spike is annoying when observed by the player. =)
I bet that other races' M7 play in the same league.
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.

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

Post by Dumminion » Mon, 27. Apr 09, 01:50

Hi Gazz,

How about something like this?

:idea:
damge*(1 till 30) //egosoft has factor (1 till 150)
//this saves average 75 circles to compute
*(1+(0,2*numberturrets)) //egosoft is factor 1 for each turret
=shipdamge

:idea:
damge*(1 till 30)
*(1+(0,05*numberofgunsinturrets*numberturrets))
=shipdamge

:idea:
(damge
+(tdamge*(0,05*numberofgunsinturrets*numberturrets)))*(1 till 30)
*sizeoftarget //sizeoftarget (0.05m5 0.15m4... 1.0m
//(sizeship*speedofship)
=shipdamge

:idea:
turretdamge
*numberofgunsinturret
*sizeoftarget
=(tdamage*(1 till 10)
tdamage*numberofturrets=numberofattacks //4 turrets are 4 attacks

User avatar
Gazz
Posts: 12430
Joined: Fri, 13. Jan 06, 17:39
x3tc

Post by Gazz » Mon, 27. Apr 09, 11:19

Getting even remotely real damage values can be quite tricky...

Code: Select all

500 * PSG:
501 $damage.factor = ( $Target.Size * 3200 + 62000 ) / 1996

Code: Select all

536   *           Flamer
539   ||||if $Target.Distance>= 1150
540   *             Nearly no damage
541   ||||else if $Target.Distance>= 350
542   |||||$damage.factor = ( 1240 - $Target.Distance) / 15
543   ||||else
544   |||||$damage.factor = $Target.Distance/ 15
545   ||||end
546   |||end
This is a pretty close approximation of the multiplicator to apply to the "on paper" damage of PSG/Flamer.
I doubt this is quite usable for OOS. =)
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.

Fame
Posts: 32
Joined: Wed, 16. Aug 06, 22:58
x3ap

Post by Fame » Tue, 28. Apr 09, 19:07

maybe you can implement a more CPU draining (and thus more realistic) OOS script used ONLY for combat involving Player owned ships OOS, and leave the crappy Egosoft scripts to run for the NPC-only battles that the player will never see.
Using an table for firepower and shields in case it isn´t already in the game ( such as IS battle).

If there isn´t a person could make one. An example:

-Weapons

Impulse ray emiter, the most basic weapon, damage power 1.
Hept is 4X stronger, so damage power 4, and so on...

- Shields

1Mw shield can sustain an damage power of 1.
and so on...

- Distance

At a range of 1Km damage power with an Hept 4/1=4
At a range of 2Km damage power with an Hept 4/2=2

And so on for all class of weapons and shields.
If weapons power > shield = ship destroyed

If there are 2 fleets in battle a person could sum up the equation and subtract the ships that where destroyed.
And yes the firing rate could also be introduced, as any others.
The prob with this is, it requires heavy simulations in order to avoid strange outcomes.

I´m sorry if someone had already spoken of this.

Thanks

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

Post by wyvern11 » Tue, 28. Apr 09, 19:53

wow gazz, fine to see you on a thread like this :D

too bad I only found this now.

using your fine logger-script and some elementary bash scripts I calculated some tables for OOS as it now occurs for the major ship classes

target was a hivequeen ship because of the immense shielding

http://home.arcor.de/mwein/repository/o ... _stats.ods

here is a view of the M6 page

http://home.arcor.de/mwein/repository/shot02.jpg

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.

on the other hand it is over fast and it is symmetric (which it wouldn't be if player-oos-logic was different)

my opinion is Keep It Simple and Stupid:

- one should agree on a balanced table of weapon damages (we should make that one up from scratch probably, no firing rates perhaps)

- since there is no direction oos we should postulate that 2-3 turrets have the target in firing arc

- 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

voila - a fast but not so random system for guns



EDIT : @enenra
there is no real unbalance in the ships if you do look over the fact that ships having fewer turrets suffer a lesser multiplicator from that side (see point 2 below).

the only inconsistencies in original oos damage dealing are :
- if only one ammo based weapon aboard lacks ammo, ship does not do any damage at all but hits 0 damagepoints (in fact thats the problem with most of the terrans in my tables)
- the damage of every mounted weapon is summed up, but it is multiplied by the number of turrets *again*

if you special balance some given ships at least some people will find their favorite craft outgunned / overpowered
-


{oversized image replaced by link - Carlo}
Redest du noch - oder denkst du schon ?

Post Reply

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