Author Topic: [DONE][Suggestion] Soldier names limited to region/country  (Read 2297 times)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8644
    • View Profile
[DONE][Suggestion] Soldier names limited to region/country
« on: October 27, 2022, 10:01:26 pm »
requested by Kato/Solarius

something in the spirit of: "when hiring soldiers in a Japanese base, they should mostly have Japanese names"
« Last Edit: October 30, 2022, 11:40:23 am by Meridian »

Offline Ostrich-Hungry

  • Sergeant
  • **
  • Posts: 21
    • View Profile
Re: [Suggestion] Soldier names limited to region/country
« Reply #1 on: October 28, 2022, 11:22:33 pm »
It is a great idea that will help immersion! Maybe it would be more reasonable to have region-specific soldiers (instead of only Japanese, Chinese and Korean too)
It should have a variable modifier so as not to make it feel "forced". And if we go to the extreme, we could even have random fluff weight about closed countries (North Korea, Iran, Afghanistan) or even military alliances (NATO).

Offline Kato

  • Captain
  • ***
  • Posts: 51
  • ASHU is coming
    • View Profile
Re: [Suggestion] Soldier names limited to region/country
« Reply #2 on: October 29, 2022, 03:37:22 am »
Maybe it would be more reasonable to have region-specific soldiers (instead of only Japanese, Chinese and Korean too)

This can work that way:

Code: [Select]
  - type: STR_SOLDIER
    hiringPools:
      - STR_JAPAN: 0
      - <the rest of countries>
When you have a base in Japan, your recruits will be of Japan nationality (0 in this example).



Code: [Select]
  - type: STR_SOLDIER
    hiringPools:
      - STR_JAPAN: [0, 2, 3]
      - <the rest of countries>
When you have a base in Japan, your recruits will be of Japan, Chinese and Korean nationality (0 in this example).

So everyone can set hiringPools for his needs - will there be a single nation per country with x-base presence? Or maybe list of nations? Or maybe even all nations (-1)?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8644
    • View Profile
Re: [Suggestion] Soldier names limited to region/country
« Reply #3 on: October 29, 2022, 03:49:28 am »
Nationalities don't have guaranteed numbers/IDs, so I can't use that approach.
Even with identical openxcom version and identical mods, the number depends on the OS and the local settings/sorting... for example in the UK: China < Hungary ('C' < 'H'), but in Slovakia: China > Hungary ('Ch' > 'H').

My plan is to add support for one country to each *.nam file and one region to each *.nam file.

E.g. American.nam

Code: [Select]
country: STR_USA
region: STR_NORTH_AMERICA
maleFirst:
  - David
  - Samuel
  - Morgan
  - Bruce
femaleFirst:
  - Jessica
  - Sigourney
  - Halle
  - Whoopi
maleLast:
  - Copperfield
  - Jackson
  - Freeman
  - Willis
« Last Edit: October 29, 2022, 04:03:22 am by Meridian »

Offline Kato

  • Captain
  • ***
  • Posts: 51
  • ASHU is coming
    • View Profile
Re: [Suggestion] Soldier names limited to region/country
« Reply #4 on: October 29, 2022, 04:52:26 am »
Oh, that looks cool.
Can it work with neutral territories too? (there are 8 free cities in Piratez, these people must come when you have a base outside of any state borders)

And of course David Freeman must have American national flag on SOLDIERS screen. How to tie this and that?

We already have "name defined by nationality" mechanic - optimal for manufactured/event-spawned soldiers.
Can it work vice versa (nationality defined by name) in case of hiring via PURCHASE/RECRUIT ?
« Last Edit: October 29, 2022, 06:57:36 am by Kato »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8644
    • View Profile
Re: [Suggestion] Soldier names limited to region/country
« Reply #5 on: October 29, 2022, 12:57:53 pm »
If your base is outside of a country, it is still inside of a region and the regional name pool will apply.

On the SOLDIERS screen, every soldier entry occupies 8 pixels. Creating 8 pixel high flags is impossible.

No, nationality by name is not a thing. David Freeman can easily be English, Australian, Canadian, etc.

Offline Kato

  • Captain
  • ***
  • Posts: 51
  • ASHU is coming
    • View Profile
Re: [Suggestion] Soldier names limited to region/country
« Reply #6 on: October 29, 2022, 01:43:53 pm »
On the SOLDIERS screen, every soldier entry occupies 8 pixels. Creating 8 pixel high flags is impossible.
Meant 30x20 flags in their "personal file" >_<

