Personalities.oxp

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

Moderators: another_commander, winston

Alnivel
Dangerous
Dangerous
Posts: 100
Joined: Fri Jun 10, 2022 7:05 pm

Re: Personalities.oxp

Post by Alnivel »

I got a bit carried away with the modification, so it's a bit more than "polishing" now, but anyway.

Changes:
  • requires Oolite 1.9 now
  • fixed several broken function calls
  • changed names of internal variables and resources to avoid conflicts
  • сhange in setting comms messages, it now requires a description.plist entry to be defined in format:
    "personalities-<personality name>-messageTypes" = "<list of space separated message types>";
  • added method for adding role to apppear on specified condition, such as system id, after some event etc. Usage example:

    Code: Select all

    worldScripts.personalities._addConditionalAppearance("personalities_daddyhoggy",
        function weight() {
    	    return galaxyNumber == 0 && system.ID == 147 ? 100 : 0;
        },		
        function position(type) {
    	    if(type === "LAUNCH")
    		    return undefined; // Use standart rules: spawn near station in space or via launching
    	    if(type === "EXIT_WITCHSPACE")
    		    return Math.random() < 0.5? new Vector3D() : undefined; // in half cases spawn near witchpoint
        });
    

Download

There is still a lot of work to be done here. For example, AI sometimes freezes for a couple of seconds after attacking it, sometimes it cannot decide whether it attacks the player or not. If I ever get around to changing the AI, and most likely I will try to rewrite it again, in plist form it scares me. It would also be nice to improve the talkativeness of the NPCs, from time to time they just say the same phrase - Disembodied once gave me the line "I hope you're insured!" three times in a row in one fight.

However, the main problem, of course, is too few personalities. You can send your personalities to me and I will be glad to try to implement them.
Also I will try not to forget to post instructions later on how to add new personalities on your own.

Edit: Posting in the middle of the night is not a good idea - before packing OXP I decided to disable the shiplibrary.plist file, but disabled shipdata.plist instead. The link now points to the corrected file.
Alnivel
Dangerous
Dangerous
Posts: 100
Joined: Fri Jun 10, 2022 7:05 pm

Re: Personalities.oxp

Post by Alnivel »

How to add personality

You need to do a couple of things:
  1. Make an entry about your ship in shipdata.plist. Among all parameters of the ship (you can take them as a basis from the game files or OXP where the ship is from), special attention should be paid to:
    • name - "shipname: charactername" goes here
    • ai_type - "personalitiesCruiserAI.plist" OR "personalitiesHunterAI.plist" OR "personalitiesPrivateerAI.plist" .
      You can also put your own AI script, but then OXP will only decide when to add your personality, and you have to implement everything else yourself.
    • script - If you use one of the suggested AI types, you need to use "personalities-ship-script.js" here
    • roles - you can read about it here
    • script_info - you can read about it (and also about standart AI types) here
    • pilot - if you use escape pod here you need to specify an entry from characters.plist
  2. Make sure that models, textures and shaders used be ship will be available not only for you. I think in most cases this will be to copy them to the appropriate folder of OXP and give them new names, including all references to them in the shipdata and models files.
  3. Add communication messages into desciption.plist.
    • there must be a record of what types of messages are used, "cholmondely" here - "name" from script_info :
      "personalities-cholmondely-messageTypes" = "attack attacked captured chatter dead flee jump kill launch witchspace";
    • and the messages themselves:
      "personalities-cholmondely-attack" = ("<Phrase to be sent when attacked>");
      "personalities-cholmondely-attacked" = ("<Either this phrase will be sent..>", "<or this one when ship attacked>");

If you have any questions, don't hesitate to ask, I'll be glad to help. Also I would like to hear if you have any ideas what else would be nice to add to the functionality of OXP.

And finally, the question: would someone want to limit the appearance of their personality to a single galaxy, or maybe only a certain set of systems?
Right now the "personalities" and "personalities_launcher" roles are used to choose personality to appear, but they are also used in the AI. If anyone is interested in the functionality above, I can change it so that the roles "personalities-galaxy-n" and "personalities_launcher-galaxy-n"(or something similar) will be used to determine if should personality appear in the galaxy sector, but then for those who can appear in any galaxy will have to add 8 or even 16 roles.
Alnivel
Dangerous
Dangerous
Posts: 100
Joined: Fri Jun 10, 2022 7:05 pm

Re: Personalities.oxp

Post by Alnivel »

Version 0.9.2

Changes:
  • new AI scripts, most personalities now use them
  • with new scripts standard communications keys can be used (however, it makes sense to use only those that are used by AI), old comms keys still works
  • fixed a bug in plistAI scripts that caused the ships themselves to never attack
  • pauses can be added to comms messages: "The message will be split{pause: 12}and the second half will be sent with specified delay"
  • appearance can be limited through the list of roles:
    1. "personalities personalities_privateer personalities_galaxy_any personalities_launcher_galaxy_any personalities_aodhan" -
      pirate by name "Aodhan" that can appear in any galaxy both in space and via launch from main station
    2. "personalities personalities_cruiser personalities_galaxy_0 ppersonalities_galaxy_1 personalities_galaxy_2 personalities_jameson" -
      trader by name "Jameson" that can appear only in Galaxy One, Two and Three and only in space
  • added methods for setting callbacks at escape pod scooping and unloading
  • added method to adjust spawn weight (for galaxies) in case if someone suddenly decides to use 100 ship variants with a weight of (0.01) each
