The best kittens, technology, and video games blog in the world.

Monday, November 16, 2009

Why everyone hates you in Medieval 2 Total War

Knight cat by doozzle from flickr (CC-NC)Short answer - because of a really stupid bug in data files. If you want it fixed, download corrected file and put it in your C:\Program Files\SEGA\Medieval II Total War\data\ directory or similar. For the long version, read on.

Reputation and standing

First, technicalities. The game keeps track of two important numbers - your reputation (also called global standing), which is global, and standing with a particular faction. Both are numbers between -1 (the worst possible) and +1 (the best possible).

Good behaviour increases your reputation, and your standing; while bad behaviour decreases it - as expected. There are two kinds of deeds - some actions are unconditionally good or bad - they simply add or subtract from your reputation/standing. If you do 5 good deeds and 4 bad deeds of this kind, it's pretty much the same as just doing 1 good deed.

The other kind use what the game calls "normalization". This "normalization" operation has two parameters - target value, and "divisor". It takes your current standing or reputation, and moves it by 1/divisor towards the target.

For example if your current standing is 0.6, then "normalizing towards +1 with divisor 10" will result in standing of 0.6 + (+1 - 0.6)/10, that is 0.64. If your initial standing was -0.8 instead, the result would be -0.8 + (+1 + 0.8)/10, or -0.62. In other words - if your reputation/standing is bad, good deeds improve it a lot, while bad deeds damage it little. And if your reputation/standing is good, good deeds improve it little, but bad deeds damage it a lot. In our example, the good deed had value of +0.04 for the well-reputed faction, but +0.18 for the ill-reputed one.

Normalization to some value with divisor 1 is equivalent to completely changing your reputation/standing - by our equation initial + (target - initial) / 1 = target. Doing both good and bad things of this kind will move your reputation towards neutral values around 0.0, even if one kind of deeds is more frequent than the other. It's all quite sensible in practice.

Obviously we want our relations with different factions to be high - factions that hate us will be more likely to start wars against us, disrespect treaties and so on. Even with enemies we would prefer higher standing, in case we want to sign peace treaty someday.

What changes reputation

Most reputation changes are absolute.

First, your reputation normalizes to 0 with divisor of 200 anyway, which is extremely slow - it takes 140 turns to halve your good or bad reputation. Having an ally normalizes your reputation to +1 with divisor of 400, and being at war (except with rebels obviously) normalizes your reputation to -1 with divisor of 800. These are extremely small divisors, but if you have multiple allies, or multiple enemies they add up.

