[MOD] BetterTurrets. Updated 20.12.2014

The place to discuss scripting and game modifications for X Rebirth.

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

cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 »

Depends on how tough your traders is I guess, as BlackRain says the station DO will assign some on escort duty to protect the ships assigned to the manager. Have only built stations in (what used to be) mostly peaceful parts of space, so don't have much experience with what's best there myself.

On the script side, the station DO runs the same bits both IZ and OOZ. The capship OOZ DO code is changed somewhat since 2.5, and now takes relevant NPC skills into account in the chance to damage opponent check. If success here it checks if enemy is within max weapon range, and if successful again it calculates damage given (two .exe based commands which i guess gets a magic damage number based on all weapons, and then applies that to enemy). It will do this for all enemies within weapon range.

The DO escort OOZ movement code is just "keep close to leader"/no enemy reaction code. If the escort ships were trailing behind they could be out of weapon range on both sides and not involved in the calculations at all - suspect that scenario is what happened here since they were undamaged.

Guess adding some OOZ move closer/engage enemy code in the move.escort script could have made this scenario end a bit differently. I'll look into it :)
w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans »

Wait,
cicero111 wrote:as BlackRain says the station DO will assign some on escort duty to protect the ships assigned to the manager.
They do?! So, station-based escorts will be assigned to protect station-based assets, i.e. station-based miners and traders and the like? That is cool! Don't remember them doing that. Will probably have to salvage my old save, and try to pay closer attention.
cicero111 wrote:The DO escort OOZ movement code is just "keep close to leader"/no enemy reaction code.
So, only squad leader/s will directly engage hostiles, and escorts will only react when hostiles are in weapon range. Ok, seems ok.
cicero111 wrote:If the escort ships were trailing behind they could be out of weapon range on both sides and not involved in the calculations at all - suspect that scenario is what happened here since they were undamaged.

Guess adding some OOZ move closer/engage enemy code in the move.escort script could have made this scenario end a bit differently. I'll look into it :)
Might be unnecessary, although your efforts will most certainly be appreciated! What I am now wondering is: will your Captain AI Overhaul boost to doom code extend to squadrons operating OOZ? Might be enough if the squadrons stay closer together, to give a better chance of being a cohesive unit when they engage any hostiles.

Would it be possible to have Station-based DOs coordinate a rally-and-reinforce kind of thing? So if, for example, a station had 10 individual Stromvoks patrolling, and one engaged a hostile, all of the other Stromvoks would rally and reinforce the soon-to-be-spacedust Stromvok?

Might be ideal since having more patrols would increase the chance of finding any hostiles before they engage any soft assets (freighters, miners, and the station itself), while concentrating that force would increase the chance of defeating said hostile. Would then be a balancing act between concentrating force into fewer squads which could defeat anything, but would have less chance of actually finding anything; and dispersing into more squads which could find anything, but would be weaker individually, but would concentrate enough to evenually beat anything (so if 10 individual station-based Stromvoks were to engage a Taranis wing, 1 or 2 Stromvoks would probably be obliterated before the rest of the swarm arrives to reinforce).

And thanks, man. This is all really beyond the scope of your mod, and I really appreciate your taking the time to explain how the internals work.
cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 »

I do find the "thinking out aloud" approach very useful on this forum, often lots of good ideas that comes out of it + there are also some mod wizards here to correct me as well if I'm heading down the wrong path :)

Actually have some code snippets which make wingmen boost-attacking OOZ, jumping synchronous with leader and such - been testing some custom interrupts/"orders" to learn how the interrupt events work and what's possible there.
It quickly goes from "Woho!" to lots of hillarity ensues though, especially when the boosters engage IZ in the middle of a ship "cluster" - that booster stuff is really finnicky...
I'll probably rip most of it out again to the next version since is way to unreliable.

And have already implemented the OOZ wingman attack code - I'm only injecting some interrupt handling to catch the attack signal (the leader does send that signal OOZ in vanilla as well, but is ignored) + code which fires of the move.attack script. Is more or less copy/paste of relevant bits from IZ vanilla escort code.


Have been thinking a bit how to do station defense a bit deeper in the AI tree than just having the captains do their thing independently (if not in wing). I.e. make the station DO somewhat "aware" of their surroundings instead of being an inventory manager assigning ships for different tasks, who don't really "know" what's going on outside the station.
Haven't checked if stations have gravidar type of object, but if they can scan for enemies one might inject a decision script where for example if enemy near, do some strength assessment and maybe ship grouping based on that and order the attack. Sending attack target signal to pilots/captains in other zones should also make them boost/jump in to assist.
It is a mod project on its own, but must admit an interesting one.
w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans »

cicero111 wrote:make the station DO somewhat "aware" of their surroundings instead of being an inventory manager assigning ships for different tasks, who don't really "know" what's going on outside the station.
Haven't checked if stations have gravidar type of object, but if they can scan for enemies one might inject a decision script where for example if enemy near, do some strength assessment and maybe ship grouping based on that and order the attack.
This would be even better!
cicero111 wrote:Sending attack target signal to pilots/captains in other zones should also make them boost/jump in to assist.
It is a mod project on its own, but must admit an interesting one.
And this would make having stations in neighboring zones make more sense, and more efficiently. If it turns out that a station does have gravidar, could maybe tie the range to the radar thingy it builds. The radar thing is supposed to limit communication rather than detection range, if I remember correctly, but that could hold true here too.

Sorry don't have anything more intelligent to contribute yet. Just got home.
cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 »

Did a tiny bit more digging and it does have gravidar for the turrets of course.... :P (got tunnel vision from looking at the script tree from fight.station.player I guess).

The correct place to inject that ship dispatch thing would be in fight.attack.object.station script since it provides a nice target list to use already. Should not need that much code probably, filter list of enemies to only get L/XL, create a list of own ships running the patrol script (to avoid hijacking ships on escort duty/already engaging), some distance/threat checks + engage/ignore rules.
SyberSmoke
Posts: 655
Joined: Sat, 11. Feb 12, 04:03
x4

Post by SyberSmoke »

Request: If a ship is being boarded, any player owned ship will cease attacking that ship and remove it from their target list. If no other targets are in range they will go to standby.

Given the clunky command system, boarding can be a real pain if you have company. Really it would be nice if a neutral or ally ship would also stop shooting. But if they do not like you...your marines are toast also. ;-)
w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans »

SyberSmoke wrote:Request: If a ship is being boarded, any player owned ship will cease attacking that ship and remove it from their target list.
That's a very good idea! I support this very good idea!

Seriously though (not that I wasn't serious in saying that that's a very good idea), it's a really good fit with how your defensive mode turrets work. Is it possible to filter out targets based on boarding state though? Haven't familiarized myself with the DO and Captain codes since you seem to have them covered.
dez505
Posts: 172
Joined: Wed, 6. Nov 02, 20:31
x4

Post by dez505 »

Maybe during boarding event the ship can turn neutral then back to you/enemy based on win/fail
HailedGorion
Posts: 38
Joined: Sun, 2. Jan 11, 18:35
x3tc

Post by HailedGorion »

"- Capital boarding support mode when the defense officer is in defensive mode."

As it is written in the front page... it is already implemented. You can set de DO to stop destroying the ship, u're trying to board, hull.

Can't say if it works well, never tried before.
cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 »

Took a peek in the boarding script and it does "tag" the ship with a variable i can easily do a check for early in the target detection section. If boarder=player and DO in defensive -> ignore target.
The current version does stop shooting when defensive if no valid targets (all turrets, jumpdrive and engines are either destroyed or not in sight).

If I add this - when the boarding scripts starts all playerowned cap ships would stop shooting that target and just take fire if not all turrets have been dealt with though. Turning the DO offensive would make them start shooting again, but they would also intentionally damage the hull. So would have to manually make them jump out to avoid damage to one or the other.

Maybe look into if target is being boarded + boarding pods in flight, stop shooting, after that take out turrets and such again?
Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 8074
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp »

Sounds smart :)
Exavier724
Posts: 118
Joined: Fri, 12. Dec 03, 02:13
x2

Post by Exavier724 »

cicero111,
Maybe apply it to all DOs (defensive & aggressive) but add a limier to it for hull integrity. If Boarded (or pods en route) + Hull < 30% just stop shooting at it.

I keep having wandering NPC destroyers or missile frigates decide to alter course and take a pot shot at the ship after i have stripped every subsystem for boarding. When the shot is coming from multiple nova drones 30% unshielded hull pretty much vaporizes before i can leave my hacker drone :P

Would also be nice to get stations to stop pummeling the thing if I am trying to steal it as an alternative to some of the "destroy this" mission types.
w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans »

In my very limited experience, taking out turrets with boarding underway is dangerous though, because those plasmas miss quite a lot, and they tend to blow up the ship!

Then again, might be a good idea now that damaging the ship gives a better chance of winning succeeding boarding rounds. If they just stop firing, and the target still has turrets, we'll have to order them away anyway.

So, yes
cicero111 wrote:Maybe look into if target is being boarded + boarding pods in flight, stop shooting, after that take out turrets and such again?
sounds good to me.

Then again (sorry), just having a passive Taranis close by to soak up weapons fire makes it a LOT easier to take out turrets. Might not be so fun to lose that option if it's tied to defensive.
cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 »