Download link

I do not plan to add any new features more for now, but you can always suggest them.
The wiki page has also been updated - added more detailed instructions for adding your personality.
User avatar
Cholmondely
Archivist
Archivist
Posts: 4965
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Personalities.oxp

Post by Cholmondely »

Alnivel wrote: Sun Oct 23, 2022 10:23 am
Version 0.9.2
Impressive Sir! I'll be interested in seeing your representation in my game....
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
Cholmondely
Archivist
Archivist
Posts: 4965
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Personalities.oxp

Post by Cholmondely »

Alnivel wrote: Sun Oct 23, 2022 10:23 am
Version 0.9.2
Apologies, I've been flubbing the dub. Attempts to create my F-d-L failed dismally, and I just can't get my head around how to alter the AI. Plus, whenever I try anything in Javascript, it always goes pear-shaped... (my piddling about with .plists is only marginally more successful!). I've not even been able to work out to do more with phkb's new tweaks to Broadcast Comms (and that one, again, gets the imaginative juices flowing).

Extended Whine:
I suppose, trying to put it all into some sort of context, that I find Javascript a bit too much like black magic. I don't understand the formulae, and can never work out why things go wrong - which they always do. Hence, any enthusiasm to improve my knowledge is always met by a blast of icy water.

With the .plists, my trusty AppleMac Terminal's "plutil_" tells me if the script will work - and often directs me to the line which has the mistake. It's not perfect - I've been unable to get the Naval Carriers tucked away inside the Behemoth to appear in the Ship's Library, and am still failing dismally with the various ice-asteroids (despite your help), but I've gotten everything else to appear (50 items to date, all done by your nibs, pretty much on his tod!).

Edited to add:
Cholmondely wrote: Tue Oct 18, 2022 6:44 pm
Examples:
(Cast: Cholmondely, Araminta (fiancee), Benedict (butler))
◦ 
"personalities-cholmondely-attack" = ("<You perfidious philistine, prepare to plumb the depths of the Pool of Pellucid Placidity!>");

◦ "personalities-cholmondely-attacked" = ("<What-ho you earwig! Araminta will have your eyeballs for earrings!..>",
"<Benedict! Blast that blighter over there! He’s taking pot-shots at us!!>");
◦ "personalities-cholmondely-chatter" = ("<I say, old boy, do you happen to have any Lapsang Souchong tea by any chance?>",
"<What-ho! Nice day for a spot of Real Tennis, what?>" ,
"<Oh my giddy aunt! What the dickens are you up to?>");
◦ "personalities-cholmondely-dead" = ("<Keep that upper lip stiff, what!>");
◦ "personalities-cholmondely-flee" = ("<I say, Benedict, won’t this old crate go any faster, what?>”);
◦ "personalities-cholmondely-jump" = ("<Benedict, what does this button really do?>");
◦ "personalities-cholmondely-kill" = ("<Take that, you ghastly gertrude, you!>",
"<Heh-heh! That’s another blighter who won’t be having tea-cakes for his high tea!>”);
◦ "personalities-cholmondely-launch" = ("<I say, Benedict, should I really have pushed that button? [pause] Oh, look! Stars!! Why, Araminta, come and sneak a peek at this! And just look at all these people in their little tin-cans! What ever can they all be up to?>”);
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2637
Joined: Thu Jun 20, 2013 10:22 pm

Re: Personalities.oxp

Post by Redspear »

Cholmondely wrote: Mon Nov 07, 2022 2:09 pm
Edited to add:
Is there one for missile lauched?
Benedict, old stick! Load up the next one would you? There's a good chap.
User avatar
Cholmondely
Archivist
Archivist
Posts: 4965
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Personalities.oxp

Post by Cholmondely »

Redspear wrote: Sun Jan 21, 2024 12:49 pm
Benedict, old stick! Load up the next one would you? There's a good chap.
Fair dibs!





But what about YOU, Redspear?

What sort of behaviour should we expect from your ship if we ran across it in-game?
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
Redspear
---- E L I T E ----
---- E L I T E ----
Posts: 2637
Joined: Thu Jun 20, 2013 10:22 pm

Re: Personalities.oxp

Post by Redspear »

Cholmondely wrote: Sun Jan 21, 2024 2:55 pm
But what about YOU, Redspear?
Me? I don't have a personality ;-)

Cholmondely wrote: Sun Jan 21, 2024 2:55 pm
What sort of behaviour should we expect from your ship if we ran across it in-game?
It'd probably be lots of questionable mini-critiques e.g.
  • Killed, "You see, that's why the player should have access to the energy bomb."
    Sun-skimming, "This star could be much larger with a bit of system rearrangement."
    Launch, "What is this supposed to be? A moon."
    Chatter, "Masslocked again..."
    Flee, "They haven't got injectors have they?... They really shouldn't have injectors."
    Jump, "So for a ship this size with a grade of X and a tech level of Y, we should expect a jump distance of..."
If anyone wants that in their game then good luck to them.

As for a ship, the obvious one might be the lightspeeder but I'd have to think about that, especially as I've only tested it and never owned it... The neolite salamander and mussurana are others that I've long admired but never flown. But then there's Griff's Griffin, likewise his Bug and even Dertien's Tiger...
Post Reply