
[SCRIPT] OCS Apollo (version 1.0) - Improved Fighter AI
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 4447
- Joined: Tue, 2. Dec 03, 22:28
-
- Posts: 140
- Joined: Sat, 20. May 06, 11:42
-
- Posts: 117
- Joined: Fri, 21. Apr 06, 10:48
Would it be possible to make the fighters and corvette size ships slow down when shooting large or stationary targets and when they get too close to the target they turn away and after that increase speed?
This would be very handy with anything bigger than a fighter and smaller than a destroyer because they cant really dodge anything and they are even more likely to collide to stations than fighters.
Or is it even possible to edit attacking manouvers with such a detail?
I think that destroyers and other big ships alredy stop their engines when they make an u-turn...
This would be very handy with anything bigger than a fighter and smaller than a destroyer because they cant really dodge anything and they are even more likely to collide to stations than fighters.
Or is it even possible to edit attacking manouvers with such a detail?
I think that destroyers and other big ships alredy stop their engines when they make an u-turn...
-
- Posts: 140
- Joined: Sat, 20. May 06, 11:42
Erm... if you pay close attention you'll see that they already do. It doesn't happen that often as it's a skill based event, but it does indeed happen. On rare occasions they even go to a dead stop and pummel away until their laser batteries run dead, then fly away.Leke wrote:Would it be possible to make the fighters and corvette size ships slow down when shooting large or stationary targets and when they get too close to the target they turn away and after that increase speed?
This would be very handy with anything bigger than a fighter and smaller than a destroyer because they cant really dodge anything and they are even more likely to collide to stations than fighters.
-
- Posts: 117
- Joined: Fri, 21. Apr 06, 10:48
Yeah i've noticed that they sometimes do that but could it be made so that it happens always? It really doesnt need alot of skill to slow downLaureati wrote:Erm... if you pay close attention you'll see that they already do. It doesn't happen that often as it's a skill based event, but it does indeed happen. On rare occasions they even go to a dead stop and pummel away until their laser batteries run dead, then fly away.Leke wrote:Would it be possible to make the fighters and corvette size ships slow down when shooting large or stationary targets and when they get too close to the target they turn away and after that increase speed?
This would be very handy with anything bigger than a fighter and smaller than a destroyer because they cant really dodge anything and they are even more likely to collide to stations than fighters.

Only problem with that current skill based thing is that they accelerate at the same time they start to turn which means that M7 class ships still collide with big stations even if they slow down.
If they would turn and after turning start to accelerate then they wouldnt collide.
-
- Posts: 4447
- Joined: Tue, 2. Dec 03, 22:28
-
- Posts: 140
- Joined: Sat, 20. May 06, 11:42
Yes, it can be made so it happens always - I've done so during play testing - however this is not as ideal as it sounds. Firstly it looks boring and ridiculous as all fighters just end up sitting dead in space and shooting at the target. Second you'll find battles really short as all the fighters are destroyed in seconds because they're sitting ducks.Leke wrote:Yeah i've noticed that they sometimes do that but could it be made so that it happens always? It really doesnt need alot of skill to slow down![]()
Only problem with that current skill based thing is that they accelerate at the same time they start to turn which means that M7 class ships still collide with big stations even if they slow down.
If they would turn and after turning start to accelerate then they wouldnt collide.
Once more I find myself replying to someone complaining about the performance of non-fighter class ships under the OCS Apollo. So here's a REMINDER, yet again. THE OCS APOLLO AFFECTS FIGHTER CLASS SHIPS (I.E. M5, M4, AND M3 CLASS SHIPS).
As for problems with M7s and M6s they do not use the majority of the protocols in the OCS (unless the ships have been changed to fit under the class of LITTLE SHIPS in the technology tree).
Also ships movement plotting is not at all determined by the OCS Apollo - the type of maneuver may be called by the OCS scripts but the details of the execution are programmed elsewhere - that's under the game engine itself.
Furthermore, the OCS Apollo aims to improve the AI with MINIMAL increase in script length. The way the game determines flight dynamics is part of the hard-coded engine and that leaves one of two ways to fix your M7 problem.
1. Write a totally separate script telling M7s how to turn action-by-action and override all inbuilt game MOVE commands.
2. Mod the M7s in the Tships file so they apply negative acceleration when they turn (the same way capital class ships do) - however this would make your M7s about as agile as a capital ship then.
Both these solutions exist outside of the scripts/sections handled by the OCS Apollo.
I'd love to be able to specify how ships handle their movement for several of my own reasons.
1. To have fighters strafe the entire length of a cap ship and overfly it instead of turning around
2. To input dogfighting manuevers, especially for fighter groups
3. To have much better evasive manuevers
But these are all handled by the game engine and not scripts (and especially not OCS scripts), so I can't do that. And even if I knew a way of hacking the engine and doing it, it'd be a violation of the licensing agreement.
-
- Posts: 117
- Joined: Fri, 21. Apr 06, 10:48
Thanks for a thorough answer Laureati.
I gues i'll have to start learning scripting myself then.
I have couple of other things i want to fix(or to screw up
)
With the M7 it doesnt really matter if they stop to shoot stations because they are small enough to evade ppc fire just by slowing down. Any smaller weapons hits them most of the time no matter how the AI flies and its much more preferable to take some hept-shower than ram a station.
I gues i'll have to start learning scripting myself then.


