Log in

View Full Version : Adding \"new\" factions in MTW campaigns



Wellington
09-24-2002, 07:02
Hi guys,

This will be a pretty long post, in two parts, but I'll try to explain what I've ascertained regarding factions in the campaign game, specifically with regard to adding new factions.

The first part (this post) will discuss how I think MTW handles the factions and what the implications are. I'll post a second part (maybe tomorrow), in this thread, giving a step by step guide to adding the Scots as a playable major faction (which I've managed to do).


OK, the 1st question to ask is how many factions are pre-defined in MTW? For this info we can look into the file 'regowners_table' in the root directory. This is literally a file and has no extension, but you can open it as a text file with Notepad. This file contains (in my opinion) all the playable factions, in total 21, these being defined as -


1) FN_REBEL
2) FN_ALMOHAD
3) FN_BYZANTINE
4) FN_DANISH
5) FN_EGYPTIAN
6) FN_ENGLISH
7) FN_FRENCH
8) FN_GERMAN_HRE
9) FN_ITALIAN
10) FN_POLISH
11) FN_RUSSIAN
12) FN_SPANISH
13) FN_TURKISH
14) FN_ARAGONESE
15) FN_BURGUNDIAN
16) FN_GOLDEN_HORDE
17) FN_HUNGARIAN
18) FN_NOVGOROD
19) FN_PAPIST
10) FN_SICILIAN
21) FN_SWISS

There is one more 'faction' defined, FN_NONE. This is not a true playable faction but only represents the 'owner' of sea area provinces, whereby no one ever owns them. We can effectively forget FN_NONE.

(Note - I've yet to suss out what the entries in this 'region owners' table represent, but it does'nt appear to be used in MTW so lets not worry about it)

It should be stressed that the order of these factions is VERY IMPORTANT, as this specific order fits in with other tables, such as shields/flags. The 20 playable factions (ignoring FN_REBEL) should really be considered to be numbered 1 to 20, as opposed to 2 to 21, as this fits in very nicely with the naming conventions of many other files (eg: FLAG1001.tga to FLAG1020.tga)


The 2nd question should now be, how many factions are playable at any one time? For this info it helps to take a look at the main executable - Medieval_TW.exe. If you scan this with a good utility (I use "Search and Replace", a great utility - download from www.funduc.com), (http://www.funduc.com),) and browse it with a good hex editor (I use SPF/SE40) you will find 2 hard coded 'tables' pertaining to factions.

If you locate the string 'FN_PROPERTIES' you will find a 'table' consisting of 18 entries, each entry presumably being available for one specific faction in the game thatthe AI controls and presumably holding details of properties associated with that faction. These entries consist of the string "@3UCDAPFN_PROPERTIES@@A", each entry being followed by a number of hex zeros - these null entries being filled with the properties/characteristics of a specific defined faction (depending upon the actual campaign script, EARLY, HIGH or LATE, that define the factions possible for that period - "SetActiveFaction"). Obviously this 'table' may represent either a list of parameters for a callable function or (more likely) a table. The interesting thing is that although there are 21 factions defined this 'table' consists of only 18 entries - AND NO MORE!!!!

If you locate the string 'FSM_faction_info_faction_' you will find 3 more tables, each containing 32 entries pertaining to the EARLY, HIGH and LATE periods respectively. Each of these tables contain similar entries, the first 21 being the MTW defined factions followed by 11 free slots (EXTRA_1 to EXTRA_11). These tables are referenced if your script has 'cn_predefined::true'. I think the extra 11 slots are merely there ready for future expansion by CA.


All of this strikes me as indicating that there are currently a maximum of 18 AI controlled factions (major or minor), possible at any one time in a campaign game and this maximum cannot as yet be increased. However, we know there are many other text files that define tables of descriptions that may contain up to 64 entries (the last 43 being named FREE01 to FREE43). Unfortunately, I suspect this is also a bit of a red herring, and trying to mod these entries to create more factions is, IMHO, going to be fruitless.

Many MTW files/tables such as these appear to have been pre-prepared for a possible expansion, but the governing factor must surely be this hardcoded table of FN_PROPERTIES in Medieval_TW.exe. This makes sense to me. When CA release an add-on in the future, most of the work for adding new factions has been done and it should ony be a question of increasing the number of entries in the FN_PROPERTIES table (this strategy ensures that CA can control the amount of faction modding that is possible, whilst retaining the ability to easily produce future add-ons that extend the number of playable factions - fair do's to them, makes good business sense to me!).

So ... is this gloom and doom? Well, not necessarily.

If we suspect there are 18 hard-coded 'slots' for AI controlled playable factions (whether major or minor) we should now look at what the 3 scripts (EARLY/HIGH/LATE) define as playable factions, and build a table of this info -



Factions EARLY HIGH LATE

1) FN_REBEL no no no (Note 1)
2) FN_ALMOHAD yes yes yes
3) FN_BYZANTINE yes yes yes
4) FN_DANISH yes yes yes
5) FN_EGYPTIAN yes yes yes
6) FN_ENGLISH yes yes yes
7) FN_FRENCH yes yes yes
8) FN_GERMAN_HRE yes yes yes
9) FN_ITALIAN yes yes yes
10) FN_POLISH yes yes yes
11) FN_RUSSIAN no yes yes (Note 2/3)
12) FN_SPANISH yes yes yes
13) FN_TURKISH yes yes yes
14) FN_ARAGONESE yes yes yes
15) FN_BURGUNDIAN no no no (Note 2)
16) FN_GOLDEN_HORDE no no yes (Note 2)
17) FN_HUNGARIAN yes yes yes
18) FN_NOVGOROD yes no no (Note 3)
19) FN_PAPIST yes yes yes
20) FN_SICILIAN yes yes no (Note 2)
21) FN_SWISS no no yes (Note 2)


