[WIP] Captain AI overhaul. Updated 09.12.2014

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

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

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

Post by cicero111 » Thu, 27. Nov 14, 21:09

@Sparky
Yeah, there seems to be "something" in there that makes the K's a bit "clingy" and insist on going close/triggering the break off part constantly of the script. Have been trying to add some "air" between the ships when they combat but those are a bit hard to control sometimes.
Adding the skunk as a priority target (same as L/XL) for pursuit is a good idea really, is their enemy's flagship after all. I'll do some testing :)

@w.evans
Plan is to do some more hacking in the escort scripts++ to make wingmen react a lot faster when leader is boosting, both IZ and zone changes + when leader is jumping. Whole fleet boosting or jumping in about the same time would be kinda sweet :)

The Sucellus IHC fires as usual in my game when oriented to target and within 9KM - haven't tested without my BetterTurrets mod yet, but if that one have some issues now I'll look in to it.
Do you run some other battle related mods? I usually cram as many mods that i can into my game, but might have missed one :P
Saw a change to the K's in latest patch though - they now shoot "fireballs" instead of that purple stuff, might be something related. Haven't seen any changes in egos AI code yet though.

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Fri, 28. Nov 14, 09:04

I don't THINK that I have any other combat related mods. My setup is:

CaptainAIOverhaul
Mission Computer
Capital Ship Bridge
Mk5
More Crew
Enhanced Money Transfer
Show Me Your Faction, Please!
Show Skills
Speedy Delivery
Super Booster
Super Scanner
No random Sector music
Yet Another Trader

And the following are installed, but inactive, in case that somehow has a bearing on things:

Better Turrets
ButterMissions
ButterRewards
no Jump Fuel for Player Ships
Player Drone Recall

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

Post by cicero111 » Fri, 28. Nov 14, 13:59

@w.evans
Thanks for reporting back :) None of those mods influence the DO script afaik, and i use most of them myself. I use the Sucellus + 2 Taranis wingmen as primary test "fleet" for this mod (the other one is Fulmekron + misc wingmen thrown together) .
I'll enable some debug output in my BT mod again and see if some weirdness comes up that needs fixing :)

Edit: And yeah, one more question - was the DO in offensive or defensive mode? Just remembered I added a feature to not use the "big guns" at all when in defensive mode in the last version of that mod. Was buried deep in my wall O text at the BT mod page, moved it up a bit since that one is somewhat important :)

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Fri, 28. Nov 14, 19:47

I don't have the save anymore, unfortunately. I do remember that under Ship -> Details, the Defence Officer status read "Defending" (only time I've ever seen this change is when it reads "None" or "Nothing" or something like that) while under Ship -> Details -> Defence Officer -> Details, it read "Attacking."

edit: Oh, and the Sucellus was explicitly commanded to attack the Titurel. [Hail -> New Command -> Attack... -> Attack the Object]

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

Post by cicero111 » Fri, 28. Nov 14, 20:27

Thanks :) And no worries about the save - that was very helpful. Iirc "attacking" shows on both offensive/defensive when they are shooting at the target, but when in offensive they will fall back to "attacking enemies" while idling.
The DO gets the target via attack object command, and vanilla DO's will fire what they have at it no matter their def/off state, but i added some code in there so when DO is in defensive they'll avoid damaging the hull and just target weapons/engines/jumpdrive with their turrets as capping support.
Gives me an excellent excuse to revisit and do some more in that mod :) One thing I'll add in the todo list is "make the thing user friendly", that wall of text at the mod page is not that :P Maybe add some info popups at first launch or some other GUI stuff.

HailedGorion
Posts: 38
Joined: Sun, 2. Jan 11, 18:35
x3tc

Post by HailedGorion » Fri, 28. Nov 14, 21:42

Does this mod has anything to do with the "Captain and Defense Officer AI Overhaul" mod existent in the Steam workshop?

If not, even still in beta, why not adding there? This should make things much more convenient and would increase its visibility to other players.