With the M7 it doesnt really matter if they stop to shoot stations because they are small enough to evade ppc fire just by slowing down. Any smaller weapons hits them most of the time no matter how the AI flies and its much more preferable to take some hept-shower than ram a station.
-
- Posts: 140
- Joined: Sat, 20. May 06, 11:42
OK. Took a look at the OCS Apollo script (I haven't seen it in a long time) and it turns out YES, M7s do use the fighter tactics for capship/station attacks.
If you want to remove that it's quite simple, especially since the OCS is a deliberately open system.
1. Go to ocs.plugin.fight.attack.object
2. Find line 237
3. Add "AND ( [THIS] != M7 )" to the line. It should end up looking like this.
That will take M7s out of the approach interupt check. However, I do not garauntee that this will have the effect you want as you may end up having the M7 circling uselessly around the station without doing a proper attack run.
If you want to remove that it's quite simple, especially since the OCS is a deliberately open system.
1. Go to ocs.plugin.fight.attack.object
2. Find line 237
Code: Select all
237 if ( $big.ship OR $station ) AND $speed AND ( $fire == FLRET_INTERRUPTED OR FLRET_TIMEOUT )
Code: Select all
237 if ( $big.ship OR $station ) AND $speed AND ( $fire == FLRET_INTERRUPTED OR FLRET_TIMEOUT ) AND ( [THIS] != M7 )
-
- Posts: 117
- Joined: Fri, 21. Apr 06, 10:48
I tested that and it worked perfectly!
No, not really. It screwed it even more than it already is
But thanks anyways.
Before i edited the script they collided with xenon station something like every 20:th attackrun and now they collided almost every time. I tested it with hyperion and Xtended Whale.
Lets hope that they are going to fix this in the next patch.
No, not really. It screwed it even more than it already is

But thanks anyways.
Before i edited the script they collided with xenon station something like every 20:th attackrun and now they collided almost every time. I tested it with hyperion and Xtended Whale.
Lets hope that they are going to fix this in the next patch.
-
- Posts: 4447
- Joined: Tue, 2. Dec 03, 22:28
-
- Posts: 140
- Joined: Sat, 20. May 06, 11:42
So OCS Apollo actually "fixed" the problem? HahahahaLeke wrote:Before i edited the script they collided with xenon station something like every 20:th attackrun and now they collided almost every time. I tested it with hyperion and Xtended Whale.
Lets hope that they are going to fix this in the next patch.

That is too funny.
Sure no problem, just credit as per usual. If you've seen my OCS Vanilla files, I've stated there the OCS was created to allow an openly modable combat system for everyone. No need to send me the files, just let me know when you post it up. Looking forward to seeing your mod.Sandalpocalypse wrote:Laureati is it alright if I package OCS Apollo with a combat mod I've been fiddling with? I'll send it to you if you want to see it.
-
- Posts: 33
- Joined: Sun, 6. Jan 08, 07:51
-
- Posts: 140
- Joined: Sat, 20. May 06, 11:42
-
- Posts: 33
- Joined: Sun, 6. Jan 08, 07:51
I was planning on trying OCS today, but for some reason i must have messed things up because fighters don't attack each others at all. I also installed the Xtended mod, but from what i read here there should be no conflict. I have no idea what i messed up, i'm sure i followed the instructions correctly. At worst the stock script should have run, but it's not what is happening...
-
- Posts: 4447
- Joined: Tue, 2. Dec 03, 22:28
Hmm.. It sounds kind of like you deleted the egosoft !fight.attack.object.pck file, but didn't place !fight.attack.object.xml and accompanying files in the directory. I would think the game would error out, but going Bleeeaaaargh every time it tries to call the attack script is another option
. If the game is working correctly, the only time I've seen ships staying at 0-speed instead of attacking is when the script-side of the game is severely overloaded (Pirate Guild is well known for causing this).
As a point of curiousity, what fight skill will m4s shoot down missiles at?
I've been playing with the vanilla scripts since 2.5 came out, and I have to say that
I would consider having ships do that at high fight-skill levels.
I think ships should probably always multiple-fire dumbfires as well. I have them modified to be worth something (huge speed, high accel, actual damage)
edit:
I retyped this post a lot of times because I had a lot of confusion over this next part, which I think stemmed largely from ships still using the old attack script if I loaded a savegame that was midcombat.
The OCS apollo AI simply can't attack large capital ships with any success. I ordered 5 Eclipses, a Centaur armed with APPCs, and a XTM pseudo-m7 (Cerberus) to attack a Phoenix while my badly damaged destroyer crawled into range. After about 10 minutes (getting outrun by a phoenix is craptacular xD) the end result was that the Centaur managed 1 successful (as in more than 1-2 shots connect) attack run the entire time. The Cerberus (using m1 logic!) made 5-6 successful attack runs with its main guns. The fighters landed zero shots, they never even came close.
Fighters and corvettes have more success attacking smaller capital ships, but the problem is still evident.
Earlier testing showed similar problems attacking a Albatross, and anecdotally I had similar problems. It wasn't as apparent until I got my own capital ship, since when I was flying a fighter I was mostly concentrating on my attack runs (I really like to skim the hull
)
Using vanilla AI, the fighters and corvettes are far more vulnerable but they can actually land shots.

