Page 14 of 20

Re: The Oolite NPC ecosystem (and other questions)

Posted: Thu Aug 22, 2013 8:06 pm
by cim
Disembodied wrote:
Which seems a shame - it would be good if the NPCs could read the situation, rather than having to rely on an overt cue.
If it's workable, definitely. I'd much rather avoid "how do I run away?" having to become a FAQ entry!
Disembodied wrote:
This sounds really good, and should create a variety of "intelligent" behaviours! It makes me hope even more that this intelligence can be fitted seamlessly across the game.
My main remaining concern is efficiency: most of the time it's no faster or slower than the current AI, but the AI reconsiderations (the equivalent to UPDATE: in the state machine) are expensive, so it's a lot easier for badly-written or buggy code to drag the frame rate down by repeatedly demanding reconsiderations, and I'm not sure how well it will work on hardware close to the minimum specs.
Disembodied wrote:
  • laser temperature (say, below 75%?)
  • speed (full speed/in the red)
  • pitch (within a small degree of level)
  • shields (at least one of them low/down)
  • heading (within the arc of "away").
This is definitely getting closer to what we need, I think. I'd probably want to add something about last shot time so that a player that's turned around to use their aft laser doesn't get counted as fleeing as they're heating up that laser, and maybe also if the player has an aft laser fitted require heading not to be so precisely "away" that they could shoot back. It still feels like it could happen too easily in a winnable dogfight, but it's getting closer.

Another possibility I've thought of is to store the "fleeing" state on the player ship, not on the NPCs. So then we can track a little bit of state without too much trouble. So something like:
  • condition red
  • last shot > 10 seconds ago
  • speed > 75%
  • energy < 25% and at least one shield < 25% or dumped cargo < 5 seconds ago
sets the "player fleeing" state. If you fire a weapon, unset that state, and don't allow it to be set again until energy has risen over 50% or more cargo is dumped. If condition reaches green or docked, unset it but allow easy reset; similarly if condition remains at yellow for at least 1 minute. The NPCs can then just read that state off the player ship.

Re: The Oolite NPC ecosystem (and other questions)

Posted: Fri Aug 23, 2013 8:58 am
by Disembodied
cim wrote:
Another possibility I've thought of is to store the "fleeing" state on the player ship, not on the NPCs. So then we can track a little bit of state without too much trouble. So something like:
  • condition red
  • last shot > 10 seconds ago
  • speed > 75%
  • energy < 25% and at least one shield < 25% or dumped cargo < 5 seconds ago
sets the "player fleeing" state. If you fire a weapon, unset that state, and don't allow it to be set again until energy has risen over 50% or more cargo is dumped. If condition reaches green or docked, unset it but allow easy reset; similarly if condition remains at yellow for at least 1 minute. The NPCs can then just read that state off the player ship.
That's a much better idea, to store the state on the player ... one thing concerns me re. using cargo dumping, though: if the player, acting as a pirate, attacks a merchant convoy, and is forced to flee, should dumping cargo help them here?