On top of that, some generic good and bad deeds:
  • "Taking back" settlement, which you gave by diplomacy (but then do you ever give settlements by diplomacy?): -1.0
  • Attacking an ally: -0.5
  • Canceling alliance (also when forced by one of your allies attacking another - tough luck): -0.1
  • Bribing settlement (it's virtually impossible in Medieval 2 Total War anyway, unlike in Rome Total War where you would be doing it all the time): -0.15
  • Breaking treaty terms (I'm not sure what counts here): -0.15
  • Military assistance to your ally in battle: +0.1
Treatment of prisoners is probably the most important source of reputation. If you put your prisoners up for ransom, it doesn't affect your reputation either way - this is the standard expected behaviour in Medieval warfare. What changes it is either releasing or executing prisoners.
  • Releasing prisoners: +0.01; +0.025 for groups of over 80 soldiers; +0.025 if any family member was released.
  • Executing prisoners: -0.01; -0.025 for groups of over 80 soldiers; -0.025 if any family member was executed.
I'll get back to this later in more detail.

And here we arrive at the bug. Treatment of civilians is supposed to affect your reputation:
  • Occupying a settlement peacefully: +0.05
  • Sacking a settlement: -0.02
  • Exterminating population: -0.05
But due to a bug the first never happens. Here's the data file:
;------------------------------------------
Trigger 0103_occupy_settlement_increase_global
WhenToTest OccupySettlement

FactionStanding global 0.05
FactionStanding target_faction normalise 1.0 20
FactionStanding target_allies normalise 1.0 40
; FactionStanding target_enemies normalise -1.0 40

;------------------------------------------
;Trigger 0102_city_razed_decrease_global
; WhenToTest CitySacked

FactionStanding global -0.05
FactionStanding target_faction normalise -1.0 10
FactionStanding target_allies normalise -1.0 20
; FactionStanding target_enemies normalise 1.0 20
Semicolon means code is commented out and inactive. The first event describes what happens when settlement is peacefully occupied. The second is old sacking code, probably from Rome Total War times. It's supposed to be commented out, but only trigger was commented out, the effects were not. So the results are equivalent to:
;------------------------------------------
Trigger 0103_occupy_settlement_increase_global
WhenToTest OccupySettlement

FactionStanding target_faction normalise 1.0 20
FactionStanding target_faction normalise -1.0 10
FactionStanding target_allies normalise 1.0 40
FactionStanding target_allies normalise -1.0 20
So not only you don't get the promised reputation bonus, your standing with the target and their allies gets lower, instead of higher - they're actually happier when you sack their settlements than when you occupy them peacefully, what is nonsense! By the way, all websites about Medieval 2 Total War I've seen seem unaware of the bug, even though it's trivial to test.

Just see how different the game is with and without bug. If you take 6 neutral settlements, your reputation should rise to 0.3 (Reliable); with the bug it will stay at 0.0 (Mixed). This has huge effect on how others will treat you!

Standing

Now that we know about your reputation, how about standing? There's extremely long list of rules related to the Pope, crusades and such, which I'll cover later. For normal factions it's much simpler. I'll spare you the numbers, but basically:
  • Factions with high reputation get liked more, factions with low reputation get liked less. Thresholds are -0.4, -0.1, +0.1, +0.4.
  • Depending on difficulty, your standing tends to drift towards +1.0 (very easy), 0.0 (medium), -0.5 (hard), and -1.0 fast (very hard).
  • Factions which are strong get liked less, factions which are weak get liked more.
  • There's small advantage to having the same religion.
  • Your allies grow to like you more, and your enemies to like you less. Allies/enemies of your allies/enemies change their standing accordingly, by smaller factors. If this works correctly, you can see two big coalitions developing, and it often happens.
There are miscellaneous actions that increase or decrease your standing. In addition to the obvious acts of war, bribing, sabotage, and spying decreases your standing - spying much more than I thought - to -1.0 with divisor 20, and with divisor 80 for all allies. I'm not sure if it counts only when spy is caught, but it's far higher than I expected. Only 13 acts of spying will move perfect standing all the way to neutral.

What doesn't affect your standing is merchants buying each other out, your princesses marrying (and stealing) their generals, and your priests preaching on their territory. Marrying your princess to their faction heir is worth a lot - +0.2 instantly, and normalization to +1 with divisor 20 every turn.

Adding it all together - the way it's supposed to work is that increased standing due to high reputation should counteract decreased standing due to your size and difficulty level (at least on hard, maybe not so much on very hard). But because you don't get reputation points you deserve for peacefully occupying settlements, there's no balance, and everyone gets to hate you.

The Pope

It's only vaguely related to the bug this post is about, but as I started talking about Medieval 2 Total War standing system, I can as well describe how it works with the pope.

First you get points for building religious building - from 0.02 for small churches and chapels, to 0.2 for huge cathedrals, and additional 0.2 for your first huge cathedral, and additional 0.2 if it's the first huge cathedral in the world - so you can get +0.6 with the pope for just one building, after first getting +0.52 for first cathedral in the world.

On the other hand destroying religious building for money makes the pope hate you, about 5x as much as building them. But as you never really destroy buildings anyway, you probably don't need to bother yourself with it too much.

Crusade get you huge bonuses with the Pope - but only arriving at target region, and taking the target settlement, not just joining. You get bonuses for every general, and every unit, but a lot more if you send your heir (+0.2) or your leader (+0.6) to the crusade.

Something I didn't know about before reading the code is that attacking Orthodox factions while on crusade (usually taking Constantinople on the way to Jerusalem or Antioch) gets pretty high penalties with the Pope. You'll get your papal standing back if you actually conquer your target, but if the crusade is just an excuse for sacking the Byzantine Empire the Pope will not be happy. As you probably already know, attacking non-excommunicated Catholic factions while on Crusade, or Islamic factions while on Jihad is prohibited by the rules.

Recruiting priests and doing papal missions get you points. Getting excommunicated loses you -1.0 points, obviously. Getting your cardinals promoted get you points (0.1 per cardinal), and there are even more points in elections - Pope from your country means +0.8, from allied country means +0.4, enemy country's Pope means -0.6, and voting for the winner pope is +0.2. Surprisingly I don't see any negative points for voting for the wrong candidate, even though in-game text insist on wrong vote being a major transgression.

You also lose points with the Pope for being at war with other Catholics. And look after heretics in your lands - if the Pope has to appoint an Inquisitor, it costs you immediate -0.2.

Now it's going to more or less even out - you will build churches and recruit priests anyway, especially if you're close to Islamic or Orthodox regions - what will score you major Pope points. And you'll lose points for inevitable wars with other Catholics. You're supposed to get extra points for good reputation, but as I said, you won't due to the bug.

What to do with prisoners

There's one more thing I wanted to write about - treatment of prisoners. You naturally know that you shouldn't normally sack or massacre settlements, as these will be your subjects, but why do anything except execution with the prisoners? Let's do some game theory:
  • Value of reputation gained or lost: A (by marginal view it's supposed to be the same either way, it's not exactly true, but let's keep it this way for simplicity)
  • Value of money gained from ransom: B
  • Cost of enemy getting units back: C
So payoffs are:
  • Released: A-C
  • Ransom accepted: B-C
  • Ransom rejected: 0
  • Executed: -A
It helps to know if the enemy is likely to accept the ransom or not. Usually the answer is clear - due to war they don't have any money, so they cannot pay you. In this case if A>C, you release prisoners, otherwise you ask for ransom and don't get it. A>C is the usual situation, you've just defeated their armies, so they probably weren't that good anyway. The biggest exception I can think of is when you're on your way to take a weakly defended settlement, and these armies would join the defenders and make your work much more difficult when released. Or when it's really late in game, you're at war with everyone, and you don't care about reputation anyway.

How about when you think the ransom will be accepted? First, decision between release and ransom. If A-C>B-C, release straight away. Unless you captured their leader (10000) or heir (5000), reputation will be almost always more valuable than money - mostly because for reputation purposes they're treated just like any other general, but for ransom purposes they're a lot more valuable. Except your enemies are quite unlikely to have that much money, so it's not a common occurrence.

How about executing them? It only makes sense when C>2A, and C>A+B. Reputation cost of execution is twice as high, as now you have to actually execute the prisoners, instead of just request ransom. Your loss due to release of troops is very rarely that high. Even tiny group of soldiers released or executed will make a difference of 0.02 reputation points, about as much as you need to counteract being at war with someone for 16 turns. If you act chivalrously wars improve your reputation instead of damaging them. Paradoxically the worst kind of war for your reputation is a prolonged war in which nothing happens.

This is all a lot less true once the bug is fixed. Due to the bug releasing prisoners is the only way to significantly improve your reputation, and you need that just to stay positive, as you'll lose it due to broken alliances, executions of prisoners, and sackings of settlements that will inevitably happen sometime during the game. Having allies and assisting them militarily just won't be enough - once big major start, getting allies will get really tough, especially if your reputation isn't very high (chicken and egg...), and assisting stupid bots requires way too much of effort.

But without the bug, you should have decent reputation from just straightforward conquest, unless you kill and sack on your way - and value of A gets a lot lower.

To fix or not to fix


With minor bugs the question is clear - definitely fix them. But this bug is so big, and changes the game so much... Not only AI will like you more, AI will like each other more too. And acting chivalrous will be much more important - with buggy M2TW you really had to go out of your way to get decent reputation, but with the fix if you behave you'll reap diplomatic rewards.

Most likely the fix will make the game significantly easier - as long as you act chivalrous it will delay your wars and make your enemies much more likely to agree to cease fire. On the other hand it will make AI factions hate each other less too - so who knows, maybe they'll unite against you? At some point you'll be big enough to overwhelm your reputation-based bonus, so maybe it doesn't matter that much...

I'll try my next game with the fix, and tell you how it went. It's a really long post for a bug that's basically 3 missing semicolons.

125 comments:

Spunky said...

I can't find that file anywhere in my M2TW directory. O_o

taw said...

Spunky: M2TW keeps its files in packs like good old Quake (except it uses weird format instead of zip with different extension like Quake). If you want to look inside you need to unpack them first. You don't need the unpacker if you just want to override some files, or use some mod etc. - just saving this file in data\ directory should work.

Here are the instructions. Unpacker is included with M2TW since version 1.1.

Spunky said...

Thanks man, I'll try just dropping it in there. Can you give me the exact path? I'm just going to try the base data directory and see what happens for now.

taw said...

Base of data directory should work.

neon1300 said...
This comment has been removed by the author.
neon1300 said...

Hi taw,

Thank you for this precise article! It explains the question that has bothered me for a long time - "why it is so hard to get good reputation".

I got one more question about the codes in descr_faction_standing.txt. Since you completely commented out the code that is triggered when players sack a settlement, do we still get the -0.02 penalty when sacking a settlement? If yes, then which part of the codes give us the -0.02 penalty?

Thank you,
neon1300

taw said...

neon1300: You still get penalized for sacking, relevant trigger is this:

Trigger 0101_sack_settlement_decrease_global
WhenToTest SackSettlement

FactionStanding global -0.02
FactionStanding target_faction normalise -1.0 20
FactionStanding target_allies normalise -1.0 40

One I commented out was RTW leftover. (RTW had different logic, you enslaved sacked population, not got their money), M2TW sacking code is elsewhere and correct.

neon1300 said...

Hi taw, thanks for your reply :D. I was checking descr_faction_standing.txt yesterday, tried to figure out more about the factors that are related to global reputation. And I got some more questions (hope I am not bothering you too much >.<)....

1.
Trigger 0056_T_Nullified_Alliance
and
Trigger 0078c_DT_Break_Alliance_Neutral
What do these 2 triggers do?

2.
I always got an impression that if I attack other countries' troops frequently, I get bad global reputations gradually (even I always release the prisons). However, I could not find the relevant triggers in the file. So it was merely my illusion?

Thank you,
neon1300

taw said...

neon1300: I'm not sure what's the difference between nullifying an alliance and neutrally-breaking it.

Attacking enemy armies (0068_T_Battle_Engagement etc.) does not affect your global reputation, as long as you don't execute prisoners.

neon1300 said...

Thanks again, taw. :P

neon1300 said...

Hi Taw,
Sorry for bothering you again. I know its 0 when your reputation is neutral, I am wondering what is the max pos/neg reputation point you can reach in game? Is it 1 and -1? If it is true, then the punishment point from Trigger 0051_T_Stole_Back_Settlement is incredibly too huge?

Thanks,
Neon1300

taw said...

neon1300: Yes, max is -1 and +1. Stealing back settlement is supposedly for settlements you gave via diplomacy then stole back militarily, not for those that change ownership by wars and back.

neon1300 said...

/bow for taw

laurence said...

Surely a 10 to -10 would be better? its just seeing this it seems even the slightest mistake would turn your loving ally to a hateful enemy.

taw said...

laurence: It doesn't matter what's the scale, only how strong effect actions have. If you want actions to have less effect, tweak numbers in that file, it's easy.

The best you can hope for is making M2TW diplomacy only slightly less broken.

laurence said...

thanks mate, nice thinking. think i might increase and decrease some numbers now

osete13 said...

Hi taw can i ask you a question?
does this affect old save games?

taw said...

osete13: Old save games will work perfectly, but diplomatic effects of past actions are not recomputed - if they started hating you, they'll keep hating you after the patch. Only new actions will have diplomatic bonuses and penalties calculated correctly.

For best experience I recommend starting a new campaign.

osete13 said...

so if my faction were to be nice in now, then this changes would take effect. sorry for being noobish and
thanks for the answer :)

taw said...

osete13: The problem with m2tw is that diplomacy is self-reinforcing.

If you have bad reputation, others will start wars against you, and your reputation will go even lower.

If you have good reputation, you will have reliable allies, fewer wars, etc. so your reputation can stay high.

Best to start a new campaign.

Anonymous said...

Wait...so we make a txt file in our folder with the content from http://taw.chaosforge.org/m2tw_concentrated_vanilla/descr_faction_standing.txt

and we name it descr_faction_standing?

taw said...

If you run unpacker this file should already be there. Otherwise, I think putting it into data/ directory will override descr_faction_standing.txt in pack.

Anonymous said...

Ok, I just put it in the directory without unpacking anything. Thanks!

Anonymous said...

Even after unpacking, I can't seem to find the file in question at all.

Anonymous said...

I will be your frequent visitor, that's for sure. pain relief Read a useful article about tramadol tramadol

Anonymous said...

Hey, what's the path to the descr_faction_standing.txt file (the original)?

Ty

Anonymous said...

Hey, what's the path to the descr_faction_standing.txt file (the original)?

Ty

taw said...

Anonymous: You need to run unpacker first (it's in Medieval II Total War\tools\unpacker).

After you unpacke you must detele Medieval II Total War\data\descr_geography_new.txt and Medieval II Total War\data\descr_geography_new.db files or the game will not run.

Full path is Medieval II Total War\data\descr_faction_standing.txt after unpacking.

Medieval II Total War directory itself is most likely in something like C:\Program Files (x86)\Steam\steamapps\common\Medieval II Total War if you have Steam version.

Anonymous said...

so do i just copy and paste that link a tthe top ?

taw said...

Anonymous: Follow instructions in my comment above. You need to use unpacker first, then replace the file in data/.

milo said...

How do you download the file? When I click on the link I go to a internet page.

taw said...

milo: File > Save as (descr_faction_standing.txt), and there you go.

Your browser can display text files, so it displays them instead of showing Save as dialog right away.

milo said...

thanks, I’m playing as venice and I’m trying to remain friendly with the holy roman empire, so a bug like this is very irritating.

Anonymous said...

Ok man, you did a good job on explainning what it does, but you barely explained the part about fixing it. I did this wild goose chase. I did the repack thing, I couldn't find the files you said. I looked at the instructions of the repacking, but it said you need Alpaca's, I looked that up, and it was a guy who released a engine. And I need to download Python. So could you please make a better/imporved step by step on FIXING the bug. Thank you.

Anonymous said...

THIS IS DRIVING ME CRAZY, now this doesn't work, now my game always crash when I enter the battlefield. OH MY GOD.... Oh yeah, call me Jim, the comment above is mine.

bradebuque said...
This comment has been removed by the author.
taw said...

bradebuque: I'm somewhat active on twcenter as well.

To fix this bug you need to:

* Use unpacker (included with the game), following all instructions (including deleting two files the documentation tells you to)
* Then replace one file in data directory with one linked in this post.

That's all.

bradebuque said...

sorry my bad english

I didnt understand... do I have to create a text file with the content of the page "http://taw.chaosforge.org/m2tw_concentrated_vanilla/descr_faction_standing.txt" and, this file must have the name "descr_faction_standing.txt", and do I have to place this file in the data directory? But, my data directory have 4 directories: "animations", "cursors", "fmv", "sound" and "world"... and inside these directories therea are anothers directories... What is the exact path in the data directory that I have to place the "descr_faction_standing.txt" file? Or do I have just place in the data directory? but, in the data directory there are no anothers files, but the four directories that I have mentioned...

taw said...

bradebuque: You need to use the unpacker first. Here are instructions.

Then you'll see the file in data/ directory you'll need to replace.

I wish it was simpler.

bradebuque said...
This comment has been removed by the author.
bradebuque said...

argh... appeared nothing in the data directory...has just the 5 directories I mentioned before... but now the game crashes every time I enter in a battle. I followed all the instructions, I clicked on the "unpack_all" file, but nothing new appeared despite all the process the "unpack_all" file took... appeared a black window, I nodded, and all, took a couple of minutes, but appeared nothing new...any ideas?

taw said...

bradebuque:

Latest patch is 1.3 for Medieval 2, and 1.5 for Kingdoms.

You need to delete 2 files after running unpacker, just as described on page I linked. Otherwise game won't run.

There are no unofficial bugfix patches.

bradebuque said...

I understand that I have to delete these 2 files, but I can't find them, anywhere in the game directory... I searched every folder in the game directory...I am going to reinstall the game and the patches, but I feel that, without this fix, one must only play as a dread character...

bradebuque said...

problem solved... the files of unpack were in the virtual store... I really don't know the purpose of this folder...thanks...

bradebuque said...

hi , it's me again, can I ask a question? what should I do to decrase unrest and squalor? Wich buildings do that? I already have look in the total center, but nobody knows for sure what do that... please answer me

taw said...

bradebuque: You mean you want to mod that, or in game? You can decrease unrest by building wall settlement upgrades (walls), city halls, and temples.

bradebuque said...

I mean in game...I think that the buildings that increase happiness decrease unrest, and buildins that increase health decrease squalor, but I am not sure, and beacause of that I asked you...is that correct? thanks again about the information



There's another things... If my leader has high dread, and my generals has high chivalry, there is a chance that my generals leave my army?

taw said...

bradebuque: Yes, health decreases squalor and happiness decreases unrest.

There's no connection between dread/chivalry and general going rebel - that's random event, usually triggers when general is standing in the field doing nothing for long, and even then it's rare.

Anonymous said...

Does it matter whether we have game version 1.0, 1.2, or 1.3? I'm currently running 1.2 and just want to make sure it doesn't make any unwanted changes.

taw said...

Anonymous: It's completely untested on older versions, I'd recommend an upgrade.

Anonymous said...

Hi Taw,

The above post about versions is mine. I've taken your file and placed it in my data folder. Game run's fine, no errors, however i've taken over around 5 rebel settlements, always occupied peacefully, and my reputation is still at mixed. I'm about 25 turns into the game.

Should I of seen an increase in reputation by now? Supposing i have't been doing other largely negative things?

Should I unpack the files and replace it manually?

taw said...

Anonymous: Yes, you should be seeing increased reputation unless you've been executing (non-rebel) prisoners or something like that.

I don't remember how many settlements you need to take to see increased reputation but it was fewer than 5.

Anonymous said...

Hmmm.

I haven't seen any increase in reputation. Also, every faction is at mixed, same as me.

What do you think is going wrong?

taw said...

Anonymous: As far as I can tell it's not reading the modified file, but it's really hard to debug such issues remotely. Do you have 1.3 version and used the unpacker?

Anonymous said...

Updated to 1.3. Unpacked and replaced file. Turn 30, been fairly peaceful, all factions still at mixed. Medium difficulty, polish faction short campaign.

taw said...

Anonymous: It seems pretty clear it's not reading the file for some reason, but it's very difficult for me to figure out why from here, sorry.

Anonymous said...

I began unpacking the file in the steam version. I selected the unpack_all.bat file because the unpacker.exe did nothing except prompt me. After using the unpack_all.bat it started this long promp of unpacking all these files. (I'm assuming this is the right track). Now, when this is finished I need to delete the two files you listed, then I just replace it with the one you provided? Or do I just need to just delete the two files and leave it alone? I'm unsure, because you said that the correct file should be in the unpack? I have not downloaded anything and I am just using the 1.3 steam version. Thanks again.

Anonymous said...

Hi, I just left the most recent comment. I think I did it correctly. I deleted the two you named, then I deleted the faction standing one and replaced with the one you mentioned. Correct yes?

taw said...

Anonymous: Yes, delete the two, then replace that one.

Does it work properly now?

Anonymous said...

Thank you for the quick response. I am starting a new campaign now for best results. I went into the cfg file and changed it to make sure the game did not overwrite the unpacked files and to read only to ensure they dont change. That shouldn't affect it right? Lastly, how soon should I see these new "results" in reputation? Thanks again.

taw said...

Anonymous: You should observe the change quickly. Hopefully it will work fine this time.

Anonymous said...

An update. I've been playing for about 20-30 turns. Went to war with the moors for a few turns on a successful crusade made peace. Currently at war with HRE. Made an alliance with the pope. The three cities I have taken have been through occupy. Should I be seeing anything already or be a little more patient? I haven't broken anything minus a trade rights with the moors when I did the crusade. All factions are at mixed still. Forgive me if I am asking too much too soon lol I got some information from the TWC, they said to also put in a code into the cfg file to make the unpacked files "stick" and prevent them from being overwritten. Could that affect anything?

taw said...

Anonymous: Try one or two more cities.

By the way, you haven't been executing any soldiers, right? Always use ransom if you don't want to lose opinion.

Anonymous said...

I'm going to restart the campaign. I think I know why everyone is still staying mixed. Nobody has attacked really except for me and the surrounding territories. Its an all out war in the Italian peninsula, so I think that is why. I'm going to restart as spain as see what happens. I just want to make sure it works.
TWC recommended putting this
[IO]
file_first = true

into the medieval2.preference.cfg to make the unpacked files "stick" could it be affecting anything?

Thanks again!

taw said...

Anonymous: It works for me without io first thing, but you could give it a try.

Anonymous said...

thx for finding this bug! i love this game and for playing various factions its nice to know why some hardships appear... but for know i play england and my archers dont let much people alive to imprison ^^
im globally very respected due to freeing all prisoners :D

Anonymous said...

hey u seem to know something about the code and how its written... is there a way to change it so that my king doesnt lose chivalry and the trait mean leader or worse when i just assassinate other spies and assassins?

taw said...

Anonymous: That's controlled by `export_descr_character_traits.txt`- entries with `WhenToTest LeaderOrderedAssassination`.

I don't know if you can modify that it does different things depending on target type. You can always just disable that if you wish.

Anonymous said...

Hello! I have a question - I know declaring war on an ally lowers reputation - but what if you attack a neutral army beside an army thats allied to both sides? Does that count as you attacking both (ie. attacking your ally)? Or does it count as your ally siding against you?

Thanks for your time, hope you can help.

taw said...

Anonymous: Breaking alliance screws you no matter how you do it. Even if you attack nobody, but two of your allies go to war - you'll still lose reputation.

Anonymous said...

I understand that - but does attacking your allys ally (and ending up at war with your ally as a result) count as you attacking your ally or your ally retaliating against you? The first way you would lose rep, the second they would.

Thanks for your help.

taw said...

It's not explicitly specified in the data files, IIRC the faction that gets the choose side popup gets the penalty, not the original attacker, but I'm not 100% sure.

Anders Hansen said...

Do you know if this bug was solved in the Kingdoms expansion update?

taw said...

Anders Hansen said: I can't check it right now, but as far as I remember it was never fixed. You can manually edit that file, removing CitySacked section.

LORENSSIOK said...

Is this bug still active? I have version 1.2
And the link is not working :)

taw said...

LORENSSIOK: I fixed the link, my old server was down.

By the way, you should probably upgrade to 1.3. I think my fix will work with 1.2 as well, but there's no reason not to upgrade.

Jimbo said...

Hello! Just picking this up again. I reinstalled on a new computer and I want to make sure I am having correct diplomacy. I am updated to version 1.03 (checked in game) and I am curious to know the process to putting this in there. I see something about unpacking, but then it says I just need to change 3 semicolons. Then I have to do something to make the code "stick." Can you guide me to get this fixed as of 4/23/2014 :)
Thanks.

taw said...

Jimbo: You need to do the unpacking first. Unpacker is included with the game, but then you'll need to delete two files manually anyway. Here are instructions.

After all that, replace that one file in data directory.

Jimbo said...

I click on the link and it takes me to a new page, do I just copy and paste it into the exact same thing in my directory? thanks again.

taw said...

Jimbo: Full list of steps are:

* Go to tools\unpacker
* Run unpack_all.bat
* Delete data\descr_geography_new.txt and data\descr_geography_new.db
* Replace descr_faction_standing.txt with one linked from this both

Lukas said...

Hi there. :) Sorry for being another in the long line of "botherers". I unpacked all files, copied your fixed .txt file both to Data folder in the installation folder of the game AND to the Data folder in AppData/etc. (since I am running Windows 7). I did not delete those two files you say should be deleted, because as far as I understood, the game is not supposed to run if I won't delete those - and it's running, so I just assumed there's no need to do it. ... Still, after doing all this, I am not very confident that the fix works for me. I started a new campaign as England. I conquered and occupied 9 rebel settlements (London, Nottingham, York, Caernarvon, Dublin, Rennes, Bruges, Antwerp, Caernarvon) - no treaty cancelling, no trespassing, no sacking/exterminating... I was so much looking forward to this being fix, as I would love a working diplomacy (it's the only thing I really miss in Total War games actually).. Would you please give me any guess as to what it might be caused by, or what to do to ensure it's working? Would be more than much appreciated... :)

