View Full Version : Unit Naming


ruff_hi
Sep 02, 2007, 10:13 PM
Here is the code for unit naming.

## Naming Convention
## - ^civ4^ - no naming convention, uses standard civ4
## - ^rd^ - random name
## - ^rc^ - random civ related name
## - ^ct^ - City
## - ^cv^ - Civilization
## - ^ut^ - unit (eg Archer)
## - ^ct^ - combat type (Melee)
## - ^dm^ - domain (Water)
## - ^ld^ - leader
## - ^cnt[f]^ - count across all units (increments based on unit)
## - ^cntu[f]^ - count across same unit (increments based on unit)
## - ^cntct[f]^ - count across same city (increments based on unit)
## - ^cntuct[f]^ - count across same unit / city (increments based on unit)
## - ^cntc[f]^ - count across same combat type (increments based on combat type)
## - ^cntd[f]^ - count across same domain (increments based on domain)
## - ^tt1[f][x:y]^ - total where the total is a random number between x and y (number)
## - ^tt2[f][x]^ - total count (starts at x, incremented by 1 each time ^tt is reset to 1)
##
## Where [f] can be either 's', 'A', 'a', 'p', 'g', 'n', 'o' or 'r' for ...
## - silent (not shown)
## - alpha (A, B, C, D, ...)
## - alpha (a, b, c, d, ...)
## - phonetic (alpha, bravo, charlie, delta, echo, ...)
## - greek (alpha, beta, gamma, delta, epsilon, ...)
## - number
## - ordinal (1st, 2nd, 3rd, 4th, ...)
## - roman (I, IV, V, X, ...)

I've also written a short document that illustrates some possible unit naming conventions. You can set a default naming convention that is used for all units via the options screen. You can also set a different naming convention for each combat type from the options screen. If you select, 'Advanced', then the combat type naming conventions are ignored (note: the default naming convention is NOT ignored). The Advanced option allows you to set different naming conventions by ERA and by UNIT TYPE. You will need to edit the BUG Mod.ini file directly, these options are not available from the options screen.

ruff_hi
Sep 02, 2007, 10:17 PM
reserved for options screen shot.

alerum68
Sep 02, 2007, 10:47 PM
Sweet! Thanks Ruff. Are you going to release this standalone or keep it in the family only?

ruff_hi
Sep 03, 2007, 05:12 AM
keep it in the family. I was thinking that we should have a thread here that touches on the components of our mod ...

- dom adviser
- logger
- main screen
- city screen
- etc

Cammagno
Sep 03, 2007, 05:32 AM
keep it in the family. I was thinking that we should have a thread here that touches on the components of our mod ...

I agree, at least for the one still under development.

What about the idea to ask the admin to move the old thread inside this folder?

Cammagno
Sep 04, 2007, 02:27 PM
Here is the code for unit naming.


Not tried yet in the game, but I'm reading the readme and it looks great! :goodjob:

The only thing that I have to say is that I fear it may be a bit confusing using [n] for generic attribute when we already have ^n^ for no naming convention and [n] (a real 'n' in this case) for 'number' as an attribute.
I suggest using something else, maybe even a capital N will be better.
I think it doesn't appear in the code, so it's only a doc's problem.

Cammagno
Sep 05, 2007, 06:07 AM
I'm sorry to say that it seems not to work for me.
What I did was to go to option screen and to check the box for using the unit renaming component, i left unchecked the advanced box, and I left all the text boxes as they were (so, the first one with ^u^ ^cnt[r]^ of ^ct^ and all the other one with "DEFAULT").
I built a couple of warriors, but they are still called simply "warrior" (well, the Italian word for "warrior").
I've missed something? :confused:

ruff_hi
Sep 05, 2007, 06:45 AM
hmmn - I will take a look at it.

Re your other comments about 'n' ... I am thinking of changing it so that ...

