
Is there a mod that makes your ships smarter?
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 25
- Joined: Sun, 21. Oct 07, 21:37
Is there a mod that makes your ships smarter?
For example, I tell my really expensive and heavily armed capital ship to attack a station and it attacks it alright - by crashing into it and destroying itself in the process, my other ships tend to crash into large objects they have been told to attack aswell, it's really annoying. 

-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
They have improved it, for sure. But the basics of how to move in certai situations, how to attack in different situations, how to follow etc. all needed a total rewrite.
For example, following ships should never exceed the speed of the ship being followed, and should sit in a careful formation about 2km away. Instead they buzz around like angry hornets until they smash into the nearest available solid object, which is usually the ship they are following. Ships protecting another ship should do exactly the same as follow, until a threat is determined, when they should peel away and deal with it.
The major part of collisions in attacking is because of the inherent descrepancy between the distance guns can fire, and the collision avoidance bubble. So either they never fire, or they collide.
For example, following ships should never exceed the speed of the ship being followed, and should sit in a careful formation about 2km away. Instead they buzz around like angry hornets until they smash into the nearest available solid object, which is usually the ship they are following. Ships protecting another ship should do exactly the same as follow, until a threat is determined, when they should peel away and deal with it.
The major part of collisions in attacking is because of the inherent descrepancy between the distance guns can fire, and the collision avoidance bubble. So either they never fire, or they collide.
-
- Posts: 111
- Joined: Fri, 7. Dec 07, 08:32
-
- Posts: 22555
- Joined: Sat, 23. Apr 05, 21:42
Not sure about the latter part.apricotslice wrote:No, this is an auto-pillok problem and is hardcoded.
Yes, the atomic operations are hardcoded. But, a script calls them. The script calls instruction to fly near to target. The script calls instruction to shoot.
Now, Capital ship has turrets, but no fixed weapons (except missiles). It should not fly "near target" in the first place. Just within (long) range weapons. Turrets shoot on their own, IS. (That is another point, there are no turrets nor collision OOS, so OOS routine should be different. See "OOS rebalance".)
Same with bombers. No point flying close at all. Just spam missiles from scanner/missile range.
There are scripts that make the bombers behave differently. Not sure about the Capital ships. But things like MARS by Gazz definitely change Capital ship effectiveness, because they make the turrets "smarter". No, that wont help with the ramming.
X3R had some AI rewrites, mainly for fighters.
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
The official line a while back was it was not going to be fixed.StarbuckAK wrote:well, here's hoping they fix it. they're the ones getting paid after all.
jlehtone, CBJ told me during one of the bug threads that the problem was hardcoded and too difficult to fix.
Sure, the scripts handle a lot of the actual movement, but its the underlying design that is at fault.
There should be at least double the number of movement types, and better decision making on which movement to use for which ship in which situation.
The biggest demonstration of auto-pillok is the basic one like this : Ship to station, with visible roid directly in between = splat. When the decision making algorithm cant even solve that one, its not designed right.
-
- Posts: 111
- Joined: Fri, 7. Dec 07, 08:32
-
- Posts: 424
- Joined: Thu, 20. Aug 09, 08:17
i may not know what im talking about here but ill give it a shot
i agree with yall about the problems and i think they could of done a better job with it but they went cheap and lazy but at lest it sort of works (with the exception of crashing 30 elites into a kha'ak station). and i would be intrested in seing the prototypes fore those scrips. they could of at leased used vector paths for the fighters so as not to do that (cut down in plotting to reduce in cpu usage) this would eliminate the collision problem in fighters mostly. capital ships could probably auto switch weapon loadouts in order to meat the situation. and instead of a direct path... orbit the targets or stations
i personaly have yet to witness an Epic battle where it ran smoothly but maby next game (provided that they continue with the great game series)

i agree with yall about the problems and i think they could of done a better job with it but they went cheap and lazy but at lest it sort of works (with the exception of crashing 30 elites into a kha'ak station). and i would be intrested in seing the prototypes fore those scrips. they could of at leased used vector paths for the fighters so as not to do that (cut down in plotting to reduce in cpu usage) this would eliminate the collision problem in fighters mostly. capital ships could probably auto switch weapon loadouts in order to meat the situation. and instead of a direct path... orbit the targets or stations
i personaly have yet to witness an Epic battle where it ran smoothly but maby next game (provided that they continue with the great game series)
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
Thats one of the problems, there is no orbit target while shooting script. And there wasnt a stand off and missile spam script either until the M8 came in, but its limited to them and not to any other ship carrying enough missiles.
The pathfinder code/collision avoidance was designed for X2, and immediately failed in X3 when they added all the extra non-nav-map roids. At that point, it should have been redesigned, but they chose not to.
Ironically, the best auto-pilot was in X2 v1.4 and later where I rarely ever had a collision of any kind. But X3 appears to have used an older version as its base. And TC never got an overhaul.
The only thing that has been changed is the behaviour of capital ships navigating an asteroid field, for which we are all very thankful !
The pathfinder code/collision avoidance was designed for X2, and immediately failed in X3 when they added all the extra non-nav-map roids. At that point, it should have been redesigned, but they chose not to.
Ironically, the best auto-pilot was in X2 v1.4 and later where I rarely ever had a collision of any kind. But X3 appears to have used an older version as its base. And TC never got an overhaul.
The only thing that has been changed is the behaviour of capital ships navigating an asteroid field, for which we are all very thankful !
-
- Posts: 2972
- Joined: Sun, 18. Jun 06, 13:37
so you are saying that there is a script lying somewhere that says what a ship should do? (in general)Yes, the atomic operations are hardcoded. But, a script calls them. The script calls instruction to fly near to target. The script calls instruction to shoot.
and what is its name?
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.
Ship Rebalance Mod
OOS Rebalance
Resized Aldrin Big Rock
SIDE/TOP/FRONT Ship Size Comparison
Remember young Padawan: money stolen can be, time cannot.
-
- Posts: 13244
- Joined: Fri, 13. Jan 06, 16:39
The scripts folder is full of them.
Without a script a ship does absolutely nothing. Move, fight, trade scripts... take your pick.
The problem is that there is no good way detect or even anticipate collisions since scripts only know the distance between the centers of 2 ships and the collision distance could then be 1m or 3000 m, depending on their rotation.
Once a ship performs the "Evade" action, it's most likely too late and often enough it does not transfer control back to the script but keeps executing the original movement instruction - just internally branching to evade.
So the script does not necessarily "know" it's ship is currently evading but under the impression that it's still executing an attack run or move to xyz instruction.
Without a script a ship does absolutely nothing. Move, fight, trade scripts... take your pick.
The problem is that there is no good way detect or even anticipate collisions since scripts only know the distance between the centers of 2 ships and the collision distance could then be 1m or 3000 m, depending on their rotation.
Once a ship performs the "Evade" action, it's most likely too late and often enough it does not transfer control back to the script but keeps executing the original movement instruction - just internally branching to evade.
So the script does not necessarily "know" it's ship is currently evading but under the impression that it's still executing an attack run or move to xyz instruction.
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.
-
- Posts: 111
- Joined: Fri, 7. Dec 07, 08:32
well then couldnt the distance from center just be used and make sure there is enough clearance at all times? longer gun range would be nice too if that could added.
i guess the problem lingers for the fighters as they fly almost aimlessly around the carrier and always dangerously close.... its cool sometimes to see them hug the carrier..... but boy do they collide sometimes. they go tearing through space at 500m/s and then they just cant figure out how to correct for sharp turns.
i guess the problem lingers for the fighters as they fly almost aimlessly around the carrier and always dangerously close.... its cool sometimes to see them hug the carrier..... but boy do they collide sometimes. they go tearing through space at 500m/s and then they just cant figure out how to correct for sharp turns.
-
- Posts: 2972
- Joined: Sun, 18. Jun 06, 13:37
more than distance... is there a way to say "shipspeed will decrease while the ship closes the nearest big thing"?
speed is the key, they cannot zip at 300 in a crowded battle, they will ram something.
If they are slow enough when is time to turn they will have enough time to actually turn.
speed is the key, they cannot zip at 300 in a crowded battle, they will ram something.
If they are slow enough when is time to turn they will have enough time to actually turn.
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.
Ship Rebalance Mod
OOS Rebalance
Resized Aldrin Big Rock
SIDE/TOP/FRONT Ship Size Comparison
Remember young Padawan: money stolen can be, time cannot.
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
Thats why all the ship speeds had a drastic decrease for X3. In order for the collision avoidance to actually work in time. If we still had X2 speeds, things would be a lot worse. Which is why those of us who put the speeds back to X2 style, have the most problems with the AP.
Gazz, thats interesting. What seems to be needed is a sub-routine that contains an array of all the ships, and their lengths and thus their half lengths. So when called, it returns a value that is the actual distance between the nose of the ship and the target object (or object in the way), which is instead used for collision avoidance computations. That might make the collision avoidance work better.
And we also need new ship commands, such as stand off at maximum missile distance and spam, and Fly around target (clock or anticlockwise) just inside max range of specific turrent or specific gun. For example, I always put ppc's in the left turrents of the M1, M2's I fly, so if I'm not flying them, I'd want them to circle the target keeping the left turrent aligned on the target.
Gazz, thats interesting. What seems to be needed is a sub-routine that contains an array of all the ships, and their lengths and thus their half lengths. So when called, it returns a value that is the actual distance between the nose of the ship and the target object (or object in the way), which is instead used for collision avoidance computations. That might make the collision avoidance work better.
And we also need new ship commands, such as stand off at maximum missile distance and spam, and Fly around target (clock or anticlockwise) just inside max range of specific turrent or specific gun. For example, I always put ppc's in the left turrents of the M1, M2's I fly, so if I'm not flying them, I'd want them to circle the target keeping the left turrent aligned on the target.
-
- Posts: 603
- Joined: Tue, 15. May 07, 20:43
It seems to me that this bit in !move.follow.template might be relevant:
I'm not a scripter by any means so maybe I'm misinterpreting things. I found that while trying to ascertain whether or not attack target of... would turn to protect the order target if it came under attack (I believe it does btw...). Anyway, couldn't we just add a fudgefactor bigger than 120?
Code: Select all
163 ||||if [THIS] == [PLAYERSHIP] AND $followonly
164 |||||$size = [THIS] -> get size of object
165 |||||$sizetarget = $target -> get size of object
166 |||||$size = ( $size + $sizetarget ) / 2 * 3 + 120
167 |||||$sizetarget = $target -> get current speed
168 |||||$size = $size + $sizetarget / 2
169 @ |||||$retvar = [THIS] -> follow $target with precision $size m : timeout=60000 ms
-
- Posts: 14163
- Joined: Sun, 16. May 04, 13:01
That did my head in.
My point is that a following ship shouldnt even be coming anywhere near the ship being followed. It should be on the same course, offset by 2 km or so, and half a 1km or 2 behind.
If I read that right, the offset factor is 120 meters, which is no wonder the following ships always ram you.
The whole thing needs redesigning.
Edit : Just thinking about the attack code. Any ship given the attack a target commands, should first work out if it can. So the size of the target and its orientation to the attacking ship need to be taken into account (if its side on, then the distance calculations must be on the width, not the length), with the size of the length of the attacking ship, thus giving the collision envelope. If the guns on the ship cannot fire effectively outside of the collision envelope, then the ship should refuse the order to attack. And the logistics of this change according to the aspect of the ship your attacking, be it end or on or side on, or part whichway.
This is whats wrong with the current code. There are 3 times the variables to work with than what it already does.
Most of the ships which crash into the target, probably should refuse the order because their guns cant actually fire before they have to turn away.

My point is that a following ship shouldnt even be coming anywhere near the ship being followed. It should be on the same course, offset by 2 km or so, and half a 1km or 2 behind.
If I read that right, the offset factor is 120 meters, which is no wonder the following ships always ram you.
The whole thing needs redesigning.
Edit : Just thinking about the attack code. Any ship given the attack a target commands, should first work out if it can. So the size of the target and its orientation to the attacking ship need to be taken into account (if its side on, then the distance calculations must be on the width, not the length), with the size of the length of the attacking ship, thus giving the collision envelope. If the guns on the ship cannot fire effectively outside of the collision envelope, then the ship should refuse the order to attack. And the logistics of this change according to the aspect of the ship your attacking, be it end or on or side on, or part whichway.
This is whats wrong with the current code. There are 3 times the variables to work with than what it already does.
Most of the ships which crash into the target, probably should refuse the order because their guns cant actually fire before they have to turn away.
-
- Posts: 22555
- Joined: Sat, 23. Apr 05, 21:42
Bit more than that.apricotslice wrote:If I read that right, the offset factor is 120 meters, which is no wonder the following ships always ram you.
120 + (this.size + target.size) * 1.5 + (target.speed / 2)
But as you said, the hardcode decides what the "with precision" means in practice.
IMO a station attack routine should be separate, because we can be quite sure that the station does not move, can we?

@Alkeena: "Protect .." and "Attack target of .." put the ship in formation with the "leader". When leader is under attack, it emits SIGNAL_ATTACKED to all members of the formation. "Signal handler" is a separate script that interrupts the current action, and in this case attacks the threat.
-
- Posts: 603
- Joined: Tue, 15. May 07, 20:43
Yep, that's pretty much what I'd muddled through after decompressing and working through a good chunk of my scripts directory. I'm just not a scripter because I haven't ever bothered to learn the syntax or available commands--I actually can code though, I write a lot of the analytic software for my lab. =)jlehtone wrote:
@Alkeena: "Protect .." and "Attack target of .." put the ship in formation with the "leader". When leader is under attack, it emits SIGNAL_ATTACKED to all members of the formation. "Signal handler" is a separate script that interrupts the current action, and in this case attacks the threat.
Anyway, I now use it instead of Protect as it seems far more general and useful for escorting combat craft.
Edit:
Alright, I just tried testing it. Sadly there were no discernible changes as I worked my way through several orders of magnitude on that 120 fudge factor. All the way up to 2 million didn't really seem to do a whole lot if anything. Anyone have any theories as to what follow precision actually means?
I would like to note that changes in speed dramatically effect following performance. If I slow down to 100 m/s my 450 m/s M5s can follow just fine in near perfect formation, but if I begin to accelerate they immediately begin to accelerate as well and seem to attempt to consistently lead my velocity by +~30 m/s...
Code: Select all
166 |||||$size = ( $size + $sizetarget ) / 2 * 3 + 120
167 |||||$sizetarget = $target -> get current speed
168 |||||$size = $size + $sizetarget / 2
1.5*(Size+TargetSize) + 120 + (TargetSpeed / 2)
Regardless...replacing the 120 with 2 mil should have been 10 times as significant as TargetSpeed as far as calculating precision is concerned, but varying my speed while I was being followed had an immediate and apparent effect on the formation while several trials with varying fudge factors demonstrated no discernible differences.
Anyway, I'm going to bed. I'll leave this in the hands of people that actually know what they're talking about

-
- Posts: 13244
- Joined: Fri, 13. Jan 06, 16:39
I think I saw a new 2.5 script command "Set desired speed" but I don't know what it affects or how.
As usual, it's not documented in any way. =)
Follow with precision
is hard to control because the closer the ship gets to a distance of precision, the lower it's desired speed gets.
In theory and practice that works perfectly fine and one ship following another is rarely an issue.
Now when you have 5 wingmen following you, their "working" follow course is constantly overridden by "evade other wingman". I assume that a ship can only evade one object at a time so when the airspace is cluttered with wingmen, one might crash into wingman A by evading wingman B.
Formations seem to be fully hardcoded and their density depends on the ships' sizes.
Would be nice if we could fake those ship sizes or set a formation "density".
What's the problem of using 2km more to space your formation? Real estate is cheap in X3.
I wonder what would happen if you added 1 (or 2 to keep the "middle" centered) paths to a ship's scene.
If the ship "gets bigger" by including these non-existant (= non-collidable) objects then all it's followers would automatically use a wider formation because that's a size that might also fool the hardcoded routines.
As usual, it's not documented in any way. =)
Follow with precision
is hard to control because the closer the ship gets to a distance of precision, the lower it's desired speed gets.
In theory and practice that works perfectly fine and one ship following another is rarely an issue.
Now when you have 5 wingmen following you, their "working" follow course is constantly overridden by "evade other wingman". I assume that a ship can only evade one object at a time so when the airspace is cluttered with wingmen, one might crash into wingman A by evading wingman B.
Formations seem to be fully hardcoded and their density depends on the ships' sizes.
Would be nice if we could fake those ship sizes or set a formation "density".
What's the problem of using 2km more to space your formation? Real estate is cheap in X3.
I wonder what would happen if you added 1 (or 2 to keep the "middle" centered) paths to a ship's scene.
If the ship "gets bigger" by including these non-existant (= non-collidable) objects then all it's followers would automatically use a wider formation because that's a size that might also fool the hardcoded routines.
Scripts only work with m and m/s.Alkeena wrote:What are the units/orders of magnitude of object size vs speed?
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.