As a point of curiousity, what fight skill will m4s shoot down missiles at?
I've been playing with the vanilla scripts since 2.5 came out, and I have to say that
with Hornets is extremely epic; it sure adds a lot to a battle when a capital ship has a dozen Hornets coming at it. Pretty good tactic too(a bug in the vanilla scripts caused ships to fire all missiles at once)

I would consider having ships do that at high fight-skill levels.
I think ships should probably always multiple-fire dumbfires as well. I have them modified to be worth something (huge speed, high accel, actual damage)
edit:
I retyped this post a lot of times because I had a lot of confusion over this next part, which I think stemmed largely from ships still using the old attack script if I loaded a savegame that was midcombat.
The OCS apollo AI simply can't attack large capital ships with any success. I ordered 5 Eclipses, a Centaur armed with APPCs, and a XTM pseudo-m7 (Cerberus) to attack a Phoenix while my badly damaged destroyer crawled into range. After about 10 minutes (getting outrun by a phoenix is craptacular xD) the end result was that the Centaur managed 1 successful (as in more than 1-2 shots connect) attack run the entire time. The Cerberus (using m1 logic!) made 5-6 successful attack runs with its main guns. The fighters landed zero shots, they never even came close.
Fighters and corvettes have more success attacking smaller capital ships, but the problem is still evident.
Earlier testing showed similar problems attacking a Albatross, and anecdotally I had similar problems. It wasn't as apparent until I got my own capital ship, since when I was flying a fighter I was mostly concentrating on my attack runs (I really like to skim the hull

