Author Topic: Reputation - Faction and Personal  (Read 711 times)

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Reputation - Faction and Personal
« Reply #15 on: November 16, 2012, 08:41:42 pm »


               There is definitely interest. I await those notes on reputation with interest. This weekend I'll also be running my own tests on whether personal reputation is stored on a creature committed to the DB.

If it is, I'll need to find an efficient way to clear personal reputation. I also hope there is an efficient way to restore some aspects of personal reputation.

The whole thing is a big black box to me right now.
               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
Reputation - Faction and Personal
« Reply #16 on: November 16, 2012, 08:47:18 pm »


               Looking at the neutral hak a bit I think there are some issues using it as a hak.
I'm not sure it's going to work very well.  Putting Repute.fac in a hak effectively
clobbers all the factions you create in the toolset. Hak files override module files.

You could maybe add your new parent factions to the 2da. But repute is part of the module
that gets modifed when you update the factions. You may need to make a new starting
version of it with the new parents in it... I don't know if that all gets generated from the 2da
at new module creation time or not.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Reputation - Faction and Personal
« Reply #17 on: November 16, 2012, 08:53:20 pm »


               Meaglyn, I'm not sure how that works with other custom content. The take home message for me however was not to use the HAK but that you can hand edit the faction file and create parent factions.

Re repute.2da: I still haven't figured out if the 2da actually does anything. So far all my tests have come up negative.

So anyway I'm hand editing the faction file in a GFF editor and then dropping it into my module's temp folder, then saving. I did a test for this and it appears to be working fine.
               
               

               


                     Modifié par henesua, 16 novembre 2012 - 08:54 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Reputation - Faction and Personal
« Reply #18 on: November 30, 2012, 04:17:26 pm »


               Hmmm.... this from Bioware's documentation. It looks like I should do some tests to see if creating new parent factions will cause any unforeseen problems.

This from the Facion System documentation:

FactionParentID       DWORD
  • Index into the Top Level Struct's  FactionList specifying the Faction from which this Faction was derived.
  • The first four standard factions (PC, Hostile,  Commoner, and Merchant) have no parents, and use 0xFFFFFFFF as their FactionParentID. No other Factions can use this value.

               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Reputation - Faction and Personal
« Reply #19 on: December 01, 2012, 02:18:16 am »


                Some good news. Reputation appears to be saved in the TURD rather than on the character which means that it is reset with server reset.


Table 4.4b: Fields in a Personal Reputation Struct (StructID 47787)
              Label       Type       Description
  • TURD_PR_Amount  INT  Reputation with the faction
  • TURD_PR_Day  DWORD  -
  • TURD_PR_Decays  BYTE  boolean
  • TURD_PR_Duration  INT  Measured in seconds
  • TURD_PR_ObjId  DWORD  ObjectID of creature that is considering the owner of this Personal Reputation element
  • TURD_PR_Time  DWORD  -

This means that I can store creatures in the database without being concerned about storing irrelevant reputation information because this data is not stored on the creature.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Reputation - Faction and Personal
« Reply #20 on: December 01, 2012, 06:18:33 am »


               

henesua wrote...

 Some good news. Reputation appears to be saved in the TURD rather than on the character which means that it is reset with server reset.


Table 4.4b: Fields in a Personal Reputation Struct (StructID 47787)
              Label       Type       Description

  • TURD_PR_Amount  INT  Reputation with the faction



  • TURD_PR_Day  DWORD  -



  • TURD_PR_Decays  BYTE  boolean



  • TURD_PR_Duration  INT  Measured in seconds



  • TURD_PR_ObjId  DWORD  ObjectID of creature that is considering the owner of this Personal Reputation element



  • TURD_PR_Time  DWORD  -

This means that I can store creatures in the database without being concerned about storing irrelevant reputation information because this data is not stored on the creature.


I am not 100% on the answer you have given here.   Are you sure that the TURD holds all Personal Reputation and not just the Personal Reputation in relation to PC's.     It is just a question.  I am not sure that the Personal Reputation of NPC1 towards NPC2 is stored in the TURD.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Reputation - Faction and Personal
« Reply #21 on: December 01, 2012, 12:26:39 pm »


               I'm not 100% certain about this, but I suspect that it is the case.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Reputation - Faction and Personal
« Reply #22 on: December 01, 2012, 04:32:55 pm »


               Well after looking at the functions, I do not see any that work on just two creatures except
