Ship-to-Ship Comms OXP

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Ship-to-Ship Comms OXP

Post by phkb »

With regard to requestDockingInstructions, I call the function and get a message like "Xeaten Station here. We have uploaded docking instructions to your flight console." No further messages come. If I send the request again nothing happens, so I'm assuming it's waiting for my ship to do something. If I try and dock I get fined for not following the protocol.

Unless there's something obvious I've missed, I going to call this one as "too hard for now" and move on.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Ship-to-Ship Comms OXP

Post by cim »

Definitely going for the autodock route. What it expects is that you'll carry out the docking instructions returned by requestDockingInstructions, then call the method again to get the next step of the instructions. If you do that successfully enough times it probably will let you dock without fines, but you'll need to do quite a bit more work to give the player the necessary flight instructions.
Zireael
---- E L I T E ----
---- E L I T E ----
Posts: 1396
Joined: Tue Nov 09, 2010 1:44 pm

Re: Ship-to-Ship Comms OXP

Post by Zireael »

Phkb, how's the basic functionality coming along? Seeing as docking requests are a bit more problematic...

(3 more days until I can play Oolite again :D)
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Ship-to-Ship Comms OXP

Post by phkb »

What I have at the moment is a functional environment, but nothing that actually changes the gameplay. The MFD will display different message options based on what is currently targeted and the alert status. It will keep track of who you have sent a greeting to since your last launch, and remove that option when a ship is re-targeted. It will check if the targeted ship has cargo when determining whether to offer the "Drop 5 ton of cargo" message.

At the moment, you can send greetings, taunts and threats, and ships will respond to these messages after a suitable delay (ie, not straight away, so it looks more like they thought about the response). You can also ask if anyone is going to your destination system, and ships may choose to respond positively or negatively (ie. "Sure I'm going there. Tag along", or "Sorry, I'm going somewhere else").

Here's a question for everyone, though. If the player's alert status is "RED", should I hide the "Send greeting" option. It seems like an unnecessary option during combat, so my feeling is I should, but I'd like to hear some other opinions.

Anyway, the next phases of development are:
- Work out how to nudge the AI of NPC ships (eg, sending a taunt to a NPC firing at your could either make the NPC more accurate for a few seconds, or less accurate, or nothing at all. Sending a threat to a NPC brings in the small chance the ship might break off, based on it's own weaponry and the players, it's legal status and the players kill count. Sending a greeting to a NPC might make the NPC slight less likely to fire at the player)
- Work out how to tell an NPC ship to drop 5 tons of cargo without actually firing a shot.
- Work out how to tell NPC's "I surrender!" in a meaningful way
- Work out if it's possible to send a "I'm sorry" message to police or stations if you accidentally fire at them. Can their response be reduced to "OK, well, dock and pay a fine and we'll overlook it this time"?
- Building up a good set of transmissions and responses
- Testing with a variety of OXP's that I don't normally use.

Another thing I'd like to incorporate is a way for other OXP's to leverage the system. ie. an mission OXP can add a specific message to the list for specific targets, and have certain actions triggered when that message is sent. If someone can tell me of some OXP's that have ship-to-ship comms in them (like mission OXP's), I might have a look at what's been done before and how it could possibly use this system. But that's a longer term goal.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Ship-to-Ship Comms OXP

Post by phkb »

Another question: What's the simplest method of making an entire pirate group leave the player alone, or decide to stop attacking? Completely, no refunds.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Ship-to-Ship Comms OXP

Post by phkb »

And another question: Is there a simple way of assessing the power of one ship over another? ie. comparing a Krait to a Cobra, or a Sidewinder to a Fer-de-lance.

Edit: Actually I think I found this one: ship.threatAssessment.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Ship-to-Ship Comms OXP

Post by cim »

