Log in

View Full Version : modding military production capability of captured settlements



none314
05-27-2005, 12:43
I've read through the fora and need to post certain modding questions, which I haven't been able to answer. I shall much appreciate your replies.

The goal: As it stands right now, a conquering army moves on to capture a hostile city. After bloody fighting the city falls and is occupied/ enslaved/ looted. Fine. Funny, however: If sufficient-level barracks are there, then the next turn you can have all your units replenished to full strength! With a sufficiently advanced city, you may even be able to train immediately better units than those you conquered the city with... I can hardly immagine, though, how newly conquered people would make such prime candidates for recruitment, especially of elite units...
This is the surefire recipe for unrealistic blitzing. It spoils the game for me. When I attack Carthage, I usually conquer city of Carthage FIRST by turn 20-30, and it has such great military infrastructure that I forget about my capital and train units there. I then conquer all remaining Carthagenian cities in a breeze, using units freshly trained-retrained in next-door Carthage.
Loyal hastati trained in last-year-occupied Alesia are no more realistic, just not as provocative as Carthagenian triarii.

Unfortunately, the effect of barracks seems culturally non-specific in export_descr_buildings.txt. Carthagenian barracks will happily train roman units of appropriate level. Canceling this ill-effect requires manual selling/ rebuilding. I can't bring myself to do that and you can be sure the AI won't play along with this scheme either!

A 'realistic' way would be to use the existence of any culture penalty in the city as a condition to NOT allow training. But I don't know if this can be done, I rather immagine it can't on the basis of the format of export_descr_buildings.txt. Besides, it would likely confuse the AI.

On the contrary, writing a script that orders baracks+stables+archery ranges destroyed when a setlement is captured would do much to simulate an 'assimilation period'. Making a captured city militarily productive would require investment of time and money. Poor units first. Good units later. It would deter blitzing. And the AI would naturally play along.
Currently, all the scripts I have seen mention no command of the type 'destroy/ remove building' or 'sell building'. And no, damaging a building to 100% won't cut it for me. So, any ideas?

2nd question, related: Do you know which parameter (and where) makes some buildings 'sellable' and others, like farms/ roads/ walls, not? I fear it is hard-coded, but hope otherwise...

I do hate this reverse engineering crap we have to go through to make a mod, but otherwise I would have dropped the game long ago :)

Please give me concrete feedback. I am hardly a rookie with programming (ahem, fortran 77...) :) An example to cut and paste would be optimal, but I can settle for less...
Many thanks

Epistolary Richard
05-27-2005, 12:59
Hi none314, welcome to the modding forums.


This is the surefire recipe for unrealistic blitzing. It spoils the game for me.
I agree, one way to tackle this would be to create separate building trees in export_descr_building for each different faction so you couldn't use a barracks built by another faction to produce troops. That means you'd have to build a new barracks before you could train troops. If they're in different building trees then the presence of one shouldn't block the creation of another. I think that RTR implemented something similar to this. I imagine that they have experience with how the AI handles it as well.


A 'realistic' way would be to use the existence of any culture penalty in the city as a condition to NOT allow training. But I don't know if this can be done, I rather immagine it can't on the basis of the format of export_descr_buildings.txt. Besides, it would likely confuse the AI.
As far as I'm aware, culture penalty can't be used as a construction conditional. You could have a 'culture' building to simulate it, but again I don't know how the AI would react to it.


Currently, all the scripts I have seen mention no command of the type 'destroy/ remove building' or 'sell building'. And no, damaging a building to 100% won't cut it for me. So, any ideas?
Alas not, I've looked into this myself and haven't discovered a way to script the destruction of a building. If you discover a way then several people would be interested to hear about it.


2nd question, related: Do you know which parameter (and where) makes some buildings 'sellable' and others, like farms/ roads/ walls, not? I fear it is hard-coded, but hope otherwise...
No one's officially said anything, if someone knows then they're keeping it to themselves.


I do hate this reverse engineering crap we have to go through to make a mod, but otherwise I would have dropped the game long ago
Would it have killed them to provide a list of which commands and conditionals work and which don't?

Periklis
05-27-2005, 13:37
i think that the RTR V6.0 that will be ready by early summer (at list as the site claims) will have a new system on traynig troops. they will be trinde accordingly to the location - For example Greeks will be able to train troops only in their home lands and not answere else. Visit the rometotalrealism.com site for further info.

Spartiate
05-27-2005, 14:41
Yes RTR has ALREADY a superior training system in place but it is still possible for say the Seleucids to train their elite units in a captured Greek city as both are of the Greek culture.If however you capture a Roman settlement you cannot train ANY units from their barracks buildings.......you must first build your own.Not only that but the Roman barracks will have a negative effect on population loyalty until you destroy it.
In RTR 6.0 the ZoR(zone of recruitment) will become much more important as you will (initially i think)be able to train regionally specific units only.By this i mean that if you conquer Italy you will not be able to train Hastati but you will be able to train Italian Infantry and Samnite units.For your phalanxs' you will have to send back to mother Greece.I'm not sure if they are implementing some sort of colonisation feature however.Let's say that after you build a certain number of Greek buildings or one special building that is very expensive and takes 20 turns or something,then you will be able to train Greek units as the natives will have "gone Greek".I believe they are doing something like this in EB with the Ptolemic Empire.

Apologies to the RTR and EB teams if i have stated any falsehoods in my post. :book:

Epistolary Richard
05-27-2005, 15:14
People interested in the mechanics behind Zone of Recruitment concepts should really check out this thread (https://forums.totalwar.org/vb/showthread.php?t=39925) which tommh posted while working on his Ptolemaic mod - one of the first RTW mods released to have this kind of feature. There's also info contained in this thread for Rome Total ZOR (https://forums.totalwar.org/vb/showthread.php?t=45525) which tried to take the idea to its logical conclusion.

Nowadays, all the major mods incorporate Zone of Recruitment concepts to a greater or lesser extent.

none314
05-28-2005, 20:03
Thanks for the welcome & feedback guys :)


If however you capture a Roman settlement you cannot train ANY units from their barracks buildings.......you must first build your own.Not only that but the Roman barracks will have a negative effect on population loyalty until you destroy it.


This is what I'm looking for... But how is it done? If RTR or anyone else has done it, where can I find their relevant text files? (don't tell me to download the mods to get at the files, the MBs will kill me...)
Then I can use them as samples to modify my vanilla version :)

Regarding ZoR:
ZoR -in the cases I've seen it applied- seems static, based on preconceived notions on who is (or may be) native in any given region (I am referring to the employment of hidden resources as unit training conditions), so it does not allow for population dynamics to truly evolve during a 200 year campaign.

Besides, let's assume that 1) Egypt can't train Pharoah's Guard in Sparta due to ZoR restrictions -reasonable enough- and that 2) the Egyptian AI player is majorly expanding and currently contemplating sending an army there to capture the province.

I don't know how the AI bases such decisions, but I bet it will be really frustrated when it discovers it has gotten a (militarily) useless province, which it can NEVER hope to develop... It should have conquered something more usefull. Worse yet, it won't be frustrated; it won't even know what's happening...

So basically, I imagine that ZoR is a usefull concept only to human players, the AI hasn't been programmed to use it (ZoR is largely a modded feature, not like mercenary pools). I imagine that the only reason poor AI usage of ZoR goes unnoticed is because the AI is always on the defensive/ not expanding enough to be hampered by the restrictions/ etc... Please tell me if you know otherwise.
We can bypass AI decision making handicaps if we remove the " requires factions {...} " from the export_descr_buildings.txt, as in the RomeTotal ZOR I just had a look at (thanks for the links ER), but that effect is definately not what I am looking for.

So back to plan A: Hopefully, the AI is smart enough to destroy structures it doesn't need...(?) Do you know where I could find hard info about what Spartiate suggested (i.e. his quote segment in bold, see above)?

Thanks again guys

Epistolary Richard
05-28-2005, 20:25
I'm no great AI watcher, but from what I've heard they're not too keen on destroying buildings. Sorry.

As to how to do what you ask, as I explain above, you want to have different trees for each different faction's barracks in the export_descr_buildings file.

Currently, the barracks are generic - they can be built by all the factions. If you have, say, a separate Roman barracks, a separate Greek barracks, a separate Barbarian barracks within that file which could only recruit their own troops then when one faction took over the settlement they couldn't use the existing barracks and would have to build their own.

Or alternatively, if you don't want to do that, create a new building called 'Greek culture' etc. which would represent the growing cultural integration of the new settlement and make recruitment of greek troops dependent on having that building in the settlement.

If say, the Greek culture building took 10 turns to build, that would mean that you'd have to occupy a settlement for five years at least before you could recruit any troops there. And you could have different levels of 'Culture' building in the same way as you have different levels of other buildings - with more and more units becoming available as the settlement becomes more Hellenised.

none314
05-29-2005, 04:06
Yeah, this must be the only viable alternative after all...

Well, time to put it to the test. I've had enough with the manual labour, so I'll give 'Hadrian' a try and see if that can settle the messy details. It looks nice enough, I hope it works.
...I just hope the AI will see fit to build the new line of buildings as well...

none314
05-31-2005, 13:27
It works,
both the "cultural assimilation" line of buildings +generic barracks (solution 1, little hassle), as well as the "all-new-barracks" line of buildings (solution 2, many entries needed...)

I have made the following observations.

1) The AI destroys nothing, even if it penalises it heavily (tried "happiness_bonus bonus -10" on a few buildings, major penalty, AI kept the building indefinitely...)

2) The AI can be tempted to build the "cultural assimilation" buildings by assigning happiness bonuses to them, which is, by the way, realistic.

3) The following entries were needed to make the cultural assimilation buildings 'feel' right (this is an example that works):

happiness_bonus bonus 4 requires factions { roman, }
happiness_bonus bonus -4 requires not factions { roman, }

Actually, no penalty is needed, but I thought it rather realistic and a good example of using the "not" operator in a way not found in the original files. Of course, if happiness bonuses from other buildings don't exist, then the penalty won't be effective- I don't know of a way to apply real penalties, just negative bonuses, which is not the same...
Still, as I said in point 1, the AI doesn't destroy the foreign assimilation buildings and just lives with the penalty.

4) So, though it does work for both player and AI, the solution feels artificial because the AI doesn't respond convincingly... Besides, making the cultural building prerequisite for unit training at the barracks results in a ugly looking description like:

Barracks
Allows the training of:
Town WatchRoman Citizenship

where "Roman Citizenship" was the name of the requisite assimilation building. That put me off completely.

5)
Solution 2, on the other hand, works like a charm. It took a lot of new entries but it worked. And the existence of any 'relic barracks' of previous city owners doesn't feel artificial, since they can't train anything and I must build my own anyway. I can accept the notion of 'relick barracks' better than the notion of 'relic citizenship'.

For backward compatibility I'll keep the original barracks/ stables/ practice range series in the file but I'll disable them with something like:

barracks requires not factions { all, }

file description_strat.txt? (I don't recall the name very well as I am typing now, sorry), has to be changed also for the factions to start with the new barracks infrastructure.

I'll post the modified .txt files once I've finalised the changes, in case someone finds them helpful.


My only gripe now is the generic barracks icon I get on the building browser. I'd like to assign proper ones, probably recycling existing ones. I know someone must have solved this- any links?

Epistolary Richard
05-31-2005, 13:55
It's similar to unit cards, if you unpack your pak files you'll find a folder called UI which has all the user interface graphics, inside there is one called something like Construction or Buildings or something similar. Then you just have to duplicate the folder structure beneath you Data folder (for example for unit cards, you have to add a folder called Data\UI\units\gauls\) and put the graphics with the corresponding names in there.

Monkwarrior
05-31-2005, 18:22
Solution 2, on the other hand, works like a charm. It took a lot of new entries but it worked. And the existence of any 'relic barracks' of previous city owners doesn't feel artificial, since they can't train anything and I must build my own anyway. I can accept the notion of 'relick barracks' better than the notion of 'relic citizenship'.

I used those "relic barracks" in Iberia Total War for the training of general auxillia troops from the original culture of the region (based on hidden resources). For example, the romans capture a gaul settlement with barracks and stables, then they can train gallic auxillia and gallic auxillia cavalry. These are weak troops good for garrison and, as their name shows, for auxilliary troops in the invading army. This system tries to simulate the recruitment of local troops by the invasor.

I haven't full tested this system yet, and I don't know the AI behaviour.