## - ^civ4^ - no naming convention, uses standard civ4
## - ^r^ - random name
## - ^rc^ - random civ related name
## - ^ct^ - City
## - ^v^ - Civilization
## - ^cnt[f]^ - count across all units (increments based on unit)
## - ^cntu[f]^ - count across same unit (increments based on unit)
## - ^cntct[f]^ - count across same city (increments based on unit)
## - ^cntuct[f]^ - count across same unit / city (increments based on unit)
## - ^cntc[f]^ - count across same combat type (increments based on combat type)
## - ^cntd[f]^ - count across same domain (increments based on domain)
## - ^tt1[f][x:y]^ - total where the total is a random number between x and y (number)
## - ^tt2[f][x]^ - total count (starts at x, incremented by 1 each time ^tt is reset to 1)
## - ^u^ - unit (eg Archer)
## - ^t^ - combat type (Melee)
## - ^d^ - domain (Water)
## - ^l^ - leader
##
## Where [f] is the number format and can be either 's', 'A', 'a', 'p', 'g', 'n', 'o' or 'r' for ...
## - silent (not shown)
## - alpha (A, B, C, D, ...)
## - alpha (a, b, c, d, ...)
## - phonetic (alpha, bravo, charlie, delta, echo, ...)
## - greek (alpha, beta, gamma, delta, epsilon, ...)
## - number
## - ordinal (1st, 2nd, 3rd, 4th, ...)
## - roman (I, IV, V, X, ...)

Cammagno
Sep 05, 2007, 07:34 AM
hmmn - I will take a look at it.

Re your other comments about 'n' ... I am thinking of changing it so that ...

## - ^civ4^ - no naming convention, uses standard civ4
## - ^r^ - random name
## - ^rc^ - random civ related name
## - ^ct^ - City
## - ^v^ - Civilization
## - ^cnt[f]^ - count across all units (increments based on unit)
## - ^cntu[f]^ - count across same unit (increments based on unit)
## - ^cntct[f]^ - count across same city (increments based on unit)
## - ^cntuct[f]^ - count across same unit / city (increments based on unit)
## - ^cntc[f]^ - count across same combat type (increments based on combat type)
## - ^cntd[f]^ - count across same domain (increments based on domain)
## - ^tt1[f][x:y]^ - total where the total is a random number between x and y (number)
## - ^tt2[f][x]^ - total count (starts at x, incremented by 1 each time ^tt is reset to 1)
## - ^u^ - unit (eg Archer)
## - ^t^ - combat type (Melee)
## - ^d^ - domain (Water)
## - ^l^ - leader
##
## Where [f] is the number format and can be either 's', 'A', 'a', 'p', 'g', 'n', 'o' or 'r' for ...
## - silent (not shown)
## - alpha (A, B, C, D, ...)
## - alpha (a, b, c, d, ...)
## - phonetic (alpha, bravo, charlie, delta, echo, ...)
## - greek (alpha, beta, gamma, delta, epsilon, ...)
## - number
## - ordinal (1st, 2nd, 3rd, 4th, ...)
## - roman (I, IV, V, X, ...)

better ^_^
what about ^cv^ for civilization (as ^ct^ is for city) and maybe ^st^ (for 'standard') or ^v^ (stands for 'vanilla') instead of ^civ4^? And, if you want to completly avoid using the same letter in 2 places, maybe ^rn^ instead of ^r^ for random name.

ruff_hi
Sep 08, 2007, 02:29 PM
Unit Naming bug fixes complete. I have also changed the logic behind how it searches for the naming convention / code.


look for ERA_UNIT naming convention in ini file (you have to manually edit these in the ini file, way too many options to put on screen
if not found, or returns DEFAULT, look for COMBAT naming convention
if DEFAULT, look for DEFAULT naming convention


Unfortunately, I cannot get the python code to read the ERA_UNIT value directly from the ini file HELP EF!!!

I'll update my word doc and give some more counting examples tonight.

ruff_hi
Sep 08, 2007, 09:48 PM
Unfortunately, I cannot get the python code to read the ERA_UNIT value directly from the ini file HELP EF!!!

I'll update my word doc and give some more counting examples tonight.
Problem fixed by removing some comments or some such. Doesn't make a lot of sense but it works.

I also updated the zip file in the first post.

Cammagno
Sep 09, 2007, 09:26 AM
Problem fixed by removing some comments or some such. Doesn't make a lot of sense but it works.


Now it works properly ^_^
And it seems to be really great! :goodjob:

Note: some of the "default" values in the ini file are already replaced by some code, is it intentional?

ruff_hi
Sep 09, 2007, 12:20 PM
re the 'defaults' ... yes, I was just playing. I fully expect people to change them.

Cammagno
Sep 17, 2007, 04:11 PM
Ehm, I'm a bit dumb, but I didn't get the true behaviour of tt1 and tt2.

Let's look at your Borg example (I think tou had to put "n" instead "f" in this, but doesn't matter):

^cnt[f]^ of ^tt1[f][6:10]^, Unimatrix ^tt2[f][1]^

Scout 1 of 7, Unimatrix 1
Worker 2 of 7, Unimatrix 1
Galley 3 of 7, Unimatrix 1
Bomber 4 of 7, Unimatrix 1
Axeman 5 of 7, Unimatrix 1
Swordman 6 of 7, Unimatrix 1

