Switeck's Shipping v0.5 OXP - Ai, Economy, and Ship changes
Moderators: winston, another_commander
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Re: Switeck_mod_v0.3b OXP - Ai, Economy, and Ship changes
Just saying that I'm very happy to see you guys making this effort.
Eliminating the friendly-fire-problems without having to retort to complicated checks in AI+script would be a major step forward, even if it catches 'only' most cases.
Eliminating the friendly-fire-problems without having to retort to complicated checks in AI+script would be a major step forward, even if it catches 'only' most cases.
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: Switeck_mod_v0.3b OXP - Ai, Economy, and Ship changes
But it does probably mean that you have to rewrite part of your cataclysme end-game. There a captured thargoid ship helps killing the thargoid invasion.Commander McLane wrote:Just saying that I'm very happy to see you guys making this effort.
Eliminating the friendly-fire-problems without having to retort to complicated checks in AI+script would be a major step forward, even if it catches 'only' most cases.
Or am I misremembering that the captured ship helps in the battle?
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Re: Switeck_mod_v0.3b OXP - Ai, Economy, and Ship changes
It does help, but it's a reverse-engineered Thargoid ship, not a captured one (that blew up in an earlier stage; perhaps you rescued the engineer who was tinkering with it at the time ). Therefore it doesn't have Thargoid scan class and will happily work together with other non-Thargoids.Eric Walch wrote:But it does probably mean that you have to rewrite part of your cataclysme end-game. There a captured thargoid ship helps killing the thargoid invasion.Commander McLane wrote:Just saying that I'm very happy to see you guys making this effort.
Eliminating the friendly-fire-problems without having to retort to complicated checks in AI+script would be a major step forward, even if it catches 'only' most cases.
Or am I misremembering that the captured ship helps in the battle?
And I have to re-write Cataclysm anyway some day. It doesn't work anymore at least since 1.74. It's just such an overwhelming task, given the size of the script.
Re: Switeck_mod_v0.3b OXP - Ai, Economy, and Ship changes
I'm all for consolidating the random check AND friendly fire check in 1 place,Eric Walch wrote:I also think that adding it inanother_commander wrote:Edit: Actually, I think it's probably best to put the friendly check inside -setTargetToPrimargyAggressor. addTarget is used in the code also for things other than combat targets.setTargetToPrimargyAggressor
is the best location. This command already has a random component in it when used from within a combat situation, that makes that it is not always setting a target and current AI code should already be prepared for that. And it still leaves the option to deliberately start a thargoid-thargoid war by using other commands for targeting. (setTargetToFoundTarget
or by using JS for setting a target)
I am not sure if we need the police check, as this is already dealt at other places in the code. But, doing it all in one place is probably clearer for the future.
setTargetToPrimargyAggressor
.I do think it might be useful to OXP designers if they could set and change via scripts how likely a particular ship is to "go postal" on its allies if they hit it.
Pirates are only loosely allied and would probably attack each other at the drop of a hat. There really shouldn't be a unified pirate side to begin with -- each pirate group may have NO love for other pirate groups. Or they may be mostly or all allied because they're really a revolutionary/insurgency force in-system.
Police would never counter-attack each other from friendly fire.
Traders almost never would. If anything, they'd probably have a frustration level that rises with each hit from an "ally". Sort of like a morale check. Failing a morale check can cause them to flee (most likely) or attack back (if really frustrated.)
Thargoids...well, that's depending on whether they're a hive mind or highly individual or all focused on the same goals for other reasons.
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Re: Switeck_mod_v0.3b OXP - Ai, Economy, and Ship changes
I assume that the check would have to be flexible anyway.
Equal scanClass, for instance, would only be a friendly-fire-criterion for Thargoids and possibly for CLASS_POLICE and CLASS_MILITARY, but obviously not for CLASS_NEUTRAL, which is shared by everybody else except stations.
Membership in the same group would be another criterion, and a very hard one at that. It would include mother & its escorts, and would also include wolfpacks, but not different wolfpacks with each other.
Equal scanClass, for instance, would only be a friendly-fire-criterion for Thargoids and possibly for CLASS_POLICE and CLASS_MILITARY, but obviously not for CLASS_NEUTRAL, which is shared by everybody else except stations.
Membership in the same group would be another criterion, and a very hard one at that. It would include mother & its escorts, and would also include wolfpacks, but not different wolfpacks with each other.
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
Re: Switeck_mod_v0.3b OXP - Ai, Economy, and Ship changes
I am about to introduce this method in ShipEntity, which will be called by
The code should be quite easy to read and shows the checks that are actually made, leading up to a decision whether a ship is firendly to another or not.
-setTargetToPrimaryAggressor
:
Code: Select all
- (BOOL) isFriendlyTo:(ShipEntity *)otherShip
{
BOOL isFriendly = NO;
OOShipGroup *myGroup = [self group];
OOShipGroup *otherGroup = [otherShip group];
if ((otherShip == self) || ([self isPolice] && [otherShip isPolice]) || ([self isThargoid] && [otherShip isThargoid]) ||
(myGroup != nil && otherGroup != nil && (myGroup == otherGroup || [otherGroup leader] == self)) ||
([self scanClass] == CLASS_MILITARY && [otherShip scanClass] == CLASS_MILITARY))
{
isFriendly = YES;
}
return isFriendly;
}
- Killer Wolf
- ---- E L I T E ----
- Posts: 2279
- Joined: Tue Jan 02, 2007 12:38 pm
Re: Switeck_mod_v0.3b OXP - Ai, Economy, and Ship changes
there should only be a given numbr of times you can friendly-fire something before it gets p155ed-off and logs you as an enemy tho, surely?
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
Re: Switeck_mod_v0.3b OXP - Ai, Economy, and Ship changes
I think that it would be best if we let scripters decide that. For now, battles starting up as a result of one single friendly fire shot seems to be a more imminent bug to fix rather than the possibility of repeated accidental shots not triggering a hostile reaction. As an additional clarification, the fix is not applicable to any player actions, since it is called only withinKiller Wolf wrote:there should only be a given numbr of times you can friendly-fire something before it gets p155ed-off and logs you as an enemy tho, surely?
-setTargetToPrimaryAggressor
, which is a method called by non-player ship AIs.-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
Re: Switeck_mod_v0.3b OXP - Ai, Economy, and Ship changes
The new code which will hopefully fix friendly fire incidents is now in trunk, r4518. Please test the nightly tomorrow and report back if any problems are encountered.
Re: Switeck_mod_v0.3b OXP - Ai, Economy, and Ship changes
I will certainly be testing it.
Ok, in the trial fix ...I still see Thargoid warships trade a few hits (or misses). But after maybe 2-5 shots, they go back to shooting at me. Good enough IMO.
Ok, in the trial fix ...I still see Thargoid warships trade a few hits (or misses). But after maybe 2-5 shots, they go back to shooting at me. Good enough IMO.
Re: Switeck_mod_v0.3b OXP - Ai, Economy, and Ship changes
Now for some AI.plist confusion on my part. I'm checking the changes in Oolite's AI files in the latest trunk relative some older ~v1.74.2 AI files.
In escortAI.plist something strikes me as really odd. In the "LOOK_FOR_BUSINESS" section, before I would assume the NPC ship is either an escort or possibly a member of a group there is this line:
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setStateTo: FLYING_ESCORT", "setAITo: interceptAI.plist");
How would it ever get that message?
Really leaving that wormhole in a hurry:Maybe "setSpeedTo: 0.50" was intended instead?
My other problem with escorts is I'm seeing them hanging around after their mother hyperspaces out instead of trying to enter the wormhole themselves. Is this because the mother ship's AI lacks a wormholeEscorts line in an appropriate place?
For route2sunskimAI.plist, I find it odd that it appears they can be <1 km from a star and can still hyperspace out. Or will they be forced into:
"WITCHSPACE BLOCKED" = (setTargetToFoundTarget, setDestinationWithinTarget, "setDesiredRangeTo: 10000.0", performFlyToRangeFromDestination);
...at least once?
In escortAI.plist something strikes me as really odd. In the "LOOK_FOR_BUSINESS" section, before I would assume the NPC ship is either an escort or possibly a member of a group there is this line:
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setStateTo: FLYING_ESCORT", "setAITo: interceptAI.plist");
How would it ever get that message?
Really leaving that wormhole in a hurry:
Code: Select all
"EXIT_WORMHOLE" = {
ENTER = (setDestinationToCurrentLocation, "setDesiredRangeTo: 7500.0", "setSpeedTo: 50", performFlyToRangeFromDestination);
My other problem with escorts is I'm seeing them hanging around after their mother hyperspaces out instead of trying to enter the wormhole themselves. Is this because the mother ship's AI lacks a wormholeEscorts line in an appropriate place?
For route2sunskimAI.plist, I find it odd that it appears they can be <1 km from a star and can still hyperspace out. Or will they be forced into:
"WITCHSPACE BLOCKED" = (setTargetToFoundTarget, setDestinationWithinTarget, "setDesiredRangeTo: 10000.0", performFlyToRangeFromDestination);
...at least once?
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Re: Switeck_mod_v0.3b OXP - Ai, Economy, and Ship changes
There's no hurry. 50 m/s is a reasonably slow speed. 0.5 m/s would be practically not moving at all, and the following ship would crash into the leader. After all, a ship may well be 100 meters long, and the following ship may spawn at the very same place only 2 seconds later. Therefore it's necessary that the leader gets 100 meters away, not only 1 meter. (It'sSwiteck wrote:Really leaving that wormhole in a hurry:Maybe "setSpeedTo: 0.50" was intended instead?Code: Select all
"EXIT_WORMHOLE" = { ENTER = (setDestinationToCurrentLocation, "setDesiredRangeTo: 7500.0", "setSpeedTo: 50", performFlyToRangeFromDestination);
setSpeedTo
:, not setSpeed[color=#FF0000]Factor[/color]To
Seconded. I witnessed the same thing again only yesterday in rev 4524. A mother launched from the main station with four escorts after her, then followed an apparently unrelated trader, and finally the last two escorts. By that time the mother had already jumped out, and the last escorts were orphaned right from the start. But also among the first four escorts only two followed their mother through its wormhole. I can't explain why this happens. The mother was a Monitor, by the way. Perhaps the ship is too fast and reaches jump distance too quickly?Switeck wrote:My other problem with escorts is I'm seeing them hanging around after their mother hyperspaces out instead of trying to enter the wormhole themselves. Is this because the mother ship's AI lacks a wormholeEscorts line in an appropriate place?
I guess so, depending on the star's size. EachSwiteck wrote:For route2sunskimAI.plist, I find it odd that it appears they can be <1 km from a star and can still hyperspace out. Or will they be forced into:
"WITCHSPACE BLOCKED" = (setTargetToFoundTarget, setDestinationWithinTarget, "setDesiredRangeTo: 10000.0", performFlyToRangeFromDestination);
...at least once?
performHyperSpaceExit
first calculates whether there is a blocking mass in the vicinity. If no, the ship receives WITCHSPACE_OKAY, if yes, it receives WITCHSPACE BLOCKED. If the ship doesn't have enough fuel or no motor, it receives WITCHSPACE UNAVAILABLE.Re: Switeck_mod_v0.3b OXP - Ai, Economy, and Ship changes
Only if the escorts fail to leave the station before the Monitor creates/hits a wormhole should that be the case.Commander McLane wrote:(It'ssetSpeedTo
:, notsetSpeed[color=#FF0000]Factor[/color]To
Seconded. I witnessed the same thing again only yesterday in rev 4524. A mother launched from the main station with four escorts after her, then followed an apparently unrelated trader, and finally the last two escorts. By that time the mother had already jumped out, and the last escorts were orphaned right from the start. But also among the first four escorts only two followed their mother through its wormhole. I can't explain why this happens. The mother was a Monitor, by the way. Perhaps the ship is too fast and reaches jump distance too quickly?Switeck wrote:My other problem with escorts is I'm seeing them hanging around after their mother hyperspaces out instead of trying to enter the wormhole themselves. Is this because the mother ship's AI lacks a wormholeEscorts line in an appropriate place?
I was seeing escorts that just prior were in formation with their mother not enter the mother's wormhole...but I'm pretty sure it was due to a bug in my modified AI.plist, apparently due to this:
Code: Select all
"ENTER_WORMHOLE" = {
"TARGET_LOST" = ("setStateTo: LOOK_FOR_BUSINESS");
Oops on the speed above. I had grown used to setSpeedFactorTo and forgotten the absolute setting setSpeedTo
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Re: Switeck_mod_v0.3b OXP - Ai, Economy, and Ship changes
It seems to me that in trunk (and I don't know since when; it could be also in 1.75 or 1.74) the interval between launches is longer than it was before. Each ship has already gone a considerable distance before the next ship gets launched. When the mother reaches jump distance (I just witnessed a case where a Boa jumped out at about 12000 meters away from the station), barely four of is escorts have launched. Escorts number five and six would only leave the station after their mother has already left the system.Switeck wrote:Only if the escorts fail to leave the station before the Monitor creates/hits a wormhole should that be the case.
This wasn't the case in previous versions of Oolite. Ships would launch fairly quickly after each other. A mother with six escorts had already built up their formation before the mother would reach jump distance and jump out.
I don't know what exactly has changed in the code to make the time between launches considerably longer, but this change certainly affects mothers with many escorts badly.
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: Switeck_mod_v0.3b OXP - Ai, Economy, and Ship changes
I thoroughly tested these AI additions. And it really is needed there. It can get the message there for two reasons.Switeck wrote:Now for some AI.plist confusion on my part. I'm checking the changes in Oolite's AI files in the latest trunk relative some older ~v1.74.2 AI files.
In escortAI.plist something strikes me as really odd. In the "LOOK_FOR_BUSINESS" section, before I would assume the NPC ship is either an escort or possibly a member of a group there is this line:
"GROUP_ATTACK_TARGET" = (setTargetToFoundTarget, "setStateTo: FLYING_ESCORT", "setAITo: interceptAI.plist");
How would it ever get that message?
- While negotiating for new business, it can already have a new owner before the AI switched states. There will be a pending "ESCORTING" message about that were the AI will react on on the next update. However, it is still possible that the new mother immediately issues a groupAttack command after accepting the escort. I added a new AI message for the mother when see accepts an escort. This should also prevent the buggy situation that the mother is attacking while the new escort is just escorting instead of helping.
- An other reason for the getting the message is that the mother looses her references to the escort group when jumping out. But she keeps a reference to the normal group. And when mom is no part of a bigger group herself, this normal group will be identical to the escort group. So, while not having escorts yet, when mom issues a groupAttack, this still might go to the former escorts.
This is already explained by others. I usedSwiteck wrote:Really leaving that wormhole in a hurry:Maybe "setSpeedTo: 0.50" was intended instead?Code: Select all
"EXIT_WORMHOLE" = { ENTER = (setDestinationToCurrentLocation, "setDesiredRangeTo: 7500.0", "setSpeedTo: 50", performFlyToRangeFromDestination);
speed
instead of speedFactor
so that all escorts reach their desired range in a known time.I don't know. I am not aware of any problems in this area. The location of the wormholeEscorts is critical and only works at a very specific moment. On the other hand, I can't see any reason to use it at an other moment than when mom herself jumps out. After that all AI actions of mom is frozen.[/quote]Switeck wrote:My other problem with escorts is I'm seeing them hanging around after their mother hyperspaces out instead of trying to enter the wormhole themselves. Is this because the mother ship's AI lacks a wormholeEscorts line in an appropriate place?
But the only way to understand all this is to switch AI logging on and carefully examine the order of the messages. There are sometimes surprises. e.g. when mom jumps out, the escorts will get a TARGET_LOST message. But when the player immediately follows mom, it can happen that the escort AI is also frozen before the TARGET_LOST is executed. But when negotiating with mom in the new system, this TARGET_LOST message could be still pending and interpreted wrong. Therefor I added a "dropMessages: " instruction. These things become only obvious after AI logging ant trying to understand each logged line.
UPS-Courier & DeepSpacePirates & others at the box and some older versions