taw said...

Lukas: If the game is running without these files being deleted, it sounds something went wrong at unpacking stage. It's really hard to debug such problems remotely, I wish they just made it easier.

Lukáš Dohnal said...

taw: Thank you. :) I'll just try to reinstall and do the whole thing again. ... I just don't get it - Rome and Medieval 2 are such an amazing games, the diplomacy is really about the only major thing that's almost non-existent and for me, the thing which would make the series almost godlike if added (and maybe even expanded a bit). I am totally amazed that CA never fixed this particular bug, because it's such a MAJOR deal affecting the whole experience.

taw said...

Lukas: Medieval 2 was made by (no longer existing) Creative Assembly Australia, not by the main Creative Assembly studio, so they're not fixing bugs in each other's games.

Lukáš Dohnal said...

taw: I see. And what about the Rome: Total War then? Because I've been having the same problem with that game too - my biggest issue with it is - again - diplomacy. They've never fixed that too. Also, I wonder why the Australian branch didn't fix the Medieval 2 diplomacy retrospectively.

taw said...

Lukas: It's hard to "fix" diplomacy - it needs to balance between AI being fun to play against (=somewhat aggressive), AI being sensible (=very cautious), lack of major exploits etc.

They could have reasonably fix this one line fuckup, but probably not do full diplomacy system redesign of an old game.

