Fractal Softworks Forum

Starsector => Mods => Modding => Topic started by: Morrokain on May 09, 2020, 03:14:16 PM

Title: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on May 09, 2020, 03:14:16 PM
Mod Page Under Construction

This WIP mod expands fleet dialogue options for npc fleets.

The current options are:

1) Commodity Requests (Fuel, Supplies, Credits)
Examples:
Spoiler
(https://i.imgur.com/38XSjJx.png)]
(https://i.imgur.com/wMP6Muu.png)
(https://i.imgur.com/4l4MQ8I.png)
(https://i.imgur.com/4N5WDqk.png)
(https://i.imgur.com/m0PzHgU.png)
(https://i.imgur.com/1bquqyq.png)
(https://i.imgur.com/l8nAKFO.png)
(https://i.imgur.com/6c1oNOM.png)
(https://i.imgur.com/J6hIcR9.png)
(https://i.imgur.com/3YbkHMU.png)
(https://i.imgur.com/KmkIssH.png)
(https://i.imgur.com/UJTY9cZ.png)
(https://i.imgur.com/utY6Zwo.png)
(https://i.imgur.com/BbGiJ9z.png)
(https://i.imgur.com/j1QC5Es.png)
(https://i.imgur.com/IREPtgE.png)
(https://i.imgur.com/nVbD4dg.png)
(https://i.imgur.com/6FKfFFR.png)
(https://i.imgur.com/W8NdYOp.png)
[close]

2) Ceasefire Negations (Can also use bribes to increase the chance of success)
Examples:
Spoiler
(https://i.imgur.com/I0glBgq.png)
(https://i.imgur.com/HGQO5Up.png)
(https://i.imgur.com/mIrd3FE.png)
(https://i.imgur.com/KSAvu0r.png)
(https://i.imgur.com/zBrnFHj.png)
(https://i.imgur.com/5mPOiTR.png)
(https://i.imgur.com/sY5HXKH.png)
(https://i.imgur.com/e7g2awy.png)
(https://i.imgur.com/qhCnsNn.png)
(https://i.imgur.com/xnL162E.png)
(https://i.imgur.com/fwRD6x7.png)
(https://i.imgur.com/MJHBP5P.png)
(https://i.imgur.com/NaqALD6.png)
(https://i.imgur.com/oRa4rTR.png)
(https://i.imgur.com/jtaqs3D.png)
(https://i.imgur.com/qblElqB.png)
(https://i.imgur.com/i5I7mFp.png)
[close]

Mod Compatibility Information:

For those mods who implement their own dialogue, that dialogue will not spawn this mod's dialogue options. A couple examples: Coalition, Dassault-Mikoyan Engineering

However, mods that use the standard default fleet dialogue from vanilla for their mod faction will have the options populated. Example: Diable Avionics

Opt In/Out Options: the mod plugin can be set up to crash the game if Fleet Dialogue is active, so that is one way a modder can easily get around this. Another way would be to just implement custom faction dialogue using the unique mod id to prevent the default vanilla dialogue from being used.

There isn't an easy way around this on my side since many vanilla factions rely upon the defaults, but as an olive branch if there are particular modder/modders who really don't want to add custom dialogue for their faction or an exclusion in the mod plugin and also don't want these options available: Post here with a link to the mod page and I will try and add a "not this faction" check to the defaults and I *think* that should allow the original defaults in vanilla to still populate for that faction without the dialogue options. That is very much an educated guess though, and will be done in an "upon request" kind of way.

Similarly, if you have implemented custom dialogue for your mod faction, and would like these options to be included in the interim between release and if/when I can set up some way of doing this in the mod faction's directory, you can post here and I will implement the dialogue with the necessary script in this mod.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on May 09, 2020, 03:18:23 PM
**Reserved**
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: MesoTroniK on May 09, 2020, 10:49:37 PM
Morrokain, I hope this will be opt-in for mod factions.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on May 10, 2020, 02:11:10 AM
Morrokain, I hope this will be opt-in for mod factions.

It should only affect vanilla factions and Archean Order factions from what I can can gather, but that is part of the reason this is under construction. I want to provide an opt-in way for mod factions to provide dialogue or otherwise opt out of the feature, eventually, but I want to make sure it doesn't actually cause unintended dialogue in mods otherwise. So, testing has commenced in that sense. I can't promise for sure, but as it stands it should strictly be limited to vanilla factions, for now. That is the intention anyway.

The likely scenario is that it will be an opt-in situation in the future. Right now, for instance, it requires overrides of vanilla fleet encounter dialogue to run the necessary rules, anyway, so it would require custom adding of non-existing (potentially to another mod) rules scripts to even interact with the system. You have to run a specific script to get the necessary options. Since mods that add dialogue don't include this script, it won't theoretically affect mod factions in any way until I give them a lever to do so.

That is part of the hurdle of addressing mod inclusions in the first place, but rest assured this shouldn't affect the mod factions until they choose to be included!
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: cathar on May 13, 2020, 02:19:10 AM
This is a really cool idea. Should really expand especially the early game when you might have some credits from salvaging but not a big enough fleet for all the engagements.

I wanna do kind of pacifist run next so being able to negotiate with hostile fleets is perfect.

Would this be safe to add to an existing playthrough?


Also, I don't really understand the previous poster's complaint. Does it mean that for now this will only happen with vanilla faction fleets?
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: AxleMC131 on May 13, 2020, 03:38:17 AM
Also, I don't really understand the previous poster's complaint. Does it mean that for now this will only happen with vanilla faction fleets?

MesoTroniK is implying that THIS mod should not automatically override the dialogue of OTHER mods that add custom factions. Rather, he is suggesting that other mod authors are able to "opt-in", to have the custom dialogue options if they choose, but if they do nothing then their content will be unaffected by this mod. This ensures that other mods that already have custom dialogue and interactions don't get overwritten.

Morrokain responds and reassures that right now, this mod only operates for vanilla faction interactions, so by default should not affect mod factions.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on May 13, 2020, 01:04:09 PM
This is a really cool idea. Should really expand especially the early game when you might have some credits from salvaging but not a big enough fleet for all the engagements.

I wanna do kind of pacifist run next so being able to negotiate with hostile fleets is perfect.

Would this be safe to add to an existing playthrough?


Also, I don't really understand the previous poster's complaint. Does it mean that for now this will only happen with vanilla faction fleets?

Thanks I should hopefully have a download available soon. I'm still testing but everything seems to work so far.

It should be safe to add to an existing playthrough, yes, and as AxleMC131 already explained it should only affect vanilla factions (well and Archean Order but those aren't stand alone yet and the TC version has this mechanic built in already) until I can provide a way for other mods to opt in. I have to be completely honest there, it may take a while to make that happen. It will probably require a complete restructure of the code to make that work. The modifications to the values that determine interaction results are all hardcoded, and there are a lot of them. I will need to change the code to read from a file, probably, and then mod authors can edit their own interaction values such as "chance to give aid", "cost of aid when forced to pay", "how likely will bribes work", "what types of bribes are best", "cost of base bribe amount", etc.

Even should I do all of that, the script to populate the dialogue options still fires from the standard greetings, and since mod authors won't have that script available in their mod, if they tried to implement their own greetings including the script the game wouldn't load. Therefore, I have to find a way around that somehow. That could prove to be very tricky to do. Frankly, I'm not even sure if it is possible.

I also have to add custom dialogue for most of the vanilla factions because right now they work on the "default" dialogue which only has about 3-5 responses for each scenario. It's still a lot of dialogue (trust me) but I want to eventually flesh it out even more and make interactions feel as unique as possible. Pirates and Luddic Path have custom dialogue for the most part.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: cathar on May 15, 2020, 10:34:03 AM
I still don't really understand why a mod author should not want their fleets to have expanded dialogue provided by a different mod.

For me as a player, I'd want all fleets in the game affected by this modification in the same way.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on May 15, 2020, 02:09:13 PM
I still don't really understand why a mod author should not want their fleets to have expanded dialogue provided by a different mod.

For me as a player, I'd want all fleets in the game affected by this modification in the same way.

I definitely understand where you're coming from. The best way I can describe the complications that can arise from this sort of thing is that replacing the core greetings for other mods might prevent their dialogue from populating correctly unless they weight it higher than mine- which would require coordination between myself and all other modders that add dialogue this way. If that wasn't done properly, you could have situations where you would talk to the npc and either get the wrong response or in the worst case scenario get caught in a dialogue with no responses and have to reload if not in dev mode.

Or you could theoretically be on a quest for another mod that requires talking to a fleet. If my options override the dialogue for that fleet, then the quest can't be completed, etc.

I'm not sure if that would actually happen, of course, but I get the concern.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: AxleMC131 on May 15, 2020, 03:02:56 PM
Aye, Morrokain covers it as well as I can think of.

There is also a more subtle argument, which is that mods should NEVER affect the function of other mods in such a way without permission. There doesn't actually have to be something mechanical about it, it's just not a nice thing to do and is a really fast way to *** people off. Granted, mechanical problems (ie. things breaking) is a common reason for this to be called out, but there can be more complicated matters than that.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on May 15, 2020, 04:51:05 PM
There is also a more subtle argument, which is that mods should NEVER affect the function of other mods in such a way without permission. There doesn't actually have to be something mechanical about it, it's just not a nice thing to do and is a really fast way to *** people off. Granted, mechanical problems (ie. things breaking) is a common reason for this to be called out, but there can be more complicated matters than that.

This is a very good guideline to follow and I definitely agree.

Since it has been brought up, I do want to address something I feel is important relating to this. It is splitting hairs a little bit, but: The caveat to this guideline is that this should only apply to custom mod content created by a mod author. So, say, a modded faction's personal content. It does get trickier if, say, one mod overrides a vanilla component to add a new feature- such as rules content that only has one entry point or something- and another mod does the same and so the two are incompatible as a result. That is a gray area.

Ugh, not too sure if I am explaining it clearly, but, what I'm trying to get at is something like: I don't necessarily think overriding vanilla components gives you "dibbs" on that component as a mod author, if that makes sense. And I don't think we should discourage or goal tend new modders from overriding vanilla components because they would cause effects in the overall campaign rig balance for faction mods.

That being said, it is always a good thing to be respectful and courteous to other mod authors and do your best to avoid conflicts. Sometimes it's unavoidable, though, and when it happens I don't think it should be policed as long as it is in good faith. I truly do get that this can be annoying because it can sometimes lead to grief from end users who don't understand where the effect is coming from, false bug reports, etc, but we as modders have to remember that not everyone may have the same tastes or balance opinion that we do, and we should encourage those trying to think outside the box or create new features. (Not saying that was what was happening here, just to be clear. This is a cut and dry case and there was never any intention of overriding mod faction content anyway.)

Those are my thoughts on the matter. I'm not really trying to get into a discussion of the subject on this thread, I just felt I should be transparent in how I think about this sort of thing.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: AxleMC131 on May 15, 2020, 06:19:45 PM
The statement I was making primarily refers to content that directly impacts original content of another mod, indeed. You're right about "two mods affecting the same vanilla feature in conflicting ways" being a different matter, and yes that's very much a grey area.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: MesoTroniK on May 15, 2020, 08:30:55 PM
I still don't really understand why a mod author should not want their fleets to have expanded dialogue provided by a different mod.

For me as a player, I'd want all fleets in the game affected by this modification in the same way.
What both Axle and Morrokain said are useful data points and valid but I want to add some myself.

OK, lets say a mod adds some bloodthirsty pirates, or cannibals, or artificial general intelligence or whatever that would sooner tell you to go to Hell and leave your belongings behind before really talking to the player. Then if this sort of mod changes their dialog? Well then the entire rig is screwed heh.

So yea that single example (there are many more potentially), combined with what Axle and Morrokain said explains I think very clearly why it would be bad if this sort of mod affected all mods unless they opt in blah blah :)
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on May 17, 2020, 04:48:37 PM
Update: I have tested how this mod interacts with several faction mods. Mod list:

  "istl_dam",
  "diableavionics",
  "DisassembleReassemble",
  "fleetdialogue_morro",
  "lw_lazylib",
  "MagicLib",
  "nexerelin",
  "ORA",
  "TS_Coalition",
  "shaderLib"

For those mods who implement their own dialogue, that dialogue will not spawn this mod's dialogue options. A couple examples: Coalition, Dassault-Mikoyan Engineering

However, mods that use the standard default fleet dialogue from vanilla for their mod faction will have the options populated. Example: Diable Avionics

I could not test Tiandong Heavy Industries because the mod plugin is set up to crash the game if Fleet Dialogue is active, so that is one way a modder can easily get around this. Another way would be to just implement custom faction dialogue using the unique mod id to prevent the default vanilla dialogue from being used.

Now, in general I see no easy way around this on my side since the majority of vanilla factions rely upon the defaults, but as an olive branch if there are particular modder/modders who really don't want to add custom dialogue for their faction or an exclusion in the mod plugin and also don't want these options available: Post here with a link to the mod page and I will try and add a "not this faction" check to the defaults and I *think* that should allow the original defaults in vanilla to still populate for that faction without the dialogue options. That is very much an educated guess though, and will be done in an "upon request" kind of way.

Similarly, if you have implemented custom dialogue for your mod faction, and would like these options to be included in the interim between release and if/when I can set up some way of doing this in the mod faction's directory, you can post here and I will implement the dialogue with the necessary script in this mod.

*EDIT* Added above info to main mod page.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Histidine on May 17, 2020, 06:05:51 PM
Check if it works properly when talking to a trade fleet with Underworld running.
Do both mods' options work? Only one? Or does the dialog code get stuck in an infinite loop?
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on May 17, 2020, 06:16:06 PM
Check if it works properly when talking to a trade fleet with Underworld running.
Do both mods' options work? Only one? Or does the dialog code get stuck in an infinite loop?

Thanks will do. I'll get back to you here with what happens.

*EDIT1* Any trade fleet? Just to be clear? Or a Cabal trade fleet specifically?
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: MesoTroniK on May 17, 2020, 08:44:17 PM
I could not test Tiandong Heavy Industries because the mod plugin is set up to crash the game if Fleet Dialogue is active
My apologies, I will fix that in the next THI update.

Now, in general I see no easy way around this on my side since the majority of vanilla factions rely upon the defaults, but as an olive branch if there are particular modder/modders who really don't want to add custom dialogue for their faction or an exclusion in the mod plugin and also don't want these options available: Post here with a link to the mod page and I will try and add a "not this faction" check to the defaults and I *think* that should allow the original defaults in vanilla to still populate for that faction without the dialogue options. That is very much an educated guess though, and will be done in an "upon request" kind of way.
Morrokain, I would *strongly* suggest you allow the opt-out (or really ideally, converted to opt-in...) system done within other mod's themselves. Having folks need to ask you every time (if they do not specify custom dialog blah blah) is not good. That is taking up the Mantle of Infinity on your end. And then what happens if you are no longer available for some reason? Then modders are just screwed, and either are *forced* to do custom dialog, or just live with this mod hitting their own against their wishes for all eternity or at least until you are available again.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Histidine on May 18, 2020, 02:42:57 AM
Check if it works properly when talking to a trade fleet with Underworld running.
Do both mods' options work? Only one? Or does the dialog code get stuck in an infinite loop?

Thanks will do. I'll get back to you here with what happens.

*EDIT1* Any trade fleet? Just to be clear? Or a Cabal trade fleet specifically?
Any trade fleet. Cabal doesn't actually ever have its own trade fleets, to my knowledge.
It should look like this (https://imgur.com/6rjiqeA) (interaction is with a smuggler fleet)
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on May 18, 2020, 03:32:35 AM
My apologies, I will fix that in the next THI update.

No worries! I get why you would do that as a safeguard just in case. If you choose to keep it considering the below response, I will not hold it against you as I completely understand the complexities involved. Trying to do the best for everyone.

Quote
Morrokain, I would *strongly* suggest you allow the opt-out (or really ideally, converted to opt-in...) system done within other mod's themselves. Having folks need to ask you every time (if they do not specify custom dialog blah blah) is not good. That is taking up the Mantle of Infinity on your end. And then what happens if you are no longer available for some reason? Then modders are just screwed, and either are *forced* to do custom dialog, or just live with this mod hitting their own against their wishes for all eternity or at least until you are available again.

The take away to what I'm about to say should be: I want to work with you, I understand your concerns, and what is the best way to go about this? Nevertheless, I again feel the need to get very detailed. (Really sorry if this comes across as pretentious prattling. I really feel it has a well-meaning concern for the community behind it though. I'll just say that.)

I get what you are saying and I want to be delicate here and say upfront that I will try my best to work on a solution, but... well, this is more difficult to "fix" because that is just how vanilla is set up with rules and vanilla factions iirc. I'm pretty sure PickGreeting is the only entry point in the rules dialogue for this and it's hardcoded, and I'm pretty sure many vanilla factions still use the default version of that implementation. I could be wrong and I will investigate that more. The only way I see that I could get around that is to create my own rules dialogue for each vanilla faction using the default greetings as a guideline. What that would boil down to, in that case, would be me fleshing out the greeting system for potentially lots of factions instead of a mod author copy pasting the defaults (one time) and adding their mod id to the check *if* they wanted to opt-out of the dialogue features. (They don't have to actually write custom dialogue, just implement an id check to it. It would even be a good idea to do this, so that custom dialogue can be added later on if desired.) So, the onus would be on me to handle a purely vanilla feature so mod factions don't have a few options added to their fleets who also use said vanilla feature when it is unnecessary to do so in the first place. I actually want to do that eventually, anyway, but is it really worth it to wait until that work is completed? What if I didn't already want to do that? Let's consider:

1) No custom mod content is truly being modified.
2) Different methods of opting out within the faction mod itself have been given with various levels of difficulty/effort.
3) If zero effort whatsoever is desired, the interim solution is provided (Assuming the mod id doesn't change, even though this option is done within this mod it would be a "one and done" change that wouldn't require future maintenance unless Rules changed significantly... which would generally break everything anyway. Still, it's not the option I would pick as a modder and yes the complication of my availability is an issue that isn't ideal)

I think this is pretty reasonable considering it purely stems from vanilla implementation. I want to reassure that I'm not saying I won't personally be conscientious or do more about this and seek a solution before release, I am trying to be crystal clear that it's not custom mod content at that point, if that makes sense. It is custom mod content using vanilla components that are themselves fair game. If you are using defaults from vanilla that vanilla factions use en masse (as opposed to faction specific) and another modder wants to make a mod overriding those defaults to affect vanilla, that inherently is going to affect anyone still using the defaults. The expectation is that if you aren't providing custom content and are using vanilla components, anyone modding those components will affect you assuming they are moddable in the first place. It is not "hitting another mod against their wishes" though- at least not intentionally in this case- because those mods are relying upon vanilla components, themselves, which are also justifiably able to be overridden for other reasons. If that was not the case and this was not the access point vanilla itself uses and it was specifically set aside for faction mods, that would be a very different story. This just happens to be one of the parts of vanilla where I don't believe this is the case. I will be happy to be wrong, maybe it is easier than I think and I'll let you know if so!

Can you suggest anything as an alternative? Technically-speaking, is there a way that doesn't involve me essentially finishing the game's greeting dialogues and removing defaults from the vanilla factions altogether? I may even be willing to do that before a release if it's important enough (heck, I did a lot more for the TC to be able to use faction mods that edit vanilla ships and that isn't even balanced for faction mods in the first place) but I reserve the right to, well, not, if it comes down to it. That isn't what I want, though. I'd like to satisfy everyone if possible. Can anyone give me a use case where this would cause technical complications, for instance? "I don't want the feature for my faction" is probably not a valid use case if you are using vanilla defaults. Why?:

The point of all this detail/musing: We quite simply cannot police people for overriding vanilla. It is completely unreasonable in every way to expect modders to never touch vanilla features or accommodate every other mod that has come before them in a community with a mod index like the one we have. Not only will that kill mod variety and features that could be useful or just desirable to some end users, if we're really honest with ourselves it's just not fair to the modding community. Fledgling modders are going to want to try out their own cool things with vanilla components and we have to let them- even when it affects another mod in weird ways or ways outside of the faction mod's original vision. I'm definitely not saying that you shouldn't let them know "Hey this is doing X to my mod, anything we can do about that? I'd rather it did Y or nothing at all." Nevertheless, overriding vanilla is a perfectly valid way of modding and it brings more features to the end user community. It should be preserved as such. It's how we all got here initially.

Conceptually: If you want to preserve every aspect of a faction mod 100% when dealing with a mod merging community, you are either going to have to not use vanilla defaults and keep everything faction specific where possible, make it a TC, or manually exclude mods that don't fit your vision. It's just that simple. Read as: Not at all simple and filled with obstacles and headaches but an overall necessity. Without more complex mod merging management options (which would be great, I'll add, but most likely are outside the scope of Starsector's development), power creep from feature mods will happen. Feature mods making the game easier/harder/more accessible will happen. This is a natural part of every healthy modding community with a diverse set of preferences.
---------------------------

Any trade fleet. Cabal doesn't actually ever have its own trade fleets, to my knowledge.
It should look like this (https://imgur.com/6rjiqeA) (interaction is with a smuggler fleet)

Thanks, I was looking for cabal trade fleets. I found a normal trade fleet and:

It should accommodate both (https://i.imgur.com/4MLLra2.png). I haven't had a chance yet to check hostile trader fleets assuming that's different. I will check later.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: SafariJohn on May 18, 2020, 07:24:50 AM
Just use a merging .csv? Set up your code/rules so they only take effect if the fleet's faction's id is in the csv.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on May 18, 2020, 01:21:10 PM
Just use a merging .csv? Set up your code/rules so they only take effect if the fleet's faction's id is in the csv.

I'd like to, but how? I'm pretty sure I can figure out how to set up a mod .csv (going to assume those merge if they share the same directory between mods) to get all the values and it would operate on having to be present in the faction mod to be eligible for the trigger (That's the idea anyway). How would I plug that into rules, though? OpenCommLink (not PickGreeting I was thinking of something else) is the trigger that they have to fire off of. I'd need some kind of default implementation that checks for a mod id variable that could be any mod id in the merged list? Oh! Actually, iirc I could use a rule script in the condition section, right? If so, that would probably be the best way to go about it in my mind. That script can just search through the list and return true if a faction id found matches the entity faction id- and maybe set the values relating to that faction id into memory temporarily which can then be read from the script that handles the results of the calculation.

I took a look and there are currently 5 default implementations of that trigger that require the override to fire the script for the options. For reference, they fire alongside FireAll PopulateOptions when the player is friendly or neutral and fire stand-alone when the faction is any of the 3 hostile settings.

When I look at the rules, I don't see any other way to do it except that one. So, Hegemony, Tri-Tachyon, Diktat, Luddic Church, Luddic Path and Pirates all have their own faction specific implementation of those by mod id. They aren't the problem because they don't use the defaults. Independent, Scavengers, and Persean League seem to use the defaults though. Probably the player fleet as well, though that's less important for now since the design uses rep as a balancing factor and that's not possible with the player faction.

To get around any vanilla faction using the defaults, I can implement rule sets for each faction currently using them and add their id as a condition check. I honestly thought I'd have to implement more of them, but it doesn't seem too bad to only have to do ~20 max. I think I created a few more implementations of OpenCommLink for my mod factions and that was probably skewing the number I'd have to do in my mind.

That should handle removing the defaults and let all mods automatically "opt-out" though, I believe. That shouldn't be too bad to handle, actually.

Thoughts? Critiques? Better ways of doing it?
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Tartiflette on May 18, 2020, 01:27:29 PM
There are plenty of examples of CSV merging in various mods, there is a simple one in Scy's String manager if you want a reference.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on May 18, 2020, 01:30:53 PM
There are plenty of examples of CSV merging in various mods, there is a simple one in Scy's String manager if you want a reference.

Yes please, and thanks.  :)
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Alex on May 18, 2020, 03:19:00 PM
With the caveat that I didn't read everything (sorry!) and might thus be missing some critical bit of context:

The entry point for the extended dialog is a PickGreeting rule, right? Why not add a condition to it, like this:

!$faction.c:optOutOfMorrokainExtendedDialog

And then in the .faction file, in the custom section, one could add "optOutOfMorrokainExtendedDialog":true, for any faction that didn't want this dialog to fire.

If the custom values aren't populated into $faction memory the current release (i.e. if this is an in-dev feature), you could do this yourself in the CampaignPlugin.updateFactionFacts() method, like so:

Code: java
if (JSONObject.getNames(faction.getCustom()) != null) {
for (String key : JSONObject.getNames(faction.getCustom())) {
String val = faction.getCustom().optString(key);
memory.set("$c:" + key, val, 0);
}
}
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on May 18, 2020, 03:53:25 PM
With the caveat that I didn't read everything (sorry!) and might thus be missing some critical bit of context:

The entry point for the extended dialog is a PickGreeting rule, right? Why not add a condition to it, like this:

!$faction.c:optOutOfMorrokainExtendedDialog

And then in the .faction file, in the custom section, one could add "optOutOfMorrokainExtendedDialog":true, for any faction that didn't want this dialog to fire.

If the custom values aren't populated into $faction memory the current release (i.e. if this is an in-dev feature), you could do this yourself in the CampaignPlugin.updateFactionFacts() method, like so:

Code: java
if (JSONObject.getNames(faction.getCustom()) != null) {
for (String key : JSONObject.getNames(faction.getCustom())) {
String val = faction.getCustom().optString(key);
memory.set("$c:" + key, val, 0);
}
}

Thanks I appreciate it! (It is OpenCommLink that needs the condition, but I'm pretty sure PickGreeting works in a similar way for station npcs so I initially confused the two)

I had no idea (or at least didn't remember) about that portion of the faction file. I will probably do the opposite and make the check for true instead of false in the condition so the default is being opted out. That way faction modders won't actually have to do anything unless they want to plug into the system. I can then specify additional values in that section for ways to manipulate the levers of the system in a similarly opt-in way. Essentially that would allow modders to include whatever complexity they wanted with the system and allow for a more diverse set of responses overall. I'm liking this idea- especially since checking a hash map as a condition of a script in rules for theoretically a lot of faction ids could possibly impact performance every time OpenCommLink is triggered since there are already a lot of potential matches for that trigger to begin with. Idk, though, I'm not really sure how efficient a contains check is. It may be negligible to performance and this wouldn't matter anyway.

Either way, I have lots of ideas now, so thanks for the help everyone! Now to bog myself down in the nitty gritty details and get this thing working... I may have more questions later lol. :D
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Alex on May 18, 2020, 04:52:27 PM
(For a map, a contains() check is super fast, and, more importantly, *does not get slower as the map gets bigger*.)
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on May 18, 2020, 07:14:06 PM
(For a map, a contains() check is super fast, and, more importantly, *does not get slower as the map gets bigger*.)

Thanks again that's good to know.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on May 19, 2020, 05:55:30 PM
So as it turns out, both implementations that were given as examples will be very useful.

I plan on using the .csv system to allow an immense amount of custom dialogue for faction mods (with hopefully a possibility of random selection of dialogue responses per each response category- similar to how rules already operates).

It will be a lot of work, but I will provide an example implementation when it's done. The base system has a lot of response categories, so I need to both provide a spreadsheet cell for each one and provide parsing and methods to obtain a random string selection of each category based upon a comma separated list in each cell matching cell. I should soon have a small prototype of this already working, I believe. It is looking promising, at least.

For the options to opt in for each faction, and provide custom settings for that faction for how likely each response category will spawn, I will use the custom portion of the faction file and read those values separately. No prototype for that in the works yet, though.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on May 20, 2020, 03:41:20 PM
Update: Success!

I have a working example of the first element of description dialogue loading from the csv and being used as intended in the campaign. I have also successfully parsed the first variable $personRank into the correct data when pulled from the spreadsheet.

Phew! It's a proof of concept at least. There is still a lot of work to do, though. I also need to test the implementation of multiple options in each category (like rules separated by "OR").

Is there any place that documents all of the possible variables in the text portion of rules? Or maybe a class? I can't remember. I also plan on adding a couple of my own most likely.  :)

Examples:

Spoiler
(https://i.imgur.com/ogaxWjp.png)
(https://i.imgur.com/rdmCw7N.png)
(https://i.imgur.com/NdWHFHG.png)
[close]
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on May 28, 2020, 10:36:51 PM
I'm still working on getting the dialogue spreadsheet capability fully up and running and there is a lot of rules left to convert to that format. I'm particularly running into some trouble getting highlights to work for credit costs when converting from the spreadsheet cell to in-game dialogue. All replacement tokens have been handled, however, and I've added a few extra of those. I've also added functionality to allow the strict use of Notepad or Notepad++ if a modder prefers that over a spreadsheet editor. New paragraphs can be handled by adding $NEWLINE between the paragraphs. Spreadsheet editor new lines such as Excel and Open Office are fine as well. Adding OR between dialogue responses allows for multiple options that will be chosen at random in each unique case.

Finally, I now also have a working model for opt in behavior and all the various ways to interact with calculations or odds within the system for each faction. I'm still testing, but I don't think I will even need any rules overrides. It will be very easy to opt in to the default dialogue and the modder will have versatile customization options from there.

There's still much work that needs to be done, but there has been some substantial progress made as well.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on January 23, 2021, 04:36:02 PM
Wow it has almost been a year since I last posted on this thread. Time flies fast that's for sure.

Its a long way from being done, but I figured I'd share some pics for some of the features that this mod will have available for other modders to customize content. I've set the dialogue up to be "opt-in" by adding:

"optInMorrokainExtendedDialog":true,

To the custom section of the relevant faction file. Vanilla factions will be enabled by default.

For those who want extra customization (such as enabling the dialogue as a whole but blacklisting certain entities where it doesn't make sense) I plan on accommodating things like that too but haven't gotten to it quite yet. It will likely be a separate spreadsheet containing entity ids.

So far I've managed to convert the entire portion of requesting commodities to the merging spreadsheet. There doesn't appear to be any bugs in the logic so far. Ideally the addition of dialogue using the custom tokens to do things like highlights, multiple responses for each section of the dialogue, etc, will be fairly bullet proof for ease of use. It should already do things like throw an exception and report if a modder started a highlight wrapper and then didn't use an end highlight wrapper.

Unlike rules, a modder also can use any color for highlights to their dialogue. There are set ones for those who don't want to get too technical. Currently the basic options are: story (vanilla story hl), faction (faction color), red, green, blue, purple, yellow, orange, pink, teal, gray, positive (vanilla positive hl), negative (vanilla negative hl), and default (vanilla default hl). However, for those who have something else in mind there is also the option of custom colors. After the wrappers, simply use rgba values just like you would in java.

There will also be additional replacement token options for different faction flavor options. I've included:

$lordOrLady, $LordOrLady, $lordOrLadyPlayer, $LordOrLadyPlayer, $priestOrPriestess, $PriestOrPriestess, $priestOrPriestessPlayer, $PriestOrPriestessPlayer, $SorcererOrSorceress, $sorcererOrSorceress, $SorcererOrSorceressPlayer, $sorcererOrSorceressPlayer

Example:

Syntax:
Spoiler
(https://i.imgur.com/wpiaoAt.png)
[close]


In-Game Dialogue showing all three options proccing:
Spoiler
(https://i.imgur.com/ztJIxCX.png)
(https://i.imgur.com/Lsn2uR7.png)
(https://i.imgur.com/v7PW4y4.png)
[close]

If the syntax looks a little blocky, keep in mind that using $NEWLINE to create a new paragraph is optional. A modder can use enter in the spreadsheet to make your own paragraphs and that should be preserved in the dialogue string.

However, modders must use -OR- to designate additional responses and the highlight syntax for any highlights, however.

Due to the way that I am assuming spreadsheet merges work, modders likely must also start their dialogue with -OR- to prevent the first additional dialogue option from being merged with the last dialogue option if the modder is adding dialogue to an existing faction such as independents or the hegemony.

If a modder is just adding dialogue for their own custom faction, beginning with -OR- will cause a runtime exception. I don't think there is any way around that unless I can think up something clever.

I also wanted to mention that if anyone has additional token requests they can place them in this thread.
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: NikoTheGuyDude on January 29, 2021, 05:56:35 PM
I'd just like to say that I really admire the work you're doing here. Fleet-to-fleet interactions are a severely lacking part of starsector, and this mod will add a lot of much-needed nuance to the way the player approaches other fleets!
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on January 29, 2021, 06:36:11 PM
Thanks! Happy to do it! :)
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: NikoTheGuyDude on September 16, 2021, 10:06:57 AM
I know this is a necropost and blah blah, but I'm just checking, is this mod still in development? Cause if not, I might try my hand at it
Title: Re: [0.9.1a] Expanded Fleet Dialogue
Post by: Morrokain on September 16, 2021, 02:33:06 PM
I know this is a necropost and blah blah, but I'm just checking, is this mod still in development? Cause if not, I might try my hand at it

Yes it is still in development and thanks for asking! I just have been moving very slowly on this front recently because of numerous balance reports for AO that I tried to address in the last AO update. Part of the next lore update in general is to address things like this and flesh out the relevant systems, separate portrait packs and so forth.

After this weekend's minor bugfix update, I am shifting focus to this and other lore related things like missions.

*EDIT* There was also a user request to add balance functionality to another faction mod that I didn't mention above but that was an overall minor effort compared to other things. I figured I should mention it anyway just for clarity's sake.