Im saying that cuz I believe this mod has great potential and would help new players to get a much greater experience from the game.

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Fri, 28. Nov 14, 23:09

@cicero111

Yup, read about the DO mode switching in the write-up. Partly why I wanted to try it out: that, the added relevance of DO skill, and the drone functionality. Is there a way to manually switch the DO's mode from offensive to defensive and vice versa though? Assumed that if the ship was following and there are hostiles, that it would be in defensive mode, and would switch to offensive if either commanded to attack everything, attack a particular target, or maybe (hopefully) the new patrol command.

edit: Just thought I'd add: I think that the wall of text is fine. It's consistent with the traditions exemplified by some of the great mods from X3! It IS a lot of information to take in though, so one has to read it, download and install, play, read it again; and do that a few times before it all sinks in. At least I have to. Then again, maybe I'm slow.

@HailedGordon

I actually prefer getting the mods here since we get them in loose files. Easier to see which files are modded to check for compatibility, and also allows one to take a peek in the altered scripts to see how things work under the hood, and maybe tweak sometimes. The steam workshop does make updates more convenient though.

The CDOAIO doesn't seem to have been updated since v2.5ish. I vaguely remember reading that clj (The author of CDOAIO) lost interest in the game and isn't actively updating the mod anymore. (Don't quote me on that though, because I just looked, and can't seem to find the relevant post. Maybe he/she's just busy.) Hoping that he (she?) 'll come back and pick it up again though now that the game's starting to actually be fun. Same for Mad_Joker and his UFO. Man, that mod kicked ass! And Lucike! (Although Lucike could be over at the German board modding under a different alias for all we know. Ah, the wonders of the internet.)
Last edited by w.evans on Fri, 28. Nov 14, 23:41, edited 1 time in total.

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Fri, 28. Nov 14, 23:22

Hm, there's a thought.

Hey cicero111, you wouldn't happen to be interested in picking up Mad_Joker's UFO now would you? In his last post over at the Steam forums (as MrWolfZ), he mentioned that "the sources of UFO are completely publicly available on my GitHub repository (link on Egosoft forums), so if the author of CDOAIO wants to, they can copy most of the things and incorporate them in their mod."

I mean, you seem to have a pretty good idea of how the combat and movement scripts work. Might be fun.

Tracked down the files here if you want to take a look:

https://github.com/MrWolfZ/XRebirth

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

Post by cicero111 » Sat, 29. Nov 14, 16:23

@HailedGorion
Yeah, this one combined with BetterTurrets have more or less become a remake of CDOAIO, the "overhaul" in the title is a nod in direction of clj's mod :) Started on both since that one was not updated + was inspired with what iforgotmysocks managed to do with the AI code in his skunkturret mod.
The BT mod will be released on Steam WS soon'ish since no reports of broken saves or computers catching fire in latest beta - I'm a bit on the fence till ego releases their complete 3.0 AI package though to be sure I'm not introducing any problems.
I'll release this one on steam as well, but there are a lot of changes and tweaks to be done in the code still.

@w.evans
Saw you started a post in the BT mod thred - I'll answer the relevant stuff there :)
And yes, have been looking at MadJoker's UFO scripts among others to find the "tricks of the trade", so am somewhat familiar with the code.
Doing some 3.0 compatibility updates to that one is a good idea really - was a great mod, I'll think about it.

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

Post by cicero111 » Sun, 7. Dec 14, 23:13

A quick update.
Ego made some (minor) changes to the captain AI code in the latest 3.0 betas which broke xpath patching of this mod.
Goal is to release a 3.0 compatible version in a couple of days (have to finish testing).

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

Post by cicero111 » Tue, 9. Dec 14, 17:54

New version is up, beta3 :)
Choosed to release a bit early since some changes which came with 3.0beta6 or 7 broke the patch node path, so the majority of the AI code in the mod was ignored on startup.

Not many visual changes in this one, have mainly been working on making capship leaders "aware" of their wingmen, and adding a framework for command/order function for leader to signal wingmen to boosting/jumping/attacking with their leader instead of just catching up.