Australian branch didn't survive long past Medieval 2, it got turned into Sega studio after Sega bought CA, I don't really know the details.

I've also heard CA doesn't really have full source code and toolset to build either of these games any more from CA devs. Not sure how much they were exaggerating.

Lukáš Dohnal said...

taw: Reporting back again. I've figured out a likely reason why the game wasn't reading the file. I was browsing through internet forums and found out that supposedly the game is reading from the packed files by default, unless specifically instructed to read from the unpacked files. So, I followed these steps - I uninstalled the game and deleted all leftover files from both the folders (game folder in normal Program Files/SEGA and the folder in AppData/etc.). I installed the game again (just the original Medieval 2 without expansion) and installed both patches (1.01, 1.02). I also turned off User Account Control before I used the Unpacker so that the unpacked files would end up in the game folder and not in AppData/blablahblah/VirtualStore/etc. I used the Unpacker then. Seems the files unpacked fine. I deleted both of the geography files that are supposed to cause the game to crash. Then I replaced the faction standing file from the Data folder with your fixed one. Then I followed the instructions to tell the game to read from the unpacked files rather from the packed ones by opening the file from the game folder medieval2.preference.cfg in Notepad and adding a line "[io] file_first = true". Then I ran the game. ... Now, since I've done all those things, the game should be using your file. However, I tried it out (England - occupied definitely more than 6 times, no executing prisoners etc.) - reputation still at mixed (I don't know how to check the actual numerical value of the reputation so I can't really tell if "mixed" means it stayed at zero or if occupying had some effect, albeit not enough to get me to Reliable. Any clues? Do you think the game has the problem with your particular file or that it simply still reads all files from the packs instead of reading the unpacked ones? Is there a way to find out?