Should cargo dumping only be seen as an intimation of surrender by pirates? It could carry a lot of weight, for pirates (who would probably prefer the player not to be moving fast when they jettison cargo), and allow players to signal "fleeing" to pirates without having to get beaten up first, but be pretty meaningless to police, merchants, etc. (Bounty hunters I'm not so sure about - some of them might be "bribable", maybe?)

Re: The Oolite NPC ecosystem (and other questions)

Posted: Fri Aug 23, 2013 9:44 am
by cim
Disembodied wrote:
That's a much better idea, to store the state on the player ... one thing concerns me re. using cargo dumping, though: if the player, acting as a pirate, attacks a merchant convoy, and is forced to flee, should dumping cargo help them here?
Probably not. It might be necessary to make "flee perception" into a multi-value state, then, rather than a simple true or false, with "cargo" and "low energy" as different values.

On the other hand, the other fleeing criteria are fairly harsh - you can't really run "before it's too late" as such. When it's just the player in the fight, I think that's fair enough: maybe the trader would take a bit of time out of their day, against an outmatched pirate, to inflict a bit more damage on their ship to make it less likely they'd bother anyone else any time soon. In a multi-ship fight, though, they'd want to be breaking off and attacking someone else sooner (often even if it isn't genuine fleeing, it's just an attempt to break off temporarily to recharge and cool lasers)

Perhaps just the first two (three?) criteria could be used to set a "possibly fleeing" state, which is sufficient to break off an attack to fire on other hostile ships, but not enough otherwise? That should work fairly well even if the player isn't fleeing - it means their allies might actually be able to help them out.
Disembodied wrote:
Should cargo dumping only be seen as an intimation of surrender by pirates?
Pirates - and even then not always - are the only group who will switch from "destroy" to "repel" as a result of cargo dumping. But agreed that others shouldn't really see it as a gesture of surrender even if a "repel" state.

Re: The Oolite NPC ecosystem (and other questions)

Posted: Fri Aug 23, 2013 10:27 am
by Disembodied
cim wrote:
Pirates - and even then not always - are the only group who will switch from "destroy" to "repel" as a result of cargo dumping. But agreed that others shouldn't really see it as a gesture of surrender even if a "repel" state.
Should pirates be able to switch from "destroy" to "ignore", following cargo dumping? If a lightly armed player is confronted by a pirate pack - especially a pack that transmits a message saying "hand over your cargo" - then a sensible thing for the player to do is to eject a bunch of pods before the shooting starts. Then the pirates can say "beat it, schmuck", and the player can scuttle off, nursing dark thoughts of revenge, etc. But if the player dumps cargo, and the pirates - switched from "destroy" to "repel" mode - still open fire, then that might be a bit confusing. Or am I misreading what "repel" behaviour will be like?

Re: The Oolite NPC ecosystem (and other questions)

Posted: Fri Aug 23, 2013 10:48 am
by cim
Disembodied wrote:
But if the player dumps cargo, and the pirates - switched from "destroy" to "repel" mode - still open fire, then that might be a bit confusing. Or am I misreading what "repel" behaviour will be like?
Once you're considered fleeing - and dumping cargo and running will put you in that state even if you haven't taken a hit - an AI in "repel" state will ignore you (and if it doesn't already have you targeted, won't target you either). Generally they stop shooting within a few seconds, in practice.

(There's also a safeguard in the pirate AI so that they won't rob the same ship twice in a row, so the player is still safe even if they haven't quite got out of scanner range by the time all the cargo is scooped up)

Re: The Oolite NPC ecosystem (and other questions)

Posted: Fri Aug 23, 2013 11:19 am
by Disembodied
cim wrote:
Once you're considered fleeing - and dumping cargo and running will put you in that state even if you haven't taken a hit - an AI in "repel" state will ignore you (and if it doesn't already have you targeted, won't target you either). Generally they stop shooting within a few seconds, in practice.

(There's also a safeguard in the pirate AI so that they won't rob the same ship twice in a row, so the player is still safe even if they haven't quite got out of scanner range by the time all the cargo is scooped up)
OK, that sounds sensible ... what happens, though, in the following situation?

A player is confronted by a pirate pack; the player poops out some cargo before the pirates open fire; the player then continues onwards, towards the pirates (and the station), having "paid a toll", as it were. Will the pirates still shoot at the player when they get in range? Or will they be distracted by the cargo, and ignore the player, even though the player's flight path is taking them through the pirate pack? Basically, does the player have to drop cargo AND run away from the pirates, or is dropping cargo enough to pacify them?

Re: The Oolite NPC ecosystem (and other questions)

Posted: Fri Aug 23, 2013 11:31 am
by cim
Disembodied wrote:
Basically, does the player have to drop cargo AND run away from the pirates, or is dropping cargo enough to pacify them?
Dropping cargo should be enough in that situation.

Re: The Oolite NPC ecosystem (and other questions)

Posted: Fri Aug 23, 2013 12:16 pm
by Disembodied
cim wrote:
Dropping cargo should be enough in that situation.
Great! That does bring up some possible pirate-hunting techniques involving a few food canisters and a surprise attack when they're distracted. Not necessarily a bad thing, of course! Although maybe pirates should be more suspicious of obviously tooled-up ships ...

Re: The Oolite NPC ecosystem (and other questions)

Posted: Sat Aug 24, 2013 4:01 pm
by cim
Thanks for all the feedback on that one: it's in and working fairly well with only minor further tweaks needed. The next "assess the player's behaviour" question, then: what's the player's role? At the moment, it's effectively "trader", and pirates will treat them as one. This has various disadvantages: one of the major ones is that it's difficult for the player to be an effective pirate, and virtually impossible for them to assist an NPC pirate band without being robbed themselves.

(Note for compatibility: whatever solution gets used, player.ship.primaryRole will continue to return "player")

What I'm thinking of here is having a list of "role reputation" entries. I'm not sure how long it should be - lets say 50 of them for now. It really depends how "easy" it should be for the player to change role - bear in mind that role only really matters - along with legal status, ship type, etc. - for "first impressions": how NPCs should react to the player's appearance before the player starts actively interacting with them. Then, if you perform an action associated with a role, it fills one of the "role reputation" entries at random with that role, overwriting anything that was already there. So, for instance, if you leave a station while carrying illegal goods, that might increase your "smuggler" role. Then, when the game needs to know your role, it picks one randomly from the list of entries and uses it.

Roles I'm thinking of defining actions for in the core game: "trader" (legal goods), "trader-courier" (passengers/parcels), "trader-smuggler" (illegal goods), "pirate", "hunter", "miner", "pirate-interceptor" (police/hunter hunting). OXPs will be able to define their own roles and push a new reputation entry, and will also be able to read the reputation entry list (I don't think being able to directly write it is desirable)

Things I'm not really sure about:
1) Should empty entries be allowed in the list? If so, are they selectable by the role assessor (and what does that mean?), or do they just reduce the size of the pool roles can be selected from? If empty entries are allowed, should new "role events" preferentially overwrite empty entries, or should they be treated as any other slot?
2) What content should the "role reputation" list start with? (new players and continuing players are different questions here, obviously)
3) How persistent should role assessments be? Not at all? Each ship always assesses the same? Every ship in a system always assesses the same? etc...
4) Should reputation actively fade over time, or should that just be handled by replacement with new entries? What about on major "disconnection" events that might conceal a reputation - using an escape pod? a galactic witchdrive? buying a new ship?
5) How long should the list be? The shorter it is, the more short-term impact "new" actions have, and the less long-term impact "anomalous" actions have.
6) What actions should count for reputation in each category?
7) Should the core game track any other possible player roles? There are a few NPC roles - "escort", "defense-ship", "scavenger", "shuttle" - not currently tracked, but as it stands the player can't really "do" those roles without OXP support anyway.
8) What if any additional consideration should be given by NPCs to the player's role, over and above the reactions pirates have to "pirate victim" roles and to hunters? (e.g.: how should ships react to a clean or minor offender player with one of the pirate roles?)