Using vanilla AI, the fighters and corvettes are far more vulnerable but they can actually land shots.
Last edited by Sandalpocalypse on Wed, 9. Jan 08, 13:53, edited 4 times in total.
-
- Posts: 33
- Joined: Sun, 6. Jan 08, 07:51
As far as i can tell, the scripts are there, in the right directory. Strange though, the problem showed up before i removed pck file (i did not know at first). Anyway, i will try again when i get back from work...Sandalpocalypse wrote:Hmm.. It sounds kind of like you deleted the egosoft !fight.attack.object.pck file, but didn't place !fight.attack.object.xml and accompanying files in the directory. I would think the game would error out, but going Bleeeaaaargh every time it tries to call the attack script is another option. If the game is working correctly, the only time I've seen ships staying at 0-speed instead of attacking is when the script-side of the game is severely overloaded (Pirate Guild is well known for causing this).
Edit : I reinstalled it today, pasting it over the previous install and everything work fine now. The script seem to work at least, the fights seem different than usual...
-
- Posts: 140
- Joined: Sat, 20. May 06, 11:42
Doesn't matter if it's an m4 or otherwise. Ships at all fight skill levels shoot down missiles, just at varying degrees of responsiveness. Generally speaking, the faster and more agile the ship, the better its chances.Sandalpocalypse wrote:As a point of curiousity, what fight skill will m4s shoot down missiles at?
Here's a simple solution I used to use. Since you're modding the missiles, add the Swarm tag (ref: Wasp missiles) to the dumbfires. You'll get exactly what you're looking for. I did that for my personal mod.Sandalpocalypse wrote:I think ships should probably always multiple-fire dumbfires as well. I have them modified to be worth something (huge speed, high accel, actual damage)
Hmm... this depends on a lot of things. The OCS Apollo code simply makes fighters and corvettes clear a larger distance from a Cap ship or Station before returning to engage. There may be several factors that therefore influence the outcome you laid out.Sandalpocalypse wrote:The OCS apollo AI simply can't attack large capital ships with any success.... Using vanilla AI, the fighters and corvettes are far more vulnerable but they can actually land shots.
1) Ship size vs. Weapon Range. Default collision avoidance may cause ships to turn away from the target before even in gun range. Ship size is not determined by what we see, but by the invisible bounding box of the 3D model itself. But since you say the vanilla scripts worked better in this instance then this is not a factor.
2) Collision avoidance interrupt. The vanilla scripts have this but they worked a little too often. OCS Apollo changes this to higher skilled FIGHTERS. Possibly the skill level of the attackers you used were too low.
3) Target ship direction of travel. Vanilla scripts (due to the above mentioned collision interrupt) attacked capital ships in one circumstance, when the ship was flying away. When that happened most of the attacking ships would follow and should their collision interrupt kick in, they'll tail the ship and unload their batteries on it. This may be what happened.
4) Ship agility. Slower ships like corvettes (which are too cumbersome in the vanilla game I think) have some trouble turning to face a target due to the large area it takes for them to turn. This may cause them to have to avoid a collision before they actually get to attack. Corvettes in the vanilla game simply spent their time shooting the cap ships with their turrets. With the exception of their initial attack run.
5) Attack avoidance. The OCS Apollo ships may be busy trying to dodge attacks from the capital ship against them.
I could go on, but as I've mentioned it could be one or more of a few different variables. In the testing I've done I've encountered no problems and in fact the OCS Apollo ships did capital ship attack runs even better than the vanilla scripts. With 6x more attacks than vanilla script ships in a 10 minute test session.
I will however examine what you've brought up when I have the time. Thanks for the feedback.
-
- Posts: 140
- Joined: Sat, 20. May 06, 11:42
BTW if you loaded a game where combat had already begun then the OCS scripts will not kick in until after those ships involved have stopped attacking. Because the OCS does not overwrite the default scripts these scripts can still run. Please check which scripts are acutally running on that particular ship with the script editor.I retyped this post a lot of times because I had a lot of confusion over this next part, which I think stemmed largely from ships still using the old attack script if I loaded a savegame that was midcombat.
-
- Posts: 13244
- Joined: Fri, 13. Jan 06, 16:39
That could be done with a "fake interrupt" called right after an Attack Run call in combat scripts.Laureati wrote:that leaves one of two ways to fix your M7 problem.
1. Write a totally separate script telling M7s how to turn action-by-action and override all inbuilt game MOVE commands.
2. Mod the M7s in the Tships file so they apply negative acceleration when they turn
The attack script starts (not calls!) a script on a higher task slot that does nothing but Move To a a destination behind it but very close. That means the ship will fly slowly.
Since the combat script only started the Move script but did not actually give up control, it can terminate the Move script after 2 seconds, resulting in a " slow turn away" maneuver.
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.
There is no sense crying over every mistake. You just keep on trying till you run out of cake.