taw said...

Lukas: It sounds like it's still reading from the packs.

I've heard of this [io] file_first = true thing, but it works for me either with or without it.

I'm not sure what else can be done. Maybe delete the packs, or try on another version of the game (like steam or cracked). It's all very weird.

Lukáš Dohnal said...

taw: I came to a partial solution. I found your other article about your minimod for vanilla M2TW. I used the minimod. The reputation change is now in effect, which is a good thing. But the mod seems a bit weird to me in a few respects. :B Like... How come it takes just one shabby turn to build any building? Seems a bit immersion-killing for me. :) What's the logic or thought beyond this change, if I may ask?

taw said...

Lukas: If you're using the mod builder, just open build_concentrated_vanilla_gui.rb and change line 276 from:
load_settings! load_settings_file("settings/default.txt")
to:
load_settings! load_settings_file("settings/minimal.txt")

That should mostly leave bugfixes. (I thought I added GUI for that, apparently I forgot :-p)

The rationale is that the game is usually over long before reaching late game, and I wanted to play with late game units sometimes. People have different taste about game speed.

Lukáš Dohnal said...

taw: Ah, I see. :) Thanks, I'll try to do that. (I'm not using mod builder and I don't know how to, but I know how to use the internet so that'll have to do :D) .. One more question - is there a way to transfer all those bug fixes to the Kingdoms expansions?