No, nationality by name is not a thing.
Much clear example: we have bases in USA, Japan and Germany. Nam files are binded to countries by modder. When hiring a soldier, they got American, Japanese or German name by random. Then they arrive to the base, we open the personal file and see that flag is Kazakhstan - wrong random nationality, a bug. Is there any way to fix it?

Maybe something like this:
Code: [Select]
country: STR_USA
region: STR_NORTH_AMERICA
nationality: 2             #default -1=any. USA is 2 in XCF - and user's locale doesn't matter now because we can bind nationality number to nam file this way
maleFirst:
  - David
  - Samuel
  - Morgan
  - Bruce
femaleFirst:
  - Jessica
  - Sigourney
  - Halle
  - Whoopi
maleLast:
  - Copperfield
  - Jackson
  - Freeman
  - Willis
it means: when x-base in country USA or region North America, this file can be used for recruited soldiers. And nationality wof the soldier will be set as 2.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8644
    • View Profile
Re: [Suggestion] Soldier names limited to region/country
« Reply #7 on: October 29, 2022, 02:01:34 pm »
Meant 30x20 flags in their "personal file" >_<

This already works, there are flag mods out there.

Much clear example: we have bases in USA, Japan and Germany. Nam files are binded to countries by modder. When hiring a soldier, they got American, Japanese or German name by random. Then they arrive to the base, we open the personal file and see that flag is Kazakhstan - wrong random nationality, a bug. Is there any way to fix it?

I did not implement the functionality in this thread yet, there is nothing to fix.

If you're talking about the existing features, I am also not aware of any bugs.
If you found a bug, report it in a new thread with detailed instructions how to reproduce it and what's wrong.

Maybe something like this:
Code: [Select]
country: STR_USA
region: STR_NORTH_AMERICA
nationality: 2             #default -1=any. USA is 2 in XCF - and user's locale doesn't matter now because we can bind nationality number to nam file this way
maleFirst:
  - David
  - Samuel
  - Morgan
  - Bruce
femaleFirst:
  - Jessica
  - Sigourney
  - Halle
  - Whoopi
maleLast:
  - Copperfield
  - Jackson
  - Freeman
  - Willis
it means: when x-base in country USA or region North America, this file can be used for recruited soldiers. And nationality wof the soldier will be set as 2.

I already told you above that nationality numbers are NOT stable and cannot be used in this way.

USA may be 2 in XCF on your computer, but the same USA in the same XCF may be some other number (e.g. 7) on my computer!!

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8644
    • View Profile
Re: [Suggestion] Soldier names limited to region/country
« Reply #8 on: October 29, 2022, 02:10:36 pm »
If you want to guarantee nationality numbers in your mod, you can rename the *.nam files so that their order doesn't depend on the PC locale settings.

For example instead of:

Code: [Select]
American.nam
Arabic.nam
Argentina.nam
Belgium.nam
British.nam
...

use this:

Code: [Select]
00_American.nam
01_Arabic.nam
02_Argentina.nam
03_Belgium.nam
04_British.nam
...

Offline Kato

  • Captain
  • ***
  • Posts: 51
  • ASHU is coming
    • View Profile
Re: [Suggestion] Soldier names limited to region/country
« Reply #9 on: October 29, 2022, 02:18:18 pm »
It's called a 'thought experiment', duh.

Ok, deep breath and one more time. Base in France - we recruit a soldier - they have French name and French flag (or X name and X flag if we have another base in X). That is how it must work.
If it is not possible to implement and never will be possible - forget it then. Because Victor Gusev with Japan flag WILL be a {bug} (insert any word in {} as a synonim of some unpleasant fluff).

Also, noticed the post with renamings while was typing this one. Yes, good idea, already did it.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8644
    • View Profile
Re: [Suggestion] Soldier names limited to region/country
« Reply #10 on: October 29, 2022, 02:25:46 pm »
Ok, deep breath and one more time. Base in France - we recruit a soldier - they have French name and French flag (or X name and X flag if we have another base in X). That is how it must work.

Yes, this is how it already works today!

X name always has X flag.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 8644
    • View Profile
Re: [DONE][Suggestion] Soldier names limited to region/country
« Reply #11 on: October 30, 2022, 11:40:49 am »
Done.

Documentation here: https://openxcom.org/forum/index.php/topic,10845.0.html

Sample mod attached.

Offline Kato

  • Captain
  • ***
  • Posts: 51
  • ASHU is coming
    • View Profile
Re: [DONE][Suggestion] Soldier names limited to region/country
« Reply #12 on: October 30, 2022, 01:00:04 pm »
Thank you, Meridian >^_^<