So, ^cnt[f]^ counts over all units (regardless of unit type, combat type and domain), from 1 to a random number chosen between 6 and 10, in this case 7.
I get it. But what about tt2?. It starts as 1 and stays equal to 1 until tt1 resets to 1? If it works in this way, the next unit will be something like:

Archer 7 of 7, Unimatrix 1
Bowman 1 of 9, Unimatrix 2

Correct? :confused:

ruff_hi
Sep 17, 2007, 04:57 PM
Correct? :confused:Yes. That is how it is meant to work.

Cammagno
Sep 17, 2007, 05:04 PM
Yes. That is how it is meant to work.

Good ^_^


------------------

Cammagno
Oct 06, 2007, 03:02 AM
hmmn - I will take a look at it.

Re your other comments about 'n' ... I am thinking of changing it so that ...

## - ^civ4^ - no naming convention, uses standard civ4
## - ^r^ - random name
## - ^rc^ - random civ related name
## - ^ct^ - City
## - ^v^ - Civilization

## - ^u^ - unit (eg Archer)
## - ^t^ - combat type (Melee)
## - ^d^ - domain (Water)
## - ^l^ - leader


I've just realized that in your readme you report a different one:

• ^rd^ - random name
• ^rc^ - random civ related name
• ^ct^ - City
• ^cv^ - Civilization
• ^ut^ - unit (eg Archer)
• ^ct^ - combat type (Melee)
• ^dm^ - domain (Water)
• ^ld^ - leader

so... what are the correct ones? :confused:

Cammagno
Oct 06, 2007, 03:11 AM
I've just realized that in your readme you report a different one:

• ^rd^ - random name
• ^rc^ - random civ related name
• ^ct^ - City
• ^cv^ - Civilization
• ^ut^ - unit (eg Archer)
• ^ct^ - combat type (Melee)
• ^dm^ - domain (Water)
• ^ld^ - leader

so... what are the correct ones? :confused:

Oh, answering to myself, i suppose that the correct one is the one included as a comment inside the file itself, so this one:

## - ^civ4^ - no naming convention, uses standard civ4
## - ^rd^ - random name
## - ^rc^ - random civ related name
## - ^ct^ - City
## - ^cv^ - Civilization
## - ^ut^ - unit (eg Archer)
## - ^cb^ - combat type (Melee)
## - ^dm^ - domain (Water)
## - ^ld^ - leader

So, I'll update the readme with that cb :)

Cammagno
Oct 06, 2007, 05:53 AM
Ok, so I started a new game, and I choose to leave all the naming convention set to DEFAULT, and to set the DEFAULT box to :
^ut^ ^cntu(n)^ (^ct^)
So, I expected that my firs Settler will be called something like:
Settler 1 (Rome)
instead I get a random name... where is my error? :confused: :blush:

Psyringe
Oct 06, 2007, 06:23 AM
Ok, so I started a new game, and I choose to leave all the naming convention set to DEFAULT, and to set the DEFAULT box to :
^ut^ ^cntu(n)^ (^ct^)
So, I expected that my firs Settler will be called something like:
Settler 1 (Rome)
instead I get a random name... where is my error? :confused: :blush:

Open the "BUG mod.ini" and find these lines:


# Advanced optional naming conventions based on ERA and UNIT CLASS

ANCIENT_SETTLER = ^rd^


This is a setting that is not accessible via the in-game option, but overrides whatever you specify there. Changing "^rd^" to "DEFAULT" in the ini should do the job.

ruff_hi
Oct 06, 2007, 06:26 AM
thx Psyringe - good catch.

Cammagno
Oct 06, 2007, 07:23 AM
Open the "BUG mod.ini" and find these lines:


# Advanced optional naming conventions based on ERA and UNIT CLASS

ANCIENT_SETTLER = ^rd^


This is a setting that is not accessible via the in-game option, but overrides whatever you specify there. Changing "^rd^" to "DEFAULT" in the ini should do the job.

Thanks :)

Edit:
The strange thing is that I had the advanced naming set to 0, so it had to ignore that convention... something wrong here, I suppose...

@ Ruff

I suggest that we provide a BUG.ini file with all the unit-naming options set to DEFAULT, in particular the advanced ones... we'll avoid a lot of questions.
Then maybe we can add a couple examples to the readme about using the advanced options... what do you think about this?

Edit:
I also suggest to include a "Use Advanced Options" check box in the Option screen.