ClearPersonalReputation
SetIsEnemy
SetIsTemporaryEnemy
SetIsTemporaryFriend
SetIsTemporaryNeutral


Did I miss any?
               
               

               


                     Modifié par Lightfoot8, 01 décembre 2012 - 04:33 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Reputation - Faction and Personal
« Reply #23 on: December 01, 2012, 05:24:03 pm »


               That is all that I had found.
               
               

               
            

Legacy_DM_Vecna

  • Hero Member
  • *****
  • Posts: 501
  • Karma: +0/-0
Reputation - Faction and Personal
« Reply #24 on: December 14, 2012, 06:49:01 pm »


               As I indicated I was able to finally dig up the notes that Axe Murderer Sent me. These are his learns not mine and I take no credit for the testing. '<img'>


General Overview (very general):
=================================================
The basic idea behind factions is to organize NPCs into like-minded groups. Each faction is given a number, from 0-100, to relate it to each other faction, and one for PCs. The number is used to indicate how they react when they encounter a creature from one of the other factions, or a PC. It is a one-way measure of reputation between members of two factions. 0 indicates hostility, 100 indicates friendly, 50 indicates indifference. The borderline between hostility and indifference is about 10 and between indifference and friendship is about 90. Faction reactions are not two-way. In other words, you can have all the commoners hating all the merchants but all the merchant neutral or even friendly towards commoners. Members of the same faction are always friendly (100) to each other. If there is a hostile reaction, they will attack on sight. If they are neutral, they will ignore and will not help if they see an attack taking place.
If they are friendly, they will defend their friends when their friends are attacked by somebody they see as either neutral or hostile, but will do nothing if they see a friend from one faction attacking a friend from another faction. Attacking a friendly or neutral creature causes its faction members to switch to be hostile towards the attacker. I can't think of any action one can take to change a faction's reaction towards the friendly end of the scale. Faction changes are permanent by default, but they can be scripted to whatever you want when some game event happens.

The toolset has a faction editor (Tools Menu) that allows you to adjust how factions initially align with each other and with PCs. You should go in there to check out how they are set up by default. You can also use it to create new custom factions. PCs don't have a faction of their own, but they do have a reputation with every other faction. PCs in the same party abide by the repuation that the party's leader has with all the NPC factions. PCs have both a personal reputation with each faction member as well as a faction reputation with the entire faction. They are related but different so it is possible for every member of a faction to like a PC except one guy and vice-versa. However a difference like that usually won't last very long because an action like attacking that changes faction-wide reputation will affect personal reputation of each member as well.

Factions have a global setting you can turn ON and OFF (in the Faction Editor). When it is OFF, actions that change a faction's repuatation with another faction will only affect the faction members in the area where the action takes place. When ON, all faction members module-wide are affected.

Faction reactions to repuation changes take effect immediately but they are tied to perception. For a creature to realize that his faction's reputation with another creature from a different faction has changed, the creatures must re-perceive each other. So if Bob and Bill are from different factions and are friendly to each other and Bob walks into Bill's perception range, they will perceive each other. Now if their faction repuatations change to hostile, they won't react until they split apart, lose perception of each other, and then move back towards each other and get re-perceived again. However you can use a script to make them go hostile immediately when the reputation changes (i.e. force them to immediately attack each other).

Secondary to factions are individual reputations. They control reaction between individuals independent of faction, sort of. Normally they are the same as their faction dictates. That's the initial condition. But game actions can cause them to change. For example, if you script two members of the same faction to fight each other, each will gain a hostile personal reputation with each other. This will cause the engine to treat them as enemies, which will in turn keep the combat between them continuing. Faction reputation changes typically will reset personal reputations back to their initial states with members of the other faction. So, say you have 2 factions neutral to each other in both directions. A member of one faction attacks a member of the other. The faction reputation shifts for both factions to hostility due to the action. Now all members of both factions are hostile towards each other, faction wise. Now I beleive all their particular personal reputation differences, that were in place before the attack commenced, are discarded...but I'm not positive about that. There's also some wierdness with hostility I was never able to put my finger on. It manifests in a general tendency for all creatures to want to become hostile. It is usually easier to get two creatures fighting than it is to get them to stop. I found personal reputation the most effective way to do it most every time. Clear actions and clear personal rep and they'll very likely stop. Though a re-perception of each other in the future, when faction reputation is potentially hostile, could start them going again. So clearing the faction rep as well, when appropriate, will ensure the peace endures.

