erdelf / AlienRaces

Rimworld mod alien race framework
MIT License
103 stars 69 forks source link

Backstory race-exclusive filtering issues #62

Closed vorpal-void closed 2 years ago

vorpal-void commented 2 years ago

It seems like backstory wiki page is missing two things: usePawnKindBackstories and allowHumanBios

Now, while allowHumanBios should be working as is, usePawnKindBackstories is commented out in HarmonyPatches.cs and hence will do nothing. I suppose there was reason for that, but for now I've stumbled into problem from 2018 which solution is pointed me to those classes.

My problem is that several races backstories are spawning on other pawns from different races (including vanilla humans) as well and I can't seem to limit that behavior despite backstoryFiltersOverride and spawnCategories set up correctly: race-specific backstories are spawning on said races correctly, but not limiting them from other custom races. Simple example: android backstories from "Androids" mod are rolling for random non-android bun which doesn't make any sense. As a temporary "solution" I'm looking into creating custom patch for my collection to alter all the backstory names and descriptions for them to be "fitting" for any race, but that's completely dumb and I need an assistance with this.

Where did I get info mentioned above: https://ludeon.com/forums/index.php?topic=38309.0

Also, is there any difference between backstoryFiltersOverride and backstoryCategories? The latter one is used in Kurin race mod, as example, and I can't find any documentation on it.

erdelf commented 2 years ago

usePawnKindBackstories is commented out because vanilla introduced that functionality by itself at some later point, so I disabled it in alien race.

Backstories usually are filtered via the tags, there's no need for a custom system really. I never introduced my own mechanics for it. I don't know your specific example, but at that point check the tags.

backstoryCategories is just a compatibility thing that is there to automatically fill backstoryFilters. Additionally there is backstoryFiltersOverride which is the same as backstoryFilters, but if you don't want the faction meddling with the available backstories for that PawnKindDef.

vorpal-void commented 2 years ago

Thanks, from that I can conclude that every race mod I have correct XML defs and every one of them working separately as intended. But I still don't see how exactly tag system should be used to exclude specific backstory from other races because currently it says what backstory should be used for specific PadnKindDef, but doesn't have inverse behavior which will tell it not to do that. For example, backstory in question from Androids:

<title>Basic model</title>
<slot>Childhood</slot>
<spawnCategories>
<li>ChjAndroid</li>
</spawnCategories>

PawnKindDef for them:

<PawnKindDef Name="ChjAndroidVillager" ParentName="OutlanderBase">
<defName>ChjAndroidVillager</defName>
<label>villager</label>
<race>ChjAndroid</race>
<backstoryCategories>
<li>ChjAndroid</li>
</backstoryCategories>

Everything cool here and works for android race just fine; how do I prevent for that backstory to roll on random human pawns who are not from that race? Or it shouldn't be happening in the first place?

erdelf commented 2 years ago

Uhm, that sounds like an issue in the backstory assignment in your game. Generally the spawncategories is how you specify who should spawn with what. If none of the factions and the human pawnkinds don't have that tag it shouldn't be assigned to them.

Do check if the factions have the category defined, that's historically the usual source of error.

vorpal-void commented 2 years ago

Nice, at least now I know this is not expected behavior! it seems like FactionDef have the same backstoryCategories defined (will copy the entire block):

    <FactionDef ParentName="PlayerFactionBase">
        <defName>ChjPlayerAndroidColony</defName>
        <label>New Android Arrivals</label>
        <description>Your own Android community.</description>
        <isPlayer>true</isPlayer>
        <basicMemberKind>ChjAndroidColonist</basicMemberKind>
        <pawnsPlural>colonists</pawnsPlural>
        <playerInitialSettlementNameMaker>NamerInitialSettlementColony</playerInitialSettlementNameMaker>
        <factionNameMaker>NamerFactionOutlander</factionNameMaker>
        <settlementNameMaker>NamerSettlementOutlander</settlementNameMaker>
        <techLevel>Industrial</techLevel>
        <backstoryCategories>
            <li>ChjAndroid</li>
        </backstoryCategories>
        <factionIconPath>World/WorldObjects/Expanding/Town</factionIconPath>
        <startingResearchTags>
            <li>ClassicStart</li>
        </startingResearchTags>
        <apparelStuffFilter>
            <thingDefs>
                <li>Synthread</li>
            </thingDefs>
        </apparelStuffFilter>
    </FactionDef>

I will try to toss them mods together in various combinations to see when thing are breaking since they are not my work and I'm merely trying to make big collection to work as smooth as possible.

erdelf commented 2 years ago

It being in the faction means all pawns generated for the faction will be generated with backstories like that (unless they have the override). So stuff like event pawns (refugees and so on) will generate with that category.

vorpal-void commented 2 years ago

So, I've stripped down mod list to bare minimum to ensure this is not something in the collection:

    <activeMods>
        <li>brrainz.harmony</li>
        <li>ludeon.rimworld</li>
        <li>erdelf.humanoidalienraces</li>
        <li>chjees.androids</li>
    </activeMods>

Then created new game, did 30x refugee crash incident for spawn variations, and here it is, baseline human with android backstory:

изображение

BackstoryDef for this specific pawn ```xml ChJAndroid_Child_Researcher Researcher model Scientist [PAWN_nameDef] was a specific android developed to assist with research and dangerously has most of [PAWN_pronoun] subroutines for developed unlocked. [PAWN_pronoun] mental subroutines are emulated from a collection of high-achieving students from an Urbworld, but specialized cyberbrain has reduced instruction sets which impedes a number of reflex-based skills. There is an unfortunate history of instability associated with this model, including one CH-JE2 who murdered his shipmates en route to destination and fled to a Mechanoid hive. Male Female Childhood
  • ChjAndroid
  • Intellectual 8
  • Shooting -3
  • Melee -3
  • ```

    I'm reading this mod files and can't see any particular issue to patch out and/or report to the mod developer; the only difference with mods that are seems to NOT produce that behavior (like Ratkin or Moyo) is that they don't use backstoryCategories, but backstoryFiltersOverride for their PawnKindDef, and that they have defined BasePlayerPawnKind for colonists and OutlanderBase for outlanders as their parent:

    PawnKinds_Androids ```xml ChjAndroidColonist ChjAndroid ChjPlayerAndroidColony
  • ChjAndroid
  • 0.00
  • IndustrialBasic
  • 0 1000 2400
  • Gun
  • NonNeolithicOnlyMelee
  • 0 0 0 13~21
    ```
    erdelf commented 2 years ago

    Not to repeat myself, but you haven't responded to what I said as far as I can tell. If the faction has the category in their settings, it will generate refugees with backstories of that faction, in your case, android backstories.

    vorpal-void commented 2 years ago

    Sorry, lost at the thought. Yes, androids FactionDef has defined backstoryCategories, I've partially mentioned it just prior; I think that all of those who rolled with "wrong" combination of race and backstory in my playthrough were space refugees or otherwise generated in similar events. Nothing can be done about that?

    erdelf commented 2 years ago

    Don't have backstory categories that only make sense for your race in the faction. Put such backstories in the PawnKindDefs

    vorpal-void commented 2 years ago

    Alright, I've mashed up a quick patch to alter said mod files and now it seems to be working!

    Bonus thought that this is somehow can be combined into wiki page for backstories config if someone else stumbles upon this situation since there is no mentioning of FactionDef relation at all, but Faction page (WIP) has backstories mentioned; for me, as someone new to entire race framework this is not very obvious connection of things.

    Much cool, very thanks, have a good day.