[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

HailedGorion
Posts: 36
Joined: Sun, 2. Jan 11, 19:35
x3tc

Post by HailedGorion » Fri, 28. Nov 14, 22: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: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Sat, 29. Nov 14, 00: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 Sat, 29. Nov 14, 00:41, edited 1 time in total.

w.evans
Posts: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Sat, 29. Nov 14, 00: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: 107
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 » Sat, 29. Nov 14, 17: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: 107
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 » Mon, 8. Dec 14, 00: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: 107
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 » Tue, 9. Dec 14, 18: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: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Tue, 9. Dec 14, 23: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: 107
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 » Wed, 10. Dec 14, 00: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: 2962
Joined: Tue, 18. Nov 14, 17:23
x4

Post by w.evans » Wed, 10. Dec 14, 01: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: 107
Joined: Sat, 13. Aug 11, 14:30
x4

Post by cicero111 » Wed, 10. Dec 14, 23: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: 7519
Joined: Tue, 30. Mar 04, 12:28
x4

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

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

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

Post by Hotmail1987 » Wed, 17. Dec 14, 00:02

This Mod is compatible with Better Turrets?

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

Post by Sparky Sparkycorp » Wed, 17. Dec 14, 00: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: 5
Joined: Fri, 13. May 11, 02:52

Post by Hotmail1987 » Wed, 17. Dec 14, 00:12

TY :)

balogt
Posts: 764
Joined: Thu, 18. Dec 03, 10:00
x3

slight issue with cap ship not going after fighter

Post by balogt » Thu, 22. Jan 15, 05: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”