As you can see there are numerous ways the personal rep is tied into the faction rep, and changes to it. So personal rep is not entirely independent of faction rep. And faction rep seems to have the priority in general situations, while personal rep does in more specific situations. Thus any "general" faction rep changing event that occurs, which by the way includes all actions taken in "specific" engagements, will typically have precendence and drive the reactions actually seen in the game. This is why the global faction flag can be important.

One of the biggest problems with the faction system for modules that are not campaign style, like most online servers out there are, is that all PCs are treated as belonging to one giant faction. They cannot be easily separated out into like-minded groups. The faction and reputation system is completely useless for PC vs PC, since all PCs are human controlled. PCs actually have no faction at all. You cannot make a PC become a member of the commoner faction like you can do with a member of the hostile or merchant faction. So, although the game may track both faction and personal reputation for a PC, it can never control the reactions taken. The engine won't make all PCs start attacking the merchants when the merchant faction becomes hostile to a PC. But the change will certainly make all merchants hostile to all PCs. What you end up with is relative ease getting NPCs to react according to their reputations with PCs as a group, but great difficulty in getting PCs to react, and perceive, NPCs accoring to any reputation with any group. So you have to script what you need, usually tidbits at a time scattered all over the place.

I concluded finally that faction and personal reps are only useful for getting NPCs to behave a particular way, in response to PC actions. Or for automatic reactions between NPCs, e.g. hunter faction hunts deer faction, to create natural ambiance in the world and consistently across the world. It is a system best suited for single player or single party campaign style modules. So a PC or Party's action can affect the direction of the story, by controlling which group or groups of NPCs become friendlies or hostiles. Having many many factions is better than big groups covering large portions of the world...exception possibly merchants and/or defenders, and of course hostiles. I prefer to call the Hostile faction the Mindless Hostile faction. Because that's what you get out of using it. Great for creatures with no intelligence, act on instinct, always hostile behavior. Most every discerning NPC players encounter should probably be a member of some custom faction. And the scope of each faction ought to be considered thoroughly and planned out well. Especially for a story driven module, or a region driven module.

What would have been best is if party's had their own faction somehow. Bioware appears to have conceived this, because when you join a party, whether you are PC on NPC, your faction and personal reps all get reset to whatever the party leader has. But that is the extent to which they took it. There is nothing done when you leave the party. Haven't looked at NWNX is a long long time, but if there is a way to hook events to create an OnPCJoinParty and OnPCLeaveParty, then you could add in the custom code necessary to handle PC vs NPC as well as PC vs PC, Party vs NPC, Party vs Party, etc. type reactions and reputations. For PCs all you get is the Like/Dislike setting to record it.

A last consideration with all this stuff are racial and class biases...since there are a few. Not being much of a racist, I never got into that end much whatsoever. When I needed it I simply used a custom faction and some code in the perception and combat events to recognize according to race or class in coordination with faction...basically by using personal reputation and scripting reactions. Or I'd simply fool the engine by using a different race, only works for race not class, and modifying the appearance and faction preferences to get what I wanted. Player still sees everything the same, but scripting and control over race reaction is maintained easier. So you gotta consider there are some automatic reactions which take place due to race and class. They can be difficult to control, both trying to induce them as well as trying to prevent them. Sometimes they simply get in the way frankly. You can get wonderful faction behavior all working, then populate your faction with the wrong race or class of creatures, or locate them physically in the world near the wrong class or race community, and screw everything to hell. All of a sudden you lose control of the whole faction's behavior, often both factions. You can get a huge cascading effect of control loss faction after faction down some chain of relationships. This is one of the reasons why you really need to plan out your factions ahead of time. Make the faction definition fitting to its members natural tendencies as well as the story, and their relative locations in the world.
You'll have to figure out the race and class bias yourself. I never even tried. I simply dealt with it when I saw it come up, and tried to plan around it ahead of time.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Reputation - Faction and Personal
« Reply #25 on: December 14, 2012, 10:05:24 pm »


               Thanks for posting that, DM_Vecna. I'd like to see the actual test results that lead him to some of these conclusions, but the descriptions of various perceived behaviors is still useful.

This however is weird, and I am not sure this actually occurs:

Axe wrote...