Some good points here :) Having one or more support cap ships "soak" turret fire when doing boarding support is a big advantage I did not think of.
Usually let my overpowered marine squad do their thing unassisted after they have landed - and have not tried boarding in 3.0 yet.
Added a limiter in the code to only shoot at surface elements if playership DO is in defensive and target hull is above 30%, after that stop. Have also added code which should (in theory) make them hold fire if pods in flight. Hope to find some time to test this tomorrow.

@Exavier724
I'm a bit sceptical making NPC DO's being considerate about player boarding operations though. If i make them stop firing completely they would just stay close and soak damage. Could maybe make them avoid shooting the hull if target has "boarding" flag active.. Correct in this scenario the NPC is an ally of the player, but enemy of boarding target?
SyberSmoke
Posts: 655
Joined: Sat, 11. Feb 12, 04:03
x4

Post by SyberSmoke »

cicero111 wrote:@Exavier724
I'm a bit sceptical making NPC DO's being considerate about player boarding operations though. If i make them stop firing completely they would just stay close and soak damage. Could maybe make them avoid shooting the hull if target has "boarding" flag active.. Correct in this scenario the NPC is an ally of the player, but enemy of boarding target?
Simple analogy here, You have the US marines and the French Airforce in a warzone...there is an enemy base that the Marines are assaulting. Now the French are not going to just bomb the base if the US forces are in there. I would apply that logic to the situation.

Your allies should respect that you have troops on board. I would say instead of being damage sponges, they could instead break from combat and either go to a safe distance and or move to another target if there is one.
dez505
Posts: 172
Joined: Wed, 6. Nov 02, 20:31
x4

Post by dez505 »

Nope! I think the french would still bomb them :P
cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 »

I completely agree on the enemy of my enemy is my friend approach.
Just don't want to open up an exploit where NPC's could be "tricked" to do the suppression/heavy lifting for the player, who then comes in and tags the ship as boarding in progress/launches marines - and then takes the ship.

Guess the US marines would be a bit "reserved" if said frenchman drives nonchalantly into the base in the final stages of the battle, and says "I call dibs on this one" - of course with this attitude :)
Exavier724
Posts: 118
Joined: Fri, 12. Dec 03, 02:13
x2

Post by Exavier724 »

cicero111 wrote:@Exavier724
I'm a bit sceptical making NPC DO's being considerate about player boarding operations though. If i make them stop firing completely they would just stay close and soak damage. Could maybe make them avoid shooting the hull if target has "boarding" flag active.. Correct in this scenario the NPC is an ally of the player, but enemy of boarding target?
Is there any way for you to put a hold fire on the high damage weapons then? Things like V Crushers, Nova Drones, and the heavy station turrets to stop wailing away at it? I could see the lighter guns continuing to shoot at surface elements but those 3 i listed are usually what vaporize my boarders.

Also since 3.0 boading is painful. First you can't buy vet/elite marines anymore, you have to train them up through success. And from what I have seen even with a 5 star marine officer you only get between 25 (all rookies) and about 80 (highest I have hit with 5 elites & about 30 vets) boarding offense... compared to the 300+ defense XL ships have... I think even cargo drones are currently adding to the defense number.

Means I generally have to de-module the thing completely just to cap it now lol. Which is pretty much why most of my attempts end up in explosions from allies :P
cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 »

Ah - I see my old tactic with kick out the marines and run away to mess in the tradescreen out of weapon range until boarding complete has to be revised - good to hear, twas a bit too easy :)

With the weapons, the AI code have very limited influence on what the turrets does with their assigned targets - there are only two weapon "banks" on caps for the AI code to interface with. Bank 1 seems to be reserved for IHC's/torpedoes and such, bank 2 is for turrets and launchers of different types.
Did try a code variant where i ordered each turret object to aim/fire separately, but the game-engine only complained that it would do no such thing.

In the station code it seems to be even more limiting (have not changed anything with the station DO yet, but I'm experimenting). The vanilla AI code only sends the assembled target list to one single weapon group, and the .exe code handles the rest if I've read this correctly.
So those heavy station turrets uses the same targets list as the rest, I guess more of the selection code is done in the .exe here for performance reasons.
But to make the station DO's ignore some targets completely based on a set of rules is very much doable.
cicero111
Posts: 108
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 »

New version is up, only a small change so named beta 2.1 :)
Changes:
- Drone leaders will if their target is destroyed check with DO for a new one, if none given, return home to dronebay.
- Player caps and neutral/friendly cap NPC's (0 or above) will stop shooting if the target is boarded by the player and the hull gets below 50%. Only valid for capship DO's, stations and fighters will still shoot at it.

Return to “X Rebirth - Scripts and Modding”