I think I can get the basic idea to work regardless of the answers to the questions, so it depends what sort of feel you want the game to have, and what sort of OXP usage you'd like to be easier.

Re: The Oolite NPC ecosystem (and other questions)

Posted: Sun Aug 25, 2013 11:24 am
by Disembodied
This sounds really interesting ... one thing that occurs is that the game already has a very crude built-in reputation counter: the number of kills. This should certainly apply to point 8): NPCs should be a lot more impressed by the reputation presented by a player with a Dangerous rating than they would be by one with a Poor rating. So maybe the kill count should act as a multiplier or modifier: "This guy's a trader-courier" versus "This guy's a trader-courier who knows how to handle himself". This might work with point 5) How long should the list be? The shorter it is, the more short-term impact "new" actions have, and the less long-term impact "anomalous" actions have: the higher the kill rating, the longer the list should be. Maybe also, the more time a player spends in a system/group of systems/galaxy, the longer the list should be ... would it be possible to have reputations within certain geographical areas, so that a player can (to an extent) move to pastures new within the same galaxy, and shed (some of) their rankings?

Certain reputations should pull against each other, too: a player with a strong past "hunter" reputation should find it much harder to become accepted as a pirate (by other pirates) than a player with a strong past "trader" reputation. Perhaps it would be possible to create a legal-illegal axis? Something like