A last consideration with all this stuff are racial and class biases...since there are a few. Not being much of a racist, I never got into that end much whatsoever. When I needed it I simply used a custom faction and some code in the perception and combat events to recognize according to race or class in coordination with faction...basically by using personal reputation and scripting reactions. Or I'd simply fool the engine by using a different race, only works for race not class, and modifying the appearance and faction preferences to get what I wanted.


And so on...

My thoughts are "what the hell is he talking about"? I've never seen members of neutral fations go hostile based on the races of the creatures. I suspect that this arises out of scripted AI rather than the engine.
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Reputation - Faction and Personal
« Reply #26 on: December 15, 2012, 07:15:35 pm »


                <bouncing balls...>

(Warning: ties into my many oddball ideas about relationships)
All those calls to reputation/faction are fed objects, source (often caller) and target.
The primary problems seem to stem from faction creep (*such* a good term :-) and unpredictable interactions with *dependent* factions.
So think about this (though it will require extensive embedding, it will be scalable for future systems): Set top-level factions on an independent creature somewhere where it never interacts with anything and therefore never changes (heh). Store that object handle on (N)PCs. Ex: Thieve's Guild Faction Creature.  When determining the relationship between creatures use the *indirect* stored faction object as the source rather than the caller (assigncommand...). response will be generated by the target's relationship with the "pure" faction creature but the response aimed at the caller.

This would really allow *apparent* faction/reputation to come into play. A thief disguised as a noble might, for instance, use the "Noble" faction (if he passes his Disguise skill check) and NPCs would respond accordingly...

<...off three sides of the table>
               
               

               
            

Legacy_nwnsmith

  • Full Member
  • ***
  • Posts: 125
  • Karma: +0/-0
Reputation - Faction and Personal
« Reply #27 on: December 15, 2012, 08:18:22 pm »


               "Nwnx fixes" seems to take care of the adjustreputation bug that I think was behind a lot of confusion and might be the source of his racial findings. I tested on 20 or so races with no issues. On another note, axe did seem to think that joining a party made your character take on all of the party leaders faction standings and leaving the party did not return your original settings. I have not explored this yet
               
               

               


                     Modifié par nwnsmith, 15 décembre 2012 - 08:30 .
                     
                  


            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
Reputation - Faction and Personal
« Reply #28 on: January 02, 2013, 03:36:57 pm »


               

henesua wrote...

Hmmm.... this from Bioware's documentation. It looks like I should do some tests to see if creating new parent factions will cause any unforeseen problems.

This from the Facion System documentation:

FactionParentID       DWORD

  • Index into the Top Level Struct's  FactionList specifying the Faction from which this Faction was derived.
  • The first four standard factions (PC, Hostile,  Commoner, and Merchant) have no parents, and use 0xFFFFFFFF as their FactionParentID. No other Factions can use this value.


Did you do these tests? I'm curious to see if new parent factions actually work given the documentation. 

If 2da changes don't do anything maybe those 4 parents are hardcoded in the toolkit, which would help explain the comments in the Bioware doc.
               
               

               
            

Legacy_Sir Adril

  • Jr. Member
  • **
  • Posts: 96
  • Karma: +0/-0
Reputation - Faction and Personal
« Reply #29 on: January 02, 2013, 03:57:04 pm »


               

Rolo Kipp wrote...

 <bouncing balls...>

(Warning: ties into my many oddball ideas about relationships)
All those calls to reputation/faction are fed objects, source (often caller) and target.
The primary problems seem to stem from faction creep (*such* a good term :-) and unpredictable interactions with *dependent* factions.
So think about this (though it will require extensive embedding, it will be scalable for future systems): Set top-level factions on an independent creature somewhere where it never interacts with anything and therefore never changes (heh). Store that object handle on (N)PCs. Ex: Thieve's Guild Faction Creature.  When determining the relationship between creatures use the *indirect* stored faction object as the source rather than the caller (assigncommand...). response will be generated by the target's relationship with the "pure" faction creature but the response aimed at the caller.

This would really allow *apparent* faction/reputation to come into play. A thief disguised as a noble might, for instance, use the "Noble" faction (if he passes his Disguise skill check) and NPCs would respond accordingly...

<...off three sides of the table>


You blew my mind. That thief disguised as a noble using a noble faction idea is pure gold. I love it. This would work beautifully with the module I've been building.