ok, i thought this one significant enough to dredge it up out of the archives and re-post it. i know there's at least one stat mod being worked on presently, so maybe this will help.

'OK kids, here's the stuff on the text files as promised:
This is the file that contains all the important information about how the troops behave on the battlefield - Their combat abilities, their movement, their spacings between each other, etc etc etc. Here's a quick rundown of what all the attributes refer to:

NOTE: The order of these stats at the top of the text file ( and in my original posting ) is slightly wrong. "Max Turning Angle" and "Speed at which soldier..." are teh wrong way round. I've editted it in the list below but bear it in mind when you're modding your troopstats.txt file. Cheers to "Eagle-Eye" Kraellin for spotting that one.

Projectile type:
Specifies if this unit is a projectile unit ( archer, gunner, bomber ). The number refers to an entry in projectiles.txt - more on that file elsewhere, and tells the unit which projectile weapon it wields. These are:
1 = Longbow ( normally used by Archer Infantry )
2 = Mounted Longbow ( used by Archer Cavalry )
3 = Arquebus ( for Arqubusiers )
4 = Musket ( for Musketeers )
5 = Ninja Star ( Battlefield Ninja )
6 = Javelin ( Mongol Javlineer
7 = Grenade ( Thunder bombers )
8 = Crossbow ( Ashigaru Crossbowmen )

Doesn't actually make them "unroutable", but actually flags them as samurai in the code which makes the honourable, meaning they get bonuses in their routing check codes. Ashigaru and Mongols are basically peasants and rabble, so they aren't given samurai status
true = 1, false = 0

Marching speed: 1 - 24
Normal marching speed in a straight line( single click move command on the mouse ).

Running speed: 1 - 24
Running speed in a straight line( double click move command on the mouse )

Charging speed: 1 - 24
Not a commandable speed. Units attacking the enemy while running and occasionally when units are told to run downhill automatically shift up to this speed.

Minimum turning speed: 2 - 8
The speed at which a marching unit will slow down to in order to change direction. Individual soldiers will speed up and slow down accordingly in order to maintain rank positions.

Maximum turning speed: 2 - 8
The speed at which a running or charging unit will slow down to in order to change direction.

Speed at which soldier turns towards the direction of motion 8 - 8
Actually, this value appears not to be a speed value but a distance value. It seems to be used to determine how far away an individual soldier needs to be from his destination point before he;ll turn to look at it.

Max turning angle whilst in motion: 8 - 256
The maximum degree a unit can pivot per movement tick. This is a bit complicated. This number isn't exactly degrees, it's an approximation, which was used in order to save memory space. A full circle of 360 degrees is represented at 256, a half circle is 128, 90 degrees is 64 and so on - I'm sure the programmers among you can see why this method was used. A value of 1 represents roughly 1.4 degrees, but don't do trying to enter fractions in here to get exact degrees - only whole numbers will work.

Space between neighbours left and right: 30 - 125
Set's the width distance between soldiers in the ranks. Changing this number will alter the overall width of a formation.

Space between neighbours back and front: 30 - 125
Set's the depth distance between soldiers in the ranks. Think of this and the previous value as te amount of personal space each soldier gets. More personal space = more effective fighting but more prone to routing.

Enemy engagement proximity threshold: 500 - 2000
Distance at which a unit decides to engage the enemy. Also decides when a unit should break into a charge.

Charge bonus: -6 - 12
Attack bonus added on to a unit while it's charging in to attack.

Melee bonus: -6 - 12
Once 2 units have met, close quarter fighting takes over. This sets how good each unit is at hand to hand combat.

Defence bonus: -6 - 12
A unit's inate ability to parry and deflect blows. Excellent for melee combat, no good for projectile attacks.

Armour level: 1 - 12
One of 2 things that help against being killed by arrows and bullets - Armour is one, not being there is the other. Also helps a little in melee combat.

Honour level: -4 - 8
Think of honour as battlefield experience. Affects all attacking, defending and morale. Also helps against projectile attacks - veterans have a better sense of when to sidestep.

Ammo ( arrows or bullets ): 0 - 255
How much ammo a projectile unit is carrying. No point in setting this if the unit only has a sword or polearm.

Unit size (based on 60)
Number of men in this unit, based on a default size of 60. This number will get altered in Single player mode if you decide to shift the default unit size in the Options->GameSettings menu in the Shogun front end.


This file sets up some of the data for the bullets arrows and bombs fired by some of the units:

The length of the projectile - used for the graphics routines when drawing them.

Heh - not actually used anywhere in the code at all. This value just sits in memory. That's all it does.

The range of the projectile. Used to calculate when to turn the mouse cursor green when floating over a unit to indicate when it's in range. Range should be about (speed/2) squared. Make sure it's always less than this value.

Used to calculate the distance a projectile can travel. Be careful about changing this for arrows and bombs, because they travel in an arc. Increasing speed to some asrtonomical number will allow you to shoot the length of the map, but the archers won't be able to hit anything that's quite close to them because they have a fixed ( unmoddable ) trajectory. Bullets and crossbowbolts travel in a flat trajectory, so they don't have this problem.

How likely the projectile is to hit what the soldier was aiming at. The higher value the more lethal. The honour of the unit also affects this.

How much damage the projectile does to the guy it hits.

Length of time between shots for this projectile weapon.

Is a gun? true = 1, false = 0
Tells the projectile if it should fire in a flat trajectory or in an arc ( I think ).

Is Waterproof? true = 1, false = 0
Can this weapon fire in the rain.

Anti-units is used as part of a large function to enable the daimyos to decide which units to build. Basically the file works as a big matrix containing weightings ( or deciding factors ) that aid an AI daimyo to make up his mind what he wants to build.

The anti-units comes in to play when a daimyo observes the units on his from line and tries to find a unit combination to counter them. The numbers represent unit types in this order:

LS = Light Samurai ( AKA Samurai Archers )
SS = Samurai Spearmen ( AKA Yari Samurai )
NA = Naginata
NO = No-Dachi
LC = Light Cavalry ( AKA Cavalry Archers )
HC = Heavy Cavalry
LA = Lancers ( AKA Yari Cavalry )
AS = Ashigaru Spears ( AKA Yari Ashigaru )
AQ = Arquebusiers
MM = Musketeers
MO = Monks
BN = Battlefield Ninja
SW = Sword Saint ( Kensai )
MJ = Javliners ( Korean Skirmishers )
MS = Mongol Spears
MP = Mongol Polearms ( Korean Guardsmen )
GR = Grenadiers ( Thunder Bombers )
AX = Ashi Xbowmen
NC = Naginata Cavalry
MLC = Mongol Light Cav
MHC = Mongol Heavy Cav

for example, taking the first line in anti_units:


5, 2, 5, 4, 6, 12, 10, 5, 0, 0, 0, 3, 3, 1, 2, 5, 0, 2, 10, 15, 10

This line reads that if the enemy have light Samurai ( or Samurai archers to you and me ) then WE want 5% Sam Archers, 2% Yari Sam 5% naginata, etc, etc, etc

building choices.txt
This dictates the weighting that each daimyo personality tends towards. There are some game events that will alter their decisions - for example, when a Geisha arrives on the scene, all active clans will start building ninja houses and turfing out ninjas like no-one's business in an effort to keep Geishas on the move or take them out of the picture all together. The file itself seems self explanatory, so I'll cover the personalities mentioned in the file instead.

The personalities dictate how an AI daimyo acts. What buildings he constructs, what units he trains, whether he'll break alliances or come to allies' aid and how he conducts his invasions. Each daimyo is set up with a hard-coded personality at the start of the game - subsequent heirs are given random personalities to keep the game interesting.

The personalities are:

No real personality at all. Builds a bit of everything, won't invade unless absolutelty sure he'll win. The grey man of Shogun

tends to throw soldiers into battle, trying to win by weight of numbers rather than nurturing skills. Tends to train cheap units and not bother too much with upgrading buildings

Favours shock tactics and the element of speed. Eager to make war - alliances mean virtually nothing. Will take the effort to build up ranks of monks and no-dachi.

virtual opposite of the nutter, h4x0rz will go for heavily armoured and defensible units such as Naginata and spearmen, and then use steam-roller tactics to win over. Assimilation is the key-word here, if you catch my drift.

The toad that sits in it's pond. Will build castles and then sit in them not bother anyone. Values alliances highly, mainly because he wants a quiet life.

The gadget gatherer - making a beeline for the top-most unit types and building upgrades. Tends to construct the fastest out of all the personalites and then output the high class units. Easy to defeat in the early stages of the game, but quite tough if left to his own devices for a few years.

Tends to go for the even approach, much like balanced, except he is far more asssertive. Looks after his allies, but will attack neutrals and enemies with the same aggression. Armies are solid, not favouring any one aspect but making sure all the units available complement each other.

Rather than use strong arm tacts, secret_service prefers the subterfuge approach. Will rely on Shinobi to capture territory and gains treaties for protection. Favours causing uprisings in rival regions to soften them up for an invasion.

The personality that uses ninja and geisha the most. Most assassination attempts stem from this daimyo type, although he builds a formidable army as well - mainly from projectile units. Will look after allies well.

The diplomat relies on emissaries heavily. Will embrace foreign traders at the earlies opportunity, allowing him to introduce guns into his ranks. He will not provoke allies or rivals unless pressed to do so - he wishes for a life almost as quiet as rook's.

Tends to build large standing armies and fortifications but often does nothing with them. Will occasionally lead an assault but more often than not will wait for the enemy to come to him.

Like the yuppy, the technologist will aim for the more advanced buildings and units, but unlike the yuppy he isn't adverse to using them. Will use the units available to him in a balanced fashion, and not adverse to a little diplomacy when the mood takes him.

On par with the diplomat as far as treaties are concerned, the isolationist will favour the more religious units. As the name suggests, he craves peace and will not go into battle unless under the most extreme circumstances. Excellent alliance prospects.

Tends to go for the more opulent buildings whilst keeping his armies large but poorly equipped and badly trained. An opportunist invader - not one you'd consider for a friend.

Favours the common man for the bulk of his armies. Won't spend too much money upgrading troops facilties, he'd prefer to simply throw more peasants at the problem until it goes away. Won't think twice about going against an ally, and definately will attack neutrals and rivals.

The antagoniser. Once he's decided to attack a region he will continue to attack it until the region is his or his ranks are decimated. Tends to favour the loud units and the heavy attacker, but will also resort to ninja to get his way. Not the best prospect for an alliance.

Here are the personalities for the daimyos that are active at the start of the game. Remember, subsequent heirs get given random personalities:

Rebels and ronin = p_standard
Shimazu = p_splendid_isolation
Mori = p_stalin
Oda = p_h4x0rz
Imagawa = p_yakuza
Takeda = p_blitzkrieg
Hojo = p_rook
Ueusugi = p_yuppy
Mongols = p_h4x0rz


These files set the weightings for the different invasion styles open to the AI - major_invasion deals with the AI's planned invasions ( usually taking several turns ) and opp_invasion.txt deals with opportunist invasions.
A major invasion occurs when the AI has decided to invade a neighbouring region and begins to stockpile his troops to do just that. The weighting help him decide when he has enough men and the time is right to invade. The most obviod example of this is the famous "Hojo Wall".

An opportunist invasion occurs when the AI scans his from lines and sees a region that, for whatever reason, is not too well guarded.The AI may decide that turn to attempt to take the region with no real plan or tactic in mind - almost a spur of the moment action, you might say.

Different criteria come into play when dealing with invasions, but mostly it's down to the relationship between the AI daimyo and the daimyo who owns the region - whether they are Allied, Neutrals or At War with each other. Even then, the decisions that the AI makes aren't always that cut and dry. Changing the values in any of the external text files may not produce the effect you were expecting. Even though the these values are taken into account, there are lots of other calculations taking place that also affect the outcome, and these are values you can't get to.

Right, that's all the info from the external files. Hope it's been of some help to you guys. If there's any more info you want, don't hesitate to ask.


Editted to include stuff I'd forgotten first time around.

MagyarKhans Cham:
i even suspect Target is coming here to hype things up.

[This message has been edited by Target (edited 12-07-2001).]

IP: Logged

Legendary Swordsman

Posts: 320
Registered: May 2001
posted 12-07-2001 02:08 AM
Thx Target!

IP: Logged


Posts: 1520
From:Boston, MA
Registered: Dec 2000
posted 12-07-2001 02:12 AM
The modders will likely be pleased.
Disappear into the Darkness!!

IP: Logged


Posts: 1419
Registered: Nov 2000
posted 12-07-2001 05:47 AM
rofl. target, 'does nothing' is prolly the one guess i never made for 'frequency'. lmao.
one question, though, why no explanation for, 'Speed at which soldier turns towards the direction of motion 8 - 8'? turns towards what motion, an approaching enemy, missile fire, a friendly, what? i'm guessing turns towards an approaching enemy, but it's just a guess. and why, if the range of this is 8 - 8 are all the numbers in the file at 256? and why, if the stat above this one has a range of 8 - 256, are all the numbers of the actual stats, 8? are these two fields supposed to be swapped around?

and thanks :) that was a lot of typing.


I'm sorry, but i never apologize.

[This message has been edited by Kraellin (edited 12-07-2001).]

IP: Logged

Legendary Swordsman

Posts: 309
Registered: Oct 2000
posted 12-07-2001 09:31 AM
Ahh many thanks Target
Just a couple of questions...

1. I was actually after what the numbers mean with regards to the building/unit_choice files? A value of 100 as opposed to 250?! It's obviously not a percentage, but what would happen if i change one from 100 to 250 for instance?

Also, there appears to be more numbers than possible buildings...?!? So what's the order of the buildings for the numbers as they go from left to right?

2. Do the %'s in the anti_units text have to add up to near enough 100% or can the row values add up to more and would this make a difference? i.e because this is a % does this therefore mean that the actual amount of units the AI buys cannot be altered?

Once again, many thanks

=MizuDoc Otomo=
=Clan Takiyama=

IP: Logged

Samurai Hero

Posts: 130
Registered: Jul 2001
posted 12-07-2001 10:26 AM
Sorry Doc.
You can slap in any number you want into the buildings/units files. The values are weightings, not percentages, which means that the higher the number the more likely it is to build that unit or troop type. As far as anti_units.txt is concerned, you don't have to make sure the row adds up to 100 - we just did that because its easier to work out the weighting proportions that way. You may have noticed that some rows don't actually add up to 100. That's 'cos we can't count.

as far as teh extra buildings are concerned, this is because there are a few buildings that just didn't make it into the final game, but have a tag in the code somewhere. It was easier to ignore them that to remove them, which is why the list in the buildings file is longer than it should be. Here's a list of the buildings that the numbers in building_choice.txt refer to in order ( I think ):

Archery Dojo
Famous Archery Dojo
Legendary Archery Dojo
Dutch Trading Post
Tranquil Garden

Horse Dojo
Famous Horse Dojo
Legendary Horse Dojo

Mine Complex
Ninja House
Infamous Ninja House
Geisha House

Portugese Trading Post
Gun Factory
Spear Dojo
Famous Spear Dojo
Legendary Spear Dojo

Tea House
Famous Tea House
Legendary Tea House
Famous Temple

Temple Complex
Sword Dojo
Famous Sword Dojo
Legendary Sword Dojo
Battlefield Ninja Dojo

Drill Dojo
Famous armoury
Legendary armoury

Famous swordsmith
Legendary swordsmith
Superior Farmland
Exceptional Farmland

Legendary Farmland
Medical School
Famous Medical School
Medical School

Border Fort
Golden Palace
Legendary Palace

Large Castle


MagyarKhans Cham:
i even suspect Target is coming here to hype things up.

IP: Logged

Legendary Swordsman

Posts: 309
Registered: Oct 2000
posted 12-07-2001 11:41 AM
Great Target thanks for the list
Are the extras that weren't used located at the end of that long list of numbers (i sure hope so...)?

And does increasing the numbers in the building or unit_choice files mean the AI will build up faster or create more units than it does at present?

Cheers mate

Hehehe hopefully that should be my last question...

[This message has been edited by DoCToR (edited 12-07-2001).]

IP: Logged

Samurai Hero

Posts: 130
Registered: Jul 2001
posted 12-07-2001 11:54 AM
The extra buildings ( only 3 of them ) are actually in the middle of the list - the Medical School. Everything else is used. There are 54 buildings, so there should be 54 numbers in each entry. Any extra numbers on the end of the list should be ignored by the code, but don't quote me on that.
Broadly speaking, you're correct. Increasing the numbers will make the AI more inclined to build those units and buildings, so making the numbers big will force him to concentrate his spending on those armies and buildings.

Never a chore to answer questions, matey. Have fun.


MagyarKhans Cham:
i even suspect Target is coming here to hype things up.

IP: Logged

Legendary Swordsman

Posts: 309
Registered: Oct 2000
posted 12-07-2001 12:29 PM
Ooops i just found a question hiding at the back of my desk...norty question..

Does the AI actually use it's entire koku spending power, it always seems to me that it doesn't?! I know it's almost impossible to spend all my koku in the latter stages of the game.

Related to this...if i then increased the building/unit)_choice numbers for each AI personality would the AI be able to cope with the increased spending demands, or would another area suffer as a result?

Almost there, i can feel it now

=MizuDoc Otomo=
=Clan Takiyama=

IP: Logged


Posts: 1520
From:Boston, MA
Registered: Dec 2000
posted 12-07-2001 03:32 PM
Target-sama: What about Kraellin's question?
Disappear into the Darkness!!

IP: Logged


Posts: 1131
From:St. Louis
Registered: Jul 2001
posted 12-07-2001 07:59 PM
LOL! *Now* Target comes out with that nice little list, after I spent 5 or 10 hours a few months ago determining it by trial and error!
Of course the list was also attainable in one of the loc files we later found out, but I had to do it the hard way

Anyway, Target has answered a few good questions here. What I would like clarified is the armor helping in melee thing. I've never noticed a real difference. And it had *better* not help in melee, because if it does then it screws up what otherwise would have been a nice and neat system.

It would be interesting to have more details on the "min turning speed" as well as the question Kraellin asked about the "speed at which soldier turns in direction of motion".


[This message has been edited by Khan7 (edited 12-07-2001).]

IP: Logged

Terazawa Tokugawa
Daimyo (Site Admin)

Posts: 1855
Registered: Oct 2000
posted 12-07-2001 10:18 PM
Wow, thanks Target, we need an official source of what those variables where for...until now we only guessed with common sense and intensive testing.
Honour to Clan Torîi Aku.

Visit my resource centre here!
Evil is within us...

IP: Logged


Posts: 1139
Registered: Aug 2001
posted 12-09-2001 11:21 PM
Why are these turning speeds so important to u guys ???
IP: Logged


Posts: 1520
From:Boston, MA
Registered: Dec 2000
posted 12-12-2001 02:40 AM
Because. We're geeks. The more numbers to play with, the better.
Disappear into the Darkness!!

IP: Logged


Posts: 1131
From:St. Louis
Registered: Jul 2001
posted 12-12-2001 03:11 AM
Because it is fundamental to the game. It's a fundamental factor just like melee bonus or marching speed.
'Nuf said.

Though Baka also has a point


ok, it's a long one, but maybe someone will make use of it.


The only absolute is that there are no absolutes.