phkb wrote:
- Work out how to tell an NPC ship to drop 5 tons of cargo without actually firing a shot.
For a ship with a JS AI, target.AIScript.oolite_intership.cargodemand = 5;. You'll need to set the target to red alert somehow for it to notice the demand, which is easier to do by attacking it.
phkb wrote:
- Work out how to tell NPC's "I surrender!" in a meaningful way
So long as the player is running away and not firing, NPCs will interpret that as surrender. It's just that many of them don't care... You can try removing the player from the target and defense target lists of nearby NPCs, and going from there.
phkb wrote:
- Work out if it's possible to send a "I'm sorry" message to police or stations if you accidentally fire at them. Can their response be reduced to "OK, well, dock and pay a fine and we'll overlook it this time"?
1.80 does have situations in which a Clean pilot can hit a police ship or Coriolis and get away with it. If you want to add more, then probably the same mechanisms as surrender (though hitting the Coriolis is likely to put the player's bounty too high for a surrender to be accepted)
phkb wrote:
Another question: What's the simplest method of making an entire pirate group leave the player alone, or decide to stop attacking? Completely, no refunds.
If the pirates attacked the player as a robbery, the detargeting (see "surrender" above) will work, and they won't attack the player again until they've tried to rob someone else, but once that's been done the player is fair game again.
If the pirates attacked the player because they thought the player was a bounty hunter and they wanted to get in first, they'll just do it again if you detarget them.

You can edit their target.AIScript.playerRole variable (on all ships in the group) to change it to something pirates will ignore.
phkb wrote:
And another question: Is there a simple way of assessing the power of one ship over another?
You want the ship.threatAssessment method.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Ship-to-Ship Comms OXP

Post by phkb »

For the dump cargo issue, could I run the "target.dumpCargo()" function, then do "target.performFlee()". Would that achieve the same thing?

For getting a pirate band to flee, how can I tell if the band is robbing you, as distinct to just wanting to kill you for the bounty?

Edit: Also, how can I tell the target is part of a pirate band, and find all the other members of the band?
Edit: One question from before: the "shipTargetLost" doesn't appear to fire when the player's target enters a wormhole. What event should I be looking at?
Last edited by phkb on Thu Jul 31, 2014 7:52 am, edited 2 times in total.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Ship-to-Ship Comms OXP

Post by phkb »

cim, by the way, my summary back a few posts wasn't to indicate I hadn't read your earlier posts where you answered some of the questions. Sorry if it came across that way. I was just pointing out the progress I had made and where work is still to be done. All your suggestions have been really helpful and I don't want you to think I've rejected anything.
Zireael
---- E L I T E ----
---- E L I T E ----
Posts: 1396
Joined: Tue Nov 09, 2010 1:44 pm

Re: Ship-to-Ship Comms OXP

Post by Zireael »

wow, phkb, you must be really good at programming if you managed to get that much done so quickly!
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Ship-to-Ship Comms OXP

Post by cim »

phkb wrote:
For the dump cargo issue, could I run the "target.dumpCargo()" function, then do "target.performFlee()". Would that achieve the same thing?
Probably better would be

Code: Select all

target.target = player.ship;
target.performAttack();
target.AIScript.oolite_priorityai.reconsiderNow();
after setting the demand. That way, if the player's target feels outclassed it'll switch to cargo dumping mode in a second or two, while if it (and its escorts) think they can take the player on, they won't dump cargo without a fight.
phkb wrote:
For getting a pirate band to flee, how can I tell if the band is robbing you, as distinct to just wanting to kill you for the bounty?
Check the pirate AI. If they're in the middle of a robbery they'll have target.AIScript.oolite_intership.cargodemanded be the desired amount. That won't tell you if they're robbing the player or merely attacking the player because they interfered, but it doesn't really matter.
phkb wrote:
Edit: Also, how can I tell the target is part of a pirate band, and find all the other members of the band?
Being certain about this is difficult.

Code: Select all

Ship.roleIsInCategory(ship.primaryRole,"oolite-pirate");
is probably the most reliable way to tell if a ship is a pirate. ship.group will then find the rest of them.
phkb wrote:
Edit: One question from before: the "shipTargetLost" doesn't appear to fire when the player's target enters a wormhole. What event should I be looking at?
That may be a bug. I'll investigate further.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Ship-to-Ship Comms OXP

Post by phkb »

Zireael wrote:
wow, phkb, you must be really good at programming if you managed to get that much done so quickly!
Well, programming is my day job!

cim, regarding the dump cargo response, in order to determine the response of the target (either "Here's some cargo", or "I'll fight you for it"), would I be able to look at "target.isFleeing", or "target.isPirateVictim"?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Ship-to-Ship Comms OXP

Post by phkb »

And a general OXP development question: is there a script I can use to easily put some specific ships in scanner range? Testing this OXP would be a lot simpler if I could launch and find a certain target to test on.
User avatar
Norby
---- E L I T E ----
---- E L I T E ----
Posts: 2577
Joined: Mon May 20, 2013 9:53 pm
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Contact:

Re: Ship-to-Ship Comms OXP

Post by Norby »

phkb wrote:
target.isFleeing
This maybe useful, the another is surely not (a constant).
phkb wrote:
put some specific ships in scanner range

Code: Select all

system.addShips("[adder]", 1, PS.position.add(PS.vectorForward.multiply(10000)),1000);
or

Code: Select all

var ships = system.addShips("pirate", 5, PS.position.add(PS.vectorForward.multiply(10000)),5000);
for(var i=0; i<ships.length; i++) {
  if(ships[i]) ships[i].displayName = i+". Pirate "+ships[i].displayName;
}
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Ship-to-Ship Comms OXP

Post by phkb »

Thanks, Norby. That's very helpful.
Post Reply