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.
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.