"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: 281
Joined: Thu Jul 18, 2019 6:07 pm

"Maintain Reputation" logic

Post by Firebrand »

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: 281
Joined: Thu Jul 18, 2019 6:07 pm

Re: "Maintain Reputation" logic

Post by Firebrand »

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: 541
Joined: Thu Jul 18, 2019 3:08 am

Re: "Maintain Reputation" logic

Post by Ommamar »

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: 281
Joined: Thu Jul 18, 2019 6:07 pm

Re: "Maintain Reputation" logic

Post by Firebrand »

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: 541
Joined: Thu Jul 18, 2019 3:08 am

Re: "Maintain Reputation" logic

Post by Ommamar »

D
Last edited by Ommamar on Sat Apr 18, 2020 2:00 am, edited 1 time in total.

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

Re: "Maintain Reputation" logic

Post by pango »

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
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

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

Re: "Maintain Reputation" logic

Post by Ommamar »

D
Last edited by Ommamar on Sat Apr 18, 2020 2:00 am, edited 1 time in total.

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

Re: "Maintain Reputation" logic

Post by mikeprichard »

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: 3357
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: "Maintain Reputation" logic

Post by pango »

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

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

Re: "Maintain Reputation" logic

Post by mikeprichard »

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