taw said...

Lukas: If your unpacker works on Kingdoms just do the same fix (commenting out or deleting Trigger 0102_city_razed_decrease_global ) in file with the same name (descr_faction_standing.txt) in appropriate directory.

Lukáš Dohnal said...

taw: Turns out I don't know how to use it. I downloaded it from your blog (http://t-a-w.blogspot.co.uk/2012/11/make-your-own-medieval-2-mod-with.html), unpacked it into the Medieval 2 game folder and ran start.bat. Nothing really happens though. A black window just pops out for a fraction of a second and disappears. No interface opens. Please help me o mighty modder! :'( I'd so much like to play the vanilla without bugs.

Lukáš Dohnal said...

taw: Back to the original issue - I deleted the pack files. Now the original game won't even run. :) So unless there's something in the packs which the unpacker doesn't unpack, it seems the game was still reading from the pack files. Dunno what to do about it. And the reason I am concerned about this is that you told me to simply make the changes to the relevant files if I want to transfer the reputation change to Kingdoms - however, if it'll behave like the vanilla version, I can't do that. I really don't know what to do, I've tried everything I could think of. I've tried using both a batch file and changing the .cfg file to make the game read from the /Data folder.

Lukáš Dohnal said...

taw: Yet another update. :D I tried "modding your mod" using the mod builder - what I did was that downloaded 0.61 of CV (I suppose that's the newest one), which comes with the mod builder. I tried to run start.bat. A black window opened up saying this:

C:/Program Files/SEGA/Medieval II Total War>jruby --1.8 build_concentrated_vanilla_gu.rb
Cannot locate Java installation, specified by JAVA_HOME:

C:/Program Files/SEGA/Medieval II Total war>pause
Press any key to continue . . .

When I press any key to continue, the window closes and nothing happens. ... Basically, I don't care about whether I can mod my Medieval 2 filet or not. All I want is the vanilla game with fixed diplomacy (any additional bug fixes are a bonus for me, but not required). If I could run your minimal version of concentrated vanilla, that would be good enough for me - but I can't run the mod builder. .. Also, if I would eventually be able to run it, is there a way to apply those changes to Kingdoms too WITHOUT having to mod the files themselves? (as I'm afraid the result will be the same as when I tried to mod the vanilla files)

taw said...

Lukas: You need JRuby installed for the mod builder to work. [ http://jruby.org/download ]

Lukáš Dohnal said...

taw: I managed to install JRuby and to edit the file to tell the mod to use minimal changes. I was looking forward to finally playing the damned vanilla game with diplomacy fixed, but then I figured out that the game crashes every time I want to enter a battle. :D No matter if in campaign or custom. It just crashes saying something like "Medieval 2: Total War has encountered an unspecified error and will now exit."

taw said...

I'm not sure what that's about, do you have fully upgraded game (1.03 I think)?

Lukáš Dohnal said...

taw: Yes, 1.03 (fully patched Medieval 2 without Kingdoms). I might have done some "mess-up-change" while tinkering with the files, so I will uninstall the whole thing and delete the game folder, reinstall Medieval 2, patch it to 1.03, crack it, then I will "install" your mod and see if I can run the battles. .. Btw, sorry for bothering you with all this and thanks a lot for all your help so far. :)

Lukáš Dohnal said...

taw: Finally got it to work, after reinstalling. Now I just hope no more bugs'll show up. :) Thanks.. Now only thing I'd like would be to be able to transfer the fixed diplomacy (+ possibly the other bug fixes) to Kingdoms - though I am not trying modifying the files again unless there'll be no other option. :D

taw said...

Lukas: Enjoy the game :-D

Lukáš Dohnal said...

taw: I wonder if I should say what happened - that I played as England for a while and found out that the reputation bug's there AGAIN.. :D .. I did a clean reinstall, then I downloaded your CV 0.61, unpacked it into M2TW folder, and then.. I'm not sure if I did it right.. I searched the subfolders for the something.bat file and something.cfg file, copied them into the main game folder and then I ran the .bat file. ... Not sure if I did it right..? .. 'Cause the .bat and the .cfg file which are required to run the mod aren't located in the .7z archive which contains CV 0.61.

Lukáš Dohnal said...

taw: I just tested whether it even reads the modded files or not - turned out it doesn't. I changed it to read from the default.txt instead of minimal.txt, so that I could see if the buildings' construction time will be 1 turn or not, and it ain't. So... I'm guessing I installed the mod wrongly. Would you please tell me how to install it then? ^_^

Lukáš Dohnal said...

taw: Ok... I think I figured it out. :D Copied contents of the "Output" subfolder into the main folder and ran the .bat file. The Readme needs updating. :) Anyway, hopefully no more problems from now on. :D

Lukáš Dohnal said...

taw: ... argh... Celebrated too early. Again. .. All is fine now EXCEPT that the mod is reading from default.txt instead of reading from minimal.txt, even after I changed that line you told me to change above (I could tell by the fact that every building takes one turn to build).

taw said...

Lukas: The mod builder has Build, Install, and Run commands in its menu, you shouldn't have to copy anything manually if they work.

Lukáš Dohnal said...

taw: Right, I've just looked it up in one of your posts. I assume the other commands are supposed to be under File together with Build. But in my case, they ain't there. From what I understood from the other article, it might be caused by the mod builder not "correctly detecting" my installation of Medieval 2. If that's the case, is there a way to tell the mod builder manually the installation path of Medieval 2? (if that would be of any help, which I do not know)

taw said...

Lukas: Just press Build, then copy everything from output directory to your m2 directory.

output/mods/concentrated_vanilla to /mods/concentrated_vanilla

output/concentrated_vanilla.bat to /concentrated_vanilla.bat

Then run concentrated_vanilla.bat - it works with all non-Steam versions (Steam version needs some registry manipulation which installer does)

Lukáš Dohnal said...

taw: FINALLY!!! THANK YOU THANK YOU THANK YOU! :D

taw said...

Lukas: Enjoy the game :-)

Lukáš Dohnal said...

Just thought I'll pop in to say I've been having a pretty good time so far. :D The diplomacy with the fix is still far from perfect, but at least it's.. Digestable now. :D I was reading on quite a few forums that polearms and other two-handed weapons are "bugged" (= "rendered ineffective by slow animation which causes the attacks to be interrupted"), and also that the pikes are "bugged" (= "pikes unreasonably soon switch to swords when attacked by cavalry"). Is that true? I have tested both things by myself, and it doesn't seem to me like that - pikes were alright if the line was wide enough not to get flanked when charged, and two-handers (Norse Axemen) were effective when used as a "foot cavalry".. Since they have low defense and high attack and charge. Kind of shock troops to cause a lot of casualties suddenly, possibly instantly routing the attacked unit (even Dismounted Knights, when executed properly).

taw said...

Lukas: Yes, pikemen and 2-handed are bugged.

In M2 offense stats don't work like what the numbers suggest - available animations determine as much as stat numbers, so it's hard to tell how good unit actually is.

Pikemen can be fixed by taking away their swords, but they become stupid overpowered then, since AI has no idea how to flank or strategically use archer fire against them, so I'm not sure if fixing that won't introduce more problem (mod builder has optional fix for it).

Units with two handed weapons just lose to similar level units with one handed weapons one on one, by a lot, something which is not meant to happen if you look at stats. You can see that if you try a custom battle.

Lukáš Dohnal said...

taw: Yeah, I tried that, but then I thought "hey, maybe people just think it's a bug, maybe they weren't meant to be used like that in the game" - they are clearly offensive troops, 2 handers. So I thought maybe they're meant to attack and not to be attacked. So I charged axemen in the back of engaged Dismounted Chivalric Knights, and they had quite nice effect (strong charge, big morale hit since lot of casualties on impact). I think Billmen can be effective when used similarly, or when cavalry doesn't have the option to charge them (close quarters?).

Lukáš Dohnal said...

taw: Also, as I said earlier, the pikes held the formation and handled the french Noble Knights nicely when put into a formation wide enough not to get flanked - since I think that's what's causing them to start switching to swords.

JensTheViking said...

Can I just edit my .txt file to look like yours or will it crash the game somehow? Or should I just overwrite the current file with yours (again, will it make my save games crash etc)?

Should I reinstall the game in order to get this to work?

Are the digits after the effect number (1.0 40) the dividing multipliers (so as to 1.0 40 means that the one is divided by the number 40)?

taw said...

JensTheViking: You can update the file.

1.0 40 means go 1/40th way from current to zero.

Basically:

new = (39/40) * old + (1/40) * 1.0.

Mazku said...

Is this fix save game compatible?Wil it affect a started campaign after I've substituted the standing.txt?

taw said...

Mazku: It should affect your reputation from future conquests, but it won't change it retrospectively.

Mazku said...

I've managed to extract files and place your modified file.Tested with England,conquered 5 cities and still in Dubious.

taw said...

Mazku: I don't know how to debug this remotely. :-/

Prontius said...

hi taw thank you for pointing out this issue in a game I recently became nostalgic for.

I wanted to comment here in case others had the issue I had today when trying to get this fix to work.

I unpacked, deleted the geography files, inserted the [io] file_first = 1 into the config file and replaced the standings file with your version. This caused the game to crash when I tried to launch it. I got your fix to work by only modifying this section of the original standings file to the following:

;Trigger 0102_city_razed_decrease_global
; WhenToTest CitySacked

; FactionStanding global -0.05
; FactionStanding target_faction normalise -1.0 10
; FactionStanding target_allies normalise -1.0 20
; FactionStanding target_enemies normalise 1.0 20

; make all other factions hate the rebels

I have no idea why this works for me when using your file did not but I want to add this to the list of things for people to try if they have problems.

Thanks again.

taw said...

Prontius: Thanks. The game is old and has been released in so many versions, I don't have any way to test this method on all of them.

Anonymous said...

Hi taw, this is great stuff! However, I have a problem. Its quite clear that the game isn't reading the file. I've unpacked everything, deleted the two files, stuck it into the data directory, brought in the truefile first thing into the preference.cfg file and nothing. I even ramped the values up to crazy levels so I could see the effects they'd have quickly to ensure it was working and nothing.

The way I tested it was that I changed the occupy settlement bonus to the same as the penalty from the exterminate population. This meant that it would be the same in a positive sense for occupying a settlement as in a negative sense for exterminating one. Then I take the three rebel settlements England can in the first few turns (York, Caernavon and Rennes). No change.

Three exterminations=dubious
Three occupies=still mixed

I've even changed the bonuses to papal relations from religious buildings, again to see if it was working. I've amped them up to a small church giving a 1.2 boost instead of a 0.02 boost and still, no change from the original

Can you offer any further advice? I'm using the latest Steam edition, got it in the Steam Sale.

Thanks taw,
Ev

taw said...

Ev: I can see that the game isn't reading the file, but It's really hard to debug this remotely, sorry.

Anonymous said...

That's okay. I appreciate all the work you did on this anyway, it's a really great little fix!

Best