do we have a way to get capital city names derived from provinces/regions

Discuss coding questions, pull requests, and implementation details.
User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

do we have a way to get capital city names derived from provinces/regions

Post by Nystul »

Do we have a way to get capital city names derived from provinces/regions?

What I want to do is for every province/region I want to get the name of the capital and then get the map pixel position of the city.
How can I achieve this?

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: do we have a way to get capital city names derived from provinces/regions

Post by Interkarma »

I might be able to help with this. I'll get back to you later when I'm in front of my dev PC.

Which macro needs the map pixel coords?

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: do we have a way to get capital city names derived from provinces/regions

Post by Nystul »

I try to get a way to create ruler names for specific regions/provinces.
So the idea was to pick a random region and use it to somehow generate a name from the namebank belonging to the region (or more specific the capital city of the region):
something like

Code: Select all

DFLocation locationOut;
ContentReader.GetLocation(regionID, locationID, out locationOut)
then use locationOut.Climate with namehelper class to generate name with namebank based on climate

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: do we have a way to get capital city names derived from provinces/regions

Post by Nystul »

what about introducing a dictionary with regions and capitals?

Code: Select all

        Dictionary<string, string> dictionaryRegionCapitals = new Dictionary<string, string>()
        {            
            { "Abibon-Gora", "Abibon-gora" },
            { "Alcaire", "Alcaire" },
            { "Alik'r Desert", "Alik'ra" },
            { "Anticlere", "Anticlere" },
            { "Antiphyllos", "Antiphyllos" },
            { "Ayasofya", "Ayasofya" },
            { "Bergama", "Bergama" },
            { "Betony", "" },
            { "Bhoriane", "Bhoriane" },
            { "Cybiades", "" },
            { "Daenia", "Daenia" },
            { "Daggerfall", "Daggerfall" },
            { "Dak'fron", "" },
            { "Dragontail Mountains", "Dragontail" },
            { "Dwynnen", "Dwynnen City"},
            { "Ephesus", "Ephesus" },
            { "Gavaudon", "Gavaudon"},
            { "Glenpoint", "Glenpoint"},
            { "Glenumbra Moors", "Glenumbra"},
            { "Ilessan Hills", "Ilessan Hills"},
            { "Isle of Balfiera", ""},
            { "Kairou", "Kairou" },
            { "Kambria", "Kambria"},
            { "Koegria", "Koegria"},
            { "Kozanset", "Kozanset" },
            { "Lainlyn", "Lainlyn" },
            { "Menevia", "Menevia"},
            { "Mournoth", "Mournoth" },
            { "Myrkwasa", "Myrkwasa" },
            { "Northmoor", "Northmoor"},
            { "Orsinium Aera", "Orsinium"},
            { "Phrygias", "Phrygias"},
            { "Pothago", "Pothago" },
            { "Santaki", "Santaki" },
            { "Satakalaam", "Satakalaam" },
            { "Sentinel", "Sentinel" },
            { "Shalgora", "Shalgora"},
            { "Tigonus", "Tigonus" },
            { "Totambu", "Totambu" },
            { "Tulune", "Tulune"},
            { "Urvaius", "Urvaius"},
            { "Wayrest", "Wayrest"},
            { "Wrothgarian Mountains", "Wrothgaria"},
            { "Ykalon", "Ykalon"},
        };  
or should we map regional info from uesp into a dictionary of regions, e.g. http://en.uesp.net/wiki/Daggerfall:Daggerfall_(Region)
although most of this info is in FactionData I think

update: I think FactionData should be enough to do it - has ruler and race field this should suffice - will let you know
update2: yeah this works :D

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: do we have a way to get capital city names derived from provinces/regions

Post by Interkarma »

I'd like to avoid any hard-coded game text moving forwards. Any text added to game should be done in a way that translators can easily access. :)

But the good news it's probably not necessary. Capitals appear in the FACTION.TXT file with a type=7. I've always considered this a "region" type record, but I now think it indicates the political capital.

For example, Alik'ra is the capital of region 1 (which is one-based, so subtract one for region index 0 - Alik'r Desert). Note this record is specifically for Alik'ra not Alik'r, and the region is linked from inside the political record. I'm pretty sure this is a capital/political head of the province.

Code: Select all

#508
type: 7
name: Alik'ra
rep: 0
summon: -1
region: 1
power: 5
flags: 128
flags: 4
flat: 180
face: -1
race: 3
flat: 182 18
sgroup: 3
ggroup: 15
minf: 20
maxf: 50
vam: 157
Some regions have a named ruler inside FACTION.TXT, such as King Gothryd of Daggerfall or Baron Shrike of Lainlyn. They appear as a very first subrecord of political capital with type=4 (individual) and sgroup=3 (nobility). If no such record exists, a random ruler can be generated.

I'm not sure of best way to link names to climate data (the method you mention is just a way of getting the climate name bank for local NPCs). If you test this in classic, I'm fairly sure it will just generate a Breton name or use the local climate data the player is currently inside of.

I can't see any way to link a capital to a climate pixel, other than doing a reverse lookup in the maps database (regionName="Alik'r Desert", locationName="Alik'ra"). Daggerfall could be doing this as it never had to contend with translation. But this would break if someone translated FACTION.TXT. It doesn't seem like a stable way to do it. Let me have a think on this.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: do we have a way to get capital city names derived from provinces/regions

Post by Interkarma »

Nystul wrote: Fri May 18, 2018 8:46 pm update: I think FactionData should be enough to do it - has ruler and race field this should suffice - will let you know
And you post this right after I make a lengthy detailed post explaining why using faction data is the right thing to do. :lol:

No worries, I'm glad we're both on the same page then! :)

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: do we have a way to get capital city names derived from provinces/regions

Post by Nystul »

thanks for your explanation - this is super valuable

User avatar
Jay_H
Posts: 4061
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: do we have a way to get capital city names derived from provinces/regions

Post by Jay_H »

If I could interject: along with the name, I also suggest a way to get the monarch title, if it can be found along the way. It's the missing macro %nrn (currently resolves to "tavern" for me.) This is used occasionally in classic.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: do we have a way to get capital city names derived from provinces/regions

Post by Interkarma »

That sounds reasonable Jay. Will leave it up to Nystul depending on where he goes with the first part above.

I'm sure someone will implement before too long. :)

User avatar
Jay_H
Posts: 4061
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: do we have a way to get capital city names derived from provinces/regions

Post by Jay_H »

Actually I think it's already taken care of. I'm testing it now and %rt appears to fulfill that function instead.

EDIT: And %t, it seems.

Post Reply