ILLEGAL---------------------------------------------------------------LEGAL
Pirate interceptor|--|Pirate|--|Smuggler|--|Miner|--|Trader courier|--|Trader|--|Hunter


(I stuck the miners in the middle on the assumption that they're a bit out on the fringes of society, and couriers come next as they're maybe a bit more duck-and-dive than regular traders.) If the default position, where players started, was "Trader", then their actions could move them faster or slower depending to their position on this axis. I don't mean that a "Trader" player who indulges in a bit of piracy might be viewed as a "Miner", say - only that it should be easier for a "Miner" player to gain a "Pirate" reputation than it would be for a player with a "Trader" reputation. A "Trader" player would have to accumulate more "pirate points" to be seen as a "Pirate" than a "Miner" would. Does that make sense?

For point 6) What actions should count for reputation in each category?:

Pirate interceptor: Killing police and bounty hunters (requires witnesses)
Pirate: Killing police, bounty hunters, traders, miners, etc. (requires witnesses)
Smuggler: Buying and selling illegal goods (buying should count for more - x3? - than selling, as there's always salvage, but still, "salvage" might just be an excuse)
Miner: Scooping splinters
Trader courier: Making parcel deliveries
Trader: Default option, probably - but leaving a station with a full or nearly full cargo hold should count
Hunter: Destroying pirates, earning bounty

One slightly tricky thing is telling the difference between a player-trader and a player-hunter, as the player can kill a lot of pirates on a trade run. The biggest difference I can think of is whether you leave the station with cargo in the hold. If I'm on a hunt, I don't buy any trade goods: I'll collect them on the way from the pirates. 1TC of scooped Alloys has the same profit margin as 1TC of the cheapest Computers sold on the poorest Ag world, so there's no point.

Over time, I think the reputation should tend back towards the default "Trader". This could be accelerated by ejecting, buying a new ship, or jumping to a new galaxy (probably not by much for ejecting; by quite a lot for buying a new ship; and perhaps a complete reset for jumping to a new galaxy). The "Trader" position could be made looser - i.e. easier to shift either towards Hunter or towards Miner/Smuggler/Pirate - if the player regularly leaves a station empty and docks next time full or nearly full (or with "more than X TCs on board, perhaps, since "full" depends on how big the ship is).

Something else worth keeping track of, perhaps, is the number of "Please stop!" and "Thank you!" messages received - maybe along with the number of escape capsules brought in. This might have an effect on how other ships respond to you. A "Pirate" who nevertheless brings in escape capsules would be viewed differently than a "Pirate" who never brings in escape capsules. Or - sudden thought - maybe bringing in escape capsules might have a multiplier effect on the reputation values of your actions for that trip? You'd be generating a lot more word-of-mouth ... perhaps, even, for pirates, it would be possible to track what happens to the escape pods produced by the player's actions? Dead pilots tell no tales: if a player wants to be a pirate, and not get a reputation for it, then they'd have to take pains to eliminate the escape pods, too ...

Re: The Oolite NPC ecosystem (and other questions)

Posted: Sun Aug 25, 2013 11:30 am
by JazHaz
I think NPCs should estimate the player role mainly from the ship type the player is flying. An obvious example is that if the player is flying an Anaconda, then NPCs should be able to assume the player is a trader. If the player is flying a fighter then either assume a bounty hunter role etc etc. Secondary decisions could be made from legal status of the player, and player behaviour.

Re: The Oolite NPC ecosystem (and other questions)

Posted: Sun Aug 25, 2013 11:36 am
by Disembodied
JazHaz wrote:
I think NPCs should estimate the player role mainly from the ship type the player is flying. An obvious example is that if the player is flying an Anaconda, then NPCs should be able to assume the player is a trader. If the player is flying a fighter then either assume a bounty hunter role etc etc. Secondary decisions could be made from legal status of the player, and player behaviour.
Yes, good point! Although there are definite crossovers: a Python could be a trader or a pirate or a smuggler (unlikely to be a bounty hunter); a Cobra III could be pretty much anything, etc. ... maybe the starting point could be the NPC roles in the shipdata.plist?

Re: The Oolite NPC ecosystem (and other questions)

Posted: Sun Aug 25, 2013 12:36 pm
by cim
JazHaz wrote:
I think NPCs should estimate the player role mainly from the ship type the player is flying.
Possibly. Though they can infallibly tell the difference between a Cobra III trader and a Cobra III bounty hunter and a Cobra III pirate if flown by NPCs. I suspect most of the popular player ships, core and OXP, could be best described as "multi-role".
Disembodied wrote:
maybe the starting point could be the NPC roles in the shipdata.plist?
The difficulty with this approach is that there's currently no way to calculate the NPC roles from the player ship. The player ship always has "roles" = "player"; and while it might be a like_ship of an NPC variant, that's not guaranteed (and like_ship information is currently discarded after use anyway). I could add some extra shipyard.plist parameters, but then all OXP ships would need updating.
Disembodied wrote:
NPCs should be a lot more impressed by the reputation presented by a player with a Dangerous rating than they would be by one with a Poor rating. So maybe the kill count should act as a multiplier or modifier: "This guy's a trader-courier" versus "This guy's a trader-courier who knows how to handle himself".
This is partly in already, in that combat rating is used to calculate the player's "accuracy" for the combat assessments, but it's currently only visible to NPCs if the player is in combat. I could make it visible to the NPCs out of combat too - should the player then be able to get a similar assessment of NPCs via the Scanner Targeting Enhancement?

Making the reputation decay slow down as kill count increases is certainly plausible (I'd say "no decay" for Elite pilots - my personal canon has so few Elite pilots that the average spacer can probably name most of them from memory)
Disembodied wrote:
Perhaps it would be possible to create a legal-illegal axis?
Yes, perhaps. Or... maybe rather than picking a random entry from the list to determine perception, have the entire list be visible to NPCs, and the more cautious ones will just require a substantial ratio - perhaps 10:1 pirate over hunter before pirates will accept you, for example. If decay is from a random point rather than chronological, getting those last couple of points of hunter out could be quite tricky...
Disembodied wrote:
(requires witnesses)
Making this work without a lot of bookkeeping to track which witnesses to an event might plausibly have survived I think is tricky. Simple case: open fire on one pirate, and its friend will witness this. How long does its friend have to survive before the reputation is credited?

I'm viewing the role map as quite a bit more abstract than things like "legal status" which need an in-game justification for how people know them - it's more a substitute for the quick assessments that an NPC might do when the player's ship first comes on to the scanner. You might not have witnesses to your piracy, but the number of barrels you bring in without any shipping records is going to give you a reputation anyway, even if the law can't prove it.
Disembodied wrote:
One slightly tricky thing is telling the difference between a player-trader and a player-hunter
I've been considering initiation of hostility as the key for this: if you fire on the pirates first, that's "hunter". If they fire on you first, doesn't matter how many of them you kill, that's still "trader" (or whatever else you were doing). You can get a reputation as a hunter without killing anyone - an unsuccessful one, sure, but I don't want role to depend too much on how successful you are - there are separate counters already for success: parcel rep, kill count, credit balance, legal status, etc.

Re: The Oolite NPC ecosystem (and other questions)

Posted: Sun Aug 25, 2013 1:27 pm
by Disembodied
cim wrote:
This is partly in already, in that combat rating is used to calculate the player's "accuracy" for the combat assessments, but it's currently only visible to NPCs if the player is in combat. I could make it visible to the NPCs out of combat too - should the player then be able to get a similar assessment of NPCs via the Scanner Targeting Enhancement?
Possibly - it might be good to be able to display an NPC ship's Elite ranking (which could be linked to its accuracy rating) along with their legal status. It should also be at least loosely linked to what sort of ship/how well-equipped they are: a Dangerous pilot should - usually - be flying a better (or better-equipped) ship than a Poor one. I don't know what the quantities of the various rankings should be, though - I definitely agree that "Elite" pilots should be very, very rare. Linking the role-decay to the Elite ranking seems sensible.
cim wrote:
I'm viewing the role map as quite a bit more abstract than things like "legal status" which need an in-game justification for how people know them - it's more a substitute for the quick assessments that an NPC might do when the player's ship first comes on to the scanner. You might not have witnesses to your piracy, but the number of barrels you bring in without any shipping records is going to give you a reputation anyway, even if the law can't prove it.
Is it possible to make these assessments more accurate the more time a player stays in a certain volume of the galaxy? That would need an "uncertainty factor" built in to fog any reputation score, which diminishes the more times a player visits a system/group of systems.

Bringing in cargo without records should be a reinforcer of ranking, I think, and not a defining characteristic itself: it's going to be common to pirates and to bounty-hunters. It should definitely make people less likely to think you're a trader (or maybe label you as "scavenger/salvager"?), but shouldn't define you as either a pirate or a hunter without corroboration. But it could amplify your pirate rep or your hunter rep.
cim wrote:
I don't want role to depend too much on how successful you are
Yes, good point.

Re: The Oolite NPC ecosystem (and other questions)

Posted: Sun Aug 25, 2013 3:13 pm
by cim
Disembodied wrote:
I don't know what the quantities of the various rankings should be, though
It's tricky. Real-world fighter aces are "Poor" or extremely rarely "Average" by the standards of the Elite Federation of Pilots. The population of Cooperative space is ~8.1 trillion, so a knockout tournament to find the best pilot would only take 43 rounds: again "Average"...

So that suggests most fights are incredibly unfair ones (or that escape pods should be a lot more common), and most NPCs should be "Harmless" or rarely "Mostly Harmless".

On the other hand, however, I don't want it to be giving the impression that HIMSN contact the player for Constrictor Hunt because they're the best pilot in the chart... my interpretation is that HIMSN put out a general bulletin, and the player happens to be the first person with the skill to do it, the recklessness to try, and the naivety not to ask for payment in advance: it's completing that mission which first marks the player out as different.

From a practical perspective, the basic AIs are probably only deserving of those ranks anyway: they aren't really capable of tactics better than "point weapon at target". At the upper end, a top accuracy AI probably deserves Competent - and I'm largely out of ideas for extra tactics to make them better than that anyway. Actually putting "Harmless" or maybe "Mostly Harmless" by all the ships doesn't feel right, though.
Disembodied wrote:
Is it possible to make these assessments more accurate the more time a player stays in a certain volume of the galaxy? That would need an "uncertainty factor" built in to fog any reputation score, which diminishes the more times a player visits a system/group of systems.
Maybe the easiest way is to log the last ten (or perhaps lengthen the list with combat rank?) visited systems, and then only apply on-hyperspace reputation decrease if you enter a system not on that list. If you're hopping around a local area, you'll virtually never get that happening. A cross-chart trip and you'll be shedding reputation every stop.
Disembodied wrote:
Bringing in cargo without records should be a reinforcer of ranking
Oh, definitely. I don't think I actually want to go to the trouble of labelling up all the cargo pods anyway - leave that to more simulationist games, I think. More as a handwave for why witnesses might not be strictly needed.

I suppose what I'm trying to do is simulate for the NPCs the way that the player can tell the difference between a trader with escorts, a pirate pack, and a bounty hunter pack, just from the way they're flying - without having to go to the extent of actually capturing that intuitive test.