The notes ....

Note 1: As FN_REBEL are not defined as factions in the scripts I presume no entry in FN_PROPERTIES is 'reserved' for them. As they are the only faction ALWAYS present in campaigns I suspect their properties are hard coded in some other manner (this would explain why I can't define the rebls as a playable major faction).

Note 2: Whilst there are 20 playable factions (excluding FN_REBEL), not all are defined at any one time in the respective scripts.

Note 3: The FN_NOVGORAD and FN_RUSSIAN factions are mutually exclusive, as they both use the same colour in the campaign.


So we can now ascertain that there are actually 19 playable factions at any one time (excluding FN_REBEL, and considering you can't define both FN_NOVGORAD and FN_RUSSIAN in the same script). I've tried this, defining 19 factions as FN_MAJOR, and you can indeed play any of them. However, considering one faction MUST be played by the gamer - this leaves us with a maximum of 18 AI controlled factions. This is interesting because we know that the FN_PROPERTIES table in Medieval_TW.exe has a maximum of 18 entries also!


Now if we consider the "yes" entries in the above table we see that EARLY has 16 defined factions, HIGH has 16 defined factions, and LATE has 17 defined factions.

However, in both EARLY and HIGH campaigns we know that the Mongals (FN_GOLDEN_HORDE) appear later - thus giving another faction during the game and raising the number of AI controlled factions (either pre-defined or appearing later) to 17 also. Therefore it appears we can utilise 2 more factions, that are neither being used nor are going to be used (ie: Mongols) in each of the present scripts.

The key to all of this is 19 maximum playable factions, 18 being AI controlled - at present.

Now, if we wish to add a "new" faction it's important to realise that the faction identifiers, FN_REBEL etc:, are merely identifiers. CA could just as easily named them FN_1 to FN_21 - it really does'nt matter. Furthermore, most if not all, of the characteristics of factions are defined in the EARLY/HIGH/LATE scripts and are NOT dependent on the faction identifier. Therefore, if we wish to mod a script and add a new faction, we can use the identifier for a faction that is not being used to represent our 'new' faction, providing we don't exceed the 19 maximum. For example, if you mod the EARLY script you can create a scottish faction by using the FN_BURGUNDIAN identifier for them. Ok, you'll inherit the Burgundian colour (I'm still looking into this) and have to make other changes/additions but its possbile.

Well, thats it for now. Can any of the CA guys confirm the above ?

Tomorrow, I'll write up all the steps required to add the Scots as a faction, using the FN_BURGUNDIAN identifier, in the EARLY script and post it to this same thread.

Hope the above serves to clarify some issues.

dclare4
09-25-2002, 11:02
Theoretically yes... but they would still be identified as Burgundian and get Duke Phillippe II ALWAYS as their ruler (early/high/late) - unfortunately they didn't tweak Burgundy at all though they included the 'germs' or 'seeds' so to speak. I think this is a huge oversight.

Gilbert de Clare

Wellington
09-26-2002, 20:55
No theory involved at all. It works. What you are effectively doing is replacing the Burgundian faction by a "new" Scottish faction.

True, you WILL have the Burgundian/French names specified for your Leaders - but this is a small price to pay.

I've been looking at activating the Scottish names (contained in names.txt) but it's difficult, if not impossible, because their appears to be a hardcoded table/index somewhere that associates the Burgundians (faction 14) with the French names. You can however change the King's name by playing with the 'StartLeader' values in the campaign scripts.

What is the 'huge oversight' - I don't follow this bit ?

BTW - as the Scot's were generally allied to the French during most of this period, having french names for Scot's army commanders is not TOO unrealistic, historically speaking!!!

barocca
09-27-2002, 06:18
Novogorod and Russian should not be mutually exclusive

Novorod use RGB colour codes
74/142/210 (blue) and 255/241/133 (yellow)

Russian use RBG clour codes
79/142/210 (blue) and 255/224/0 (yellow)


anyone tested if they can both be active at the same time?

(if i have time tomorrow and sunday i will run a test - i have no time to do anything till then)
http://www.totalwar.org/ubb/smile.gif



[This message has been edited by barocca (edited 09-27-2002).]

Lord Krazy
09-27-2002, 07:01
Quote Originally posted by barocca:
Novogorod and Russian should not be mutually exclusive

Novorod use RGB colour codes
74/142/210 (blue) and 255/241/133 (yellow)

Russian use RBG clour codes
79/142/210 (blue) and 255/224/0 (yellow)

anyone tested this yet?

(if i have time tomorrow and sunday i will run a test - i have no time to do anything till then)
http://www.totalwar.org/ubb/smile.gif

[/QUOTE]

---------------------------------------------
ye thats right they are different I never
tought they were the same but I checked to make sure .A few more shades too,and the
blues are not the same neither.

LK
---------------------------------------------Is fear riht maith le na droch she a'samh

spmetla
09-27-2002, 15:00
So Russia could be the sacrificed new faction in the early games and novograd in the high late games.



------------------
"samishika wa nai shitte irukara saigo wa itsumo hitori to"

"I'm not lonely Because I know I'll be Alone at the end"

email me at: Luftwaffle@mad.scientist.com

Wellington
09-28-2002, 06:51
Quote Originally posted by barocca:
Novogorod and Russian should not be mutually exclusive

Novorod use RGB colour codes
74/142/210 (blue) and 255/241/133 (yellow)

Russian use RBG clour codes
79/142/210 (blue) and 255/224/0 (yellow)


anyone tested if they can both be active at the same time?[/QUOTE]

It's true - just retested it. I was wrong about the mutual exclusivity (which brings into question my original faction assumptions - sigh). However, if you activate both Russia AND Novgorod in a campaign script it's almost impossible to differentiate between the two factions - neither on the campaign map nor in real time battle mode, which tends to make activating both factions in one script a bit confusing to say the least.

Why, I wonder, did CA choose to define 2 factions for what are essentially the same peoples ? Surely, it would have been easier to ignore the Novgarod faction in the EARLY script and merely use the Russians for all 3 campaign periods, or am I missing something (else!) here ?

Quote Originally posted by spmetla:
So Russia could be the sacrificed new faction in the early games and novograd in the high late games[/QUOTE]

Absolutely, and both factions colours are more comptable with a scottish faction than my original idea of using the Burgundians. You can even eliminate the Novgorad faction altogether and replace them, in the EARLY script, with the Russians (or vice-versa). This would give us a completely new modifiable faction without screwing up the CA predefined campaigns.

BTW - in custom battles this not a problem as CA have associated the Scots (in Bannockburn) with the French faction - giving the appropiate faction colour to the Scots. Pity it's not as easy in the strategic campaign scripts.