"Maintain Reputation" logic

Post here if you need help getting started with Daggerfall Unity or just want to clarify a potential bug. Questions about playing or modding classic Daggerfall should be posted to Community.
Firebrand
Posts: 256
Joined: Thu Jul 18, 2019 6:07 pm

"Maintain Reputation" logic

Post by Firebrand » Sat Aug 03, 2019 11:51 pm

Recently my character had a sudden -1 in reputation with all the factions she is part of:
  • Fighters Guild
  • Mages Guild
  • Knights of the Dragon
It seems not to be correlated to a failed quest, because my character still hasn't failed any. I always play one quest at the time, just to prevent confusion.

According to UESP:
https://en.uesp.net/wiki/Daggerfall:Rep ... Reputation
if your character doesn't do a quest for a faction at least every 3 months, he/she will lose 1 reputation point with them. It seems odd, because In the past months I've done only quests for the above factions. Especially the first two.

My question is: is in DFU implemented the "Mantain Reputation" logic exactly as described in the above UESP page?

I'm curious also about this part:

"There are some exceptions, however, and at a certain high rank within a faction, your reputation will no longer drop, even if you don't do any quests in a month."

Which rank? :? Or is this just another false myth from Daggerfall Chronicles? :roll: :lol:

Firebrand
Posts: 256
Joined: Thu Jul 18, 2019 6:07 pm

Re: "Maintain Reputation" logic

Post by Firebrand » Mon Aug 05, 2019 3:47 pm

I had a look at DFU source code, and found something related in:

daggerfall-unity/Assets/Scripts/Game/Entities/PlayerEntity.cs

in the procedure Update, there's a part marked with the following comment:

// Normalize legal reputation and update faction power and regional conditions every certain number of days

It looks like that every 112 days in game, the procedure NormalizeReputations() is called. Here is the code of the aforementioned procedure:

Code: Select all

        /// <summary>
        /// Normalize reputations towards 0. Called every certain number of game days.
        /// </summary>
        public void NormalizeReputations()
        {
            for (int i = 0; i < 62; ++i)
            {
                if (regionData[i].LegalRep < 0)
                    ++regionData[i].LegalRep;
                else if (regionData[i].LegalRep > 0)
                    --regionData[i].LegalRep;
            }

            List<int> keys = new List<int>(factionData.FactionDict.Keys);
            foreach (int key in keys)
            {
                if (factionData.FactionDict[key].rep < 0)
                    factionData.ChangeReputation(factionData.FactionDict[key].id, 1);
                else if (factionData.FactionDict[key].rep > 0)
                    factionData.ChangeReputation(factionData.FactionDict[key].id, -1);
            }
        }
From what I understand then, every 112 days in game, your legal reputation in every region and reputation with every faction is moved 1 unit closer to zero: if it's negative, 1 point is added, if it's positive, 1 point is subtracted. This could explain what I've seen in my game :?
Can someone with a better knowledge of C# than me :lol: please confirm this?

Ommamar
Posts: 465
Joined: Thu Jul 18, 2019 3:08 am

Re: "Maintain Reputation" logic

Post by Ommamar » Mon Aug 05, 2019 4:02 pm

That is how I read it Firebrand. As long as your reputation is below 63 it will try to move you towards the average reputation which is 0. Where did you find the number 112? I am thinking it might be the same time period you are evaluated for promotion in a guild which I saw in another thread is every 28 days. I don't have any code to validate that statement it is just an explanation I got to why my thief after 5 quests over a 10 day period wasn't promoted.

Firebrand
Posts: 256
Joined: Thu Jul 18, 2019 6:07 pm

Re: "Maintain Reputation" logic

Post by Firebrand » Mon Aug 05, 2019 6:29 pm

Thanks! :)

You can have a look at the code here:

https://github.com/Interkarma/daggerfal ... rEntity.cs

I've found the number 112 days for Normalize reputations on row 412, where you can read:

Code: Select all

            // Normalize legal reputation and update faction power and regional conditions every certain number of days
            uint minutesPassed = gameMinutes - lastGameMinutes;
            for (int i = 0; i < minutesPassed; ++i)
            {
                // Normalize legal reputations towards 0
                if (((i + lastGameMinutes) % 161280) == 0 && !preventNormalizingReputations) // 112 days
                    NormalizeReputations();
                    
You can found instead the 28 days check since last promotion for a new promotion/demotion/expulsion in a Faction here:

https://github.com/Interkarma/daggerfal ... s/Guild.cs

Row 69:

Code: Select all

public virtual TextFile.Token[] UpdateRank(PlayerEntity playerEntity)
        {
            TextFile.Token[] tokens = null;

            // Have 28 days passed?
            if (CalculateDaySinceZero(DaggerfallUnity.Instance.WorldTime.Now) >= lastRankChange + 28)
            {
                // Does player qualify for promotion / demotion?
                int newRank = CalculateNewRank(playerEntity);
                if (newRank != rank)
                {
                    if (newRank > rank) {           // Promotion
                        tokens = TokensPromotion(newRank);
                    } else if (newRank < 0) {       // Expulsion
                        tokens = TokensExpulsion();
                        GameManager.Instance.GuildManager.RemoveMembership(this);
                    } else if (newRank < rank) {    // Demotion
                        tokens = TokensDemotion();
                    }
                    rank = newRank;
                    lastRankChange = CalculateDaySinceZero(DaggerfallUnity.Instance.WorldTime.Now);
                }
            }
            return tokens;
        }

Ommamar
Posts: 465
Joined: Thu Jul 18, 2019 3:08 am

Re: "Maintain Reputation" logic

Post by Ommamar » Mon Aug 05, 2019 6:48 pm

Cool thanks. I wonder why they chose 112 days, I would really of loved to see the design documents or minutes of meetings where they decided how to set stuff up.

Here is an interesting thing that happened last night. My thief build had a quest to steal some notes that a scholar of the mage guild had. It said in the quest text that it might cause issues with the mages guild but I had done some quests for them already (kind of role playing him doing different things for guilds as him having a cover story to explain how he might have items or gold) which put my reputation at 10 for them. After I finished the quest I saw my reputation had dropped to -3 so I decided to get it back up by doing a few nonmembers quest as I expected them to expel me. I must of gotten in before the code check though as I was able to get another easy quest to raise my reputation up to 2. So I guess if you pay attention to the time period (which I really wasn't just got lucky) you can fluctuate a decent amount in those 28 days.

User avatar
pango
Posts: 1763
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: "Maintain Reputation" logic

Post by pango » Mon Aug 05, 2019 8:15 pm

Ommamar wrote:
Mon Aug 05, 2019 4:02 pm
As long as your reputation is below 63 [...]
I'm not sure where you read that from; The

Code: Select all

            for (int i = 0; i < 62; ++i) ...
is just there to iterate over all the regions, to update your legal status in each...

By the way I think it would have been a better style to use

Code: Select all

foreach (RegionDataRecord rd in regionData) ...
Less chances of getting the array scan wrong... but C# won't let you modify rd members in this case, grrr
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

Ommamar
Posts: 465
Joined: Thu Jul 18, 2019 3:08 am

Re: "Maintain Reputation" logic

Post by Ommamar » Mon Aug 05, 2019 11:00 pm

In the array variables it says i<62 which would mean anything 63 and higher. I always thought once your reputation got high enough it wouldn't drop if you hadn't done any quests for the faction in the 28 day evaluation period. Which is why I figured that was what the value on the variable was doing.

User avatar
mikeprichard
Posts: 777
Joined: Sun Feb 19, 2017 6:49 pm

Re: "Maintain Reputation" logic

Post by mikeprichard » Mon Aug 05, 2019 11:05 pm

I'm curious about this too - if not >62, what is the specific minimum rep value needed in a faction in order to avoid your faction reputation gradually dropping over time? Or is that yet another myth that didn't work as intended in classic (or now in DFU)?

User avatar
pango
Posts: 1763
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: "Maintain Reputation" logic

Post by pango » Mon Aug 05, 2019 11:40 pm

that 62 is a number of regions, it has nothing to do with a reputation level.
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
mikeprichard
Posts: 777
Joined: Sun Feb 19, 2017 6:49 pm

Re: "Maintain Reputation" logic

Post by mikeprichard » Tue Aug 06, 2019 12:48 am

Thanks. So is the "preventing faction reputation loss at higher rep levels" thing a myth in DFU and/or classic? Or can anyone please confirm the correct minimum rep value to prevent gradual rep loss?

Post Reply