Only "boost to me" order + distancecheck/wait for wingmen after boost to pos/boost to target active in this version since the get_safe_pos is somewhat wonky on long distances and I'm working on making that behave reliable. Was kinda nice seeing the entire fleet rotate toward target and firing boosters almost simultaneous. Seeing some of them boosting in the wrong direction - not so much :P

Edit: Have to mention this version is a bit noisy in the debug log for boost checks and such, but if interested you can see what parts of the scripts triggers when in there. And same as in the previous version, IZ boosting is only enabled for playerowned ships.

Edit2: Beta 3.1 uploaded. A bugfix in the escort script to make wingmen use correct code when boosting between zones. Tested and still works OK with RC1 it seems.

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Tue, 9. Dec 14, 22:23

Am posting here again because what I just saw seemed to have more to do with Captain AI Overhaul rather than Better Turrets. This was with Captain AI Overhaul beta3, Better Turrets beta2, and X-Rebirth v3.0 RC1. I did notice that Captain AI Overhaul was just updated to 3.1, but since the latest update affects Escort AI rather than primary Captain AI, I thought that this might be helpful nonetheless.

The standard test scenario I've been playing with regard to my comments over the past week or so (not sure how long it's been, to be honest. a weekend? two weeks?) has been like this: I'd be in Darned Hot Air with my Squadron comprised solely of a Sucellus (STK 01), with two Sucellus (STK 02 and 03), two Balors (M/FGT 01 and 02), and two Stromvoks (DDF 01 and 02) assigned in a squadron under command of the aforementioned Sucellus (STK 01). I would then dock the Skunk with STK 01, and command STK 01 to take me to Lava Flow for a quick test battle with Reiver fighters. After that's done, I'd command STK 01 to jump to Twilight Sentinel, collect the squadron there, then cross the jump gate to Auspicious Excavation where there are two hostiles: one Taranis with a wing, and one Fedhelm. I would then command STK 01 to attack the Taranis.

This last one was odd. (I should say, first of all, that there was a lot of lag. Haven't yet tried RC 1 vanilla, so I don't know if it has something to do with that. However, I mention the lag, because I don't know how much of an effect it might have to ships' responsiveness to scripting.) Even before docking with STK 01, I noticed some ships boosting sideways (or so I assume. They were moving very quickly sideways, in any case). The rest of it seemed uneventful, until Auspicious Excavation.

After exiting the gate, and some maneouvering (and I must say, the squadron maintained pretty tight formation), my Sucellus approached the Taranis at a tangent, and seemed to keep trying to get it's nose pointed at the Taranis, but couldn't turn fast enough, so just kept pointing just behind the rear of the Taranis which appeared to maintain forward motion (of some sort. Didn't have any points of reference to tell if the Taranis was turning as well. Could've been running circles around me.) Suffice to say that the Sucellus never managed to have nose pointed towards the target, and hence never managed to fire the IHC.

Better Turrets seems to be working though. Multiple surface elements burned on both the Taranis, and my Sucellus, and my Sucellus seems to have at least distracted the Taranis long enough for the Balors to pummel him with Novadrones. And squadron movement was cool. Couldn't really tell when the group boosted though, because was on the bridge. I'll try having them maneouvre while I'm watching from the Skunk next time.

edit: Just realized how long-winded that was. Sorry about that. Figured that I'd probably be doing this scenario a couple more times for testing, and that giving more details about what exactly was done and when might help narrow down what's going on (with the mod, with my set-up, or with the base game).

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

Post by cicero111 » Tue, 9. Dec 14, 23:53

Thanks for the detailed bugreport - was an interesting read :)

The boost issue was related to wingmen using the IZ "catch up to leader" code instead of the vanilla code which they are supposed to use when they are boosting between zones.
What was happening was they were boosting to position where where the leader ship was (boosting away from), got there and started new boost to leader and finally crossed zone border without a correct zone entry position/vector.
This did not exactly make the X engine happy, so when they at last arrived IZ they could be boosting sideways and such before settling down :)
That bug was fixed in 3.1.

About the lag issue, noticed that in a station attack scenario i was running today as well. Haven't changed anything in the core AI behavior/movement code sine the last one except stuff related to boosting + leader/wingmen "comms" + some backports of vanilla code (mostly some interrupts and such). I'll do some retesting of that scenario.

The sucellus target tracking does have some problems keeping up when target is moving at a tangent. The engine gives a target vector to centre of target, which is then sent to a move/rotate order which have some reaction time, then a 5 sec delay before rinse and repeat. Have tried without the delay as well but does not do much (except probably stress the engine unnecessary). Have not found a trick to get a vector to front of target instead of centre yet.

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Wed, 10. Dec 14, 00:15

Might it be the approach towards the target that is problematic then? Approaching an already moving ship from the side? (Probably a bad idea anyway when dealing with a Taranis with that broadside.) So in a case like this, would it be better to order my lead Sucellus to withdraw, find a better angle (will be difficult without the ability to pilot the Sucellus directly, but might be an interesting puzzle), and THEN order the boost to doom?

Also considered having a Balor lead the squad since it should also keep its distance, and it might free up the Sucellus to better maneouvre for some strange reason; but was concerned that the Sucellus might not fire IHC at all without manual order to attack. (Would a Sucellus on escort duty try to orient it's gun on target?)

The sideways boost thing was fun. Not very immersive. But fun.

PS. When withdrawing under fire, will Better Turrets keep my ships firing while they're running with their tails between their legs?

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

Post by cicero111 » Wed, 10. Dec 14, 22:06

Was thinking about labeling the beta3 "the mad drifting edition" - one does get some laughs out of these boosting tests :P

The boost to pos/boost to target does open some new strategy decisions - if attacking a target which are not going after you I guess boosting 20+ KM below and ahead of it, and then boost of doom towards the target. A sucellus for example would then stop and hold position/orient while target is moving closer straight into the IHC fire.

Have added code for sucellus/balor wingmen to stop/orient when acting as a wingman + have recieved a defined target from their leader. But is not complete yet since bits of the vanilla escort scripts might interfere and force them to move back in formation - if for example leader is a destroyer which will not stop/hold at long distance. And if Balor leader and taranis wingmen for example they might stop at a too far range for the taranis to pursue or shoot at target. So different compositions of leader and wingmen ship types will have different results + I'm going to do some more hacking in those escort scripts to tune pursue ranges and such.

About the BT mod/defence officer, if retreating/no given target/captain is panicing and such, in the latest version the defence officers will continue firing as long as they have valid targets in range (influenced by defensive/offensive modes). Was thinking about how to do a DO panic thing aswell, but not firing guns is boring, and firing at own ships/drones and such is kinda evil, so decided to drop that :P

Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 8074
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp » Wed, 10. Dec 14, 22:13

I'm salivating at the prospects of a Sucellus-only wing :)

Hotmail1987
Posts: 6
Joined: Fri, 13. May 11, 02:52
x4

Post by Hotmail1987 » Tue, 16. Dec 14, 23:02

This Mod is compatible with Better Turrets?

Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 8074
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp » Tue, 16. Dec 14, 23:04

That is the aim of our heroic battle modder :)
cicero111 wrote: Yeah, this one combined with BetterTurrets have more or less become a remake of CDOAIO, the "overhaul" in the title is a nod in direction of clj's mod :)

Hotmail1987
Posts: 6
Joined: Fri, 13. May 11, 02:52
x4

Post by Hotmail1987 » Tue, 16. Dec 14, 23:12

TY :)

balogt
Posts: 773
Joined: Thu, 18. Dec 03, 09:00
x3

slight issue with cap ship not going after fighter

Post by balogt » Thu, 22. Jan 15, 04:27

It may be due to this mod or not but I noticed when I give a command to the captain to go after a fighter the ship stands still. if I order captain to attack a cap ship he does very well. is this part of the code or is there a different script for captains going after the little ships.
btw very good for cap ship battles.
balog

Post Reply

Return to “X Rebirth - Scripts and Modding”