EmperorFool
Oct 06, 2007, 12:48 PM
^^ +1

All very good suggestions, Cammagno.

ruff_hi
Oct 06, 2007, 12:58 PM
Thanks :)

Edit:
The strange thing is that I had the advanced naming set to 0, so it had to ignore that convention... something wrong here, I suppose...

@ Ruff

I suggest that we provide a BUG.ini file with all the unit-naming options set to DEFAULT, in particular the advanced ones... we'll avoid a lot of questions.
Then maybe we can add a couple examples to the readme about using the advanced options... what do you think about this?

Edit:
I also suggest to include a "Use Advanced Options" check box in the Option screen.

Alerumn suggested moving the advanced naming options to a different ini file ... the coding for that defeated me. I took out the 'use advanced' a while back and changed the code to (in order) ...

check for unit / era
check for combat type
check for global

We can put the advanced option back ... any yeas or nays?

EmperorFool
Oct 06, 2007, 01:08 PM
You currently got a note on the options tab saying that the advanced options are in the INI. I'd change that by putting a checkbox on the tab "Use Advanced Settings (see INI file)", killing two birds with one stone.

If you check that box, it should ignore all the formats on the tab (combat type and global), unless of course the unit being named as "DEFAULT" as its format.

I haven't played with it yet, but does it fallback as I just described? If you have Ancient Archer set to DEFAULT, will it use Combat Type Archer's format, falling back to the Global format if CTA's is DEFAULT? That's what I inferred, but I'm not sure.

In fact, maybe change "Use Advanced Options" to be "Use Advanced Era/Type Formats" so the user knows what they'll get if they enable it without having to open the INI file. Minor suggestion, and maybe there's better wording. Of course, the hover text can be fully descriptive, so maybe ignore this.

ruff_hi
Oct 06, 2007, 01:23 PM
I haven't played with it yet, but does it fallback as I just described? If you have Ancient Archer set to DEFAULT, will it use Combat Type Archer's format, falling back to the Global format if CTA's is DEFAULT? That's what I inferred, but I'm not sure.This is what the code does. I'll put the 'Advanced' option back in with a very long hover text.

Anthrax
Oct 13, 2007, 09:55 PM
now all units are being named default........... literally !! :lol: :crazyeye:

[UnitName]

Enabled = 1
UseAdvanced = 0
Default = DEFAULT
CombatAIR = DEFAULT
CombatARCHER = DEFAULT
CombatARMOR = DEFAULT
CombatGUN = DEFAULT
CombatHELICOPTER = DEFAULT
CombatMELEE = DEFAULT
CombatMOUNTED = DEFAULT
CombatNAVAL = DEFAULT
CombatNone = DEFAULT
CombatRECON = DEFAULT
CombatSIEGE = DEFAULT

I liked the old file a little better ;)

[UnitName]

Enabled = 1
UseAdvanced = 0
Default = ^ut^ ^cnt[r]^ of ^ct^
CombatAIR = Birdie ^cntc[r]^
CombatARCHER = ^rc^
CombatARMOR = DEFAULT
CombatGUN = DEFAULT
CombatHELICOPTER = Whirly Birdie ^cntc[r]^
CombatMELEE = DEFAULT
CombatMOUNTED = Horsie ^cntc[r]^
CombatNAVAL = Floatie ^cntc[r]^
CombatNone = DEFAULT
CombatRECON = ^cntc[p]^ Recon
CombatSIEGE = ^cntc[o]^ Charles (Chuck)

Cammagno
Oct 14, 2007, 01:08 AM
now all units are being named default........... literally !! :lol: :crazyeye:


My mistake, sorry :blush: Already fixed.

ruff_hi
Oct 18, 2007, 07:00 AM
I've done it. It isn't pretty but it works (sorry EP). I've managed to move the advanced unit name codes out of the bug mod.ini file and into an ini file of their own. The advanced unit naming conventions are now in a separate ini file (Adv Unit Naming.ini). To use this file, you must check the 'use advanced' option.

So, the code does this ...


if use advanced, try to get unitnameconv from separate advanced ini file else unitnameconv = default

if not default, return

get combat unitnameconv

if not default, return

get default unitnameconv

return

Cammagno
Oct 18, 2007, 07:14 AM
I've done it. It isn't pretty but it works (sorry EP). I've managed to move the advanced unit name codes out of the bug mod.ini file and into an ini file of their own. The advanced unit naming conventions are now in a separate ini file (Adv Unit Naming.ini). To use this file, you must check the 'use advanced' option.


:goodjob: :goodjob: :goodjob:

# Advanced optional naming conventions based on ERA and UNIT CLASS

see other ini file (Adv Unit Naming.ini)

I'm not a py expert, but before the second line probably a "#" is missing... but I'm not sure of how comments works in py... :confused:

ruff_hi
Oct 18, 2007, 07:44 AM
errr - might be an error. Which file?

Cammagno
Oct 18, 2007, 02:30 PM
errr - might be an error. Which file?

BUG Mod.ini

Thornburgh
Oct 20, 2007, 02:51 PM
I think the idea of unit names is really cool. I like to see how a unit evolves over time. E.g., see centuries later that this was my capitol's first unit, etc.

However, the long names mess up the mouse over display, preventing stats from appearing on the same line as the name, usually with an awkward line break. This has caused me to revert to normal short names. Any ideas on how to fix that?

Thanks!

ruff_hi
Oct 20, 2007, 03:07 PM
I think the idea of unit names is really cool. I like to see how a unit evolves over time. E.g., see centuries later that this was my capitol's first unit, etc.

However, the long names mess up the mouse over display, preventing stats from appearing on the same line as the name, usually with an awkward line break. This has caused me to revert to normal short names. Any ideas on how to fix that?

Thanks!Yes - set up your own naming convention but with short names ... eg "Axe 4"

EmperorFool
Oct 20, 2007, 05:41 PM
If you want to keep long names and have less wrapping, you'd need to modify the C++ DLL to specify a wider hover area. Unfortunately, this isn't done from Python code.

I am getting more and more tempted to add some features to the DLL. I hesitated before because I used BetterAI, but now that it's baked into the game, I might go for it. It would still be unaltered gameplay, but I'd probably package it separately from BUG.

However, I'm short on time so this is still just an idea. I'd like to add other things to the hover text:


City: culter and GP turns, happiness and health
Units: the latest PLE adds some nice things I think. For one, the minimum movement points for a stack of selected units.

I guess I don't really have that many things to add. I'm sure I'm forgetting some.

Sam_Yeager
Oct 21, 2007, 01:47 AM
I am getting more and more tempted to add some features to the DLL.

The big problem with that is that anyone who wants to use a DLL mod for something else e.g. the BTS 3.13 unofficial patch is stuffed.

EDIT: I realise that those who are handy with C++ could merge changes in but a lot of us lack those skills.

pholkhero
Oct 21, 2007, 09:16 AM
as long as the dll changes are separate from the BUG, then it wouldn't be a problem.

also, i was wondering if it was possible to get rid of the "(unit type)" naming that is still displayed once you change a unit's name, eg, my units read: "1st Rome Swordsmans (Swordsman)" ~ is that deletable??

ruff_hi
Oct 21, 2007, 09:27 AM
also, i was wondering if it was possible to get rid of the "(unit type)" naming that is still displayed once you change a unit's name, eg, my units read: "1st Rome Swordsmans (Swordsman)" ~ is that deletable??No. Nothing we can do about that.

EmperorFool
Oct 21, 2007, 10:37 AM
Don't worry. Any changes I made to the DLL would be complete separate and unneeded by BUG. It would truly be an "extra" feature you could install. If I did it, I'd probably install it with BUG as "game.dll.removethisextensiontoinstall" or something. It would be unused by default and not clash with anything.

But this is a loooong way off.

ruff_hi
Sep 26, 2008, 08:24 AM
We've had reports of unit naming occurring even when it is disabled.


Hi,
I noticed that some units (not all) show custom names even if I have
customized unit names neither in the BUG options menu nor in the Adv Unit
Naming.ini file; and overall the unit naming is NOT ENABLED;.
There are 2 conventions showed; examples:

1) "Archer (Archer 1 of Washington)"
2) "Spy (Spy)"

I'm using Varietas Delectat 4.0 mod and not BAT mod.
BtS version is 3.17 (latest)

Thank you for your attention.
I got some saves from this game but ...
http://img442.imageshack.us/img442/4884/unitrename0015ky1.jpg

I guess I should have read the write up. What is 'Varietas Delectat 4.0 mod'?

EmperorFool
Sep 26, 2008, 09:28 AM
VD is a mod that contains ethnic unit and building graphics. BAT is essentially VD + BUG + a few other graphic mods, but this guy is running just BUG with VD it seems.

Keep in mind that the latest version of BUG creates INI files on the fly, and UN is on by default.

ruff_hi
Sep 26, 2008, 10:19 AM
I cannot load these saves after I load up the mod. My PC isn't big enough(?).