Last revision: 19 Dec at 23:34 2017 UTC
Are you bored of building beautiful towns, only to have their districts named "Elm Hills", "Lake Square", "Pine Park" or other generic hogwash? Are you too lazy to go through each road, each building, each cim even, to give them more exciting names?
Then this mod is for you!
The data the game uses to generate the various names for districts, streets, cims and so on are stored in the game’s locale files, in which all text that you see in-game is stored together with a certain key. One of these data points is then called a localized string, as in a string of characters localized for a certain language. This is done so that when you want to change the game’s language, the developer’s only have to add another locale file for the new language, instead of modifying the code of the application itself. Pretty intelligent, huh? But unfortunately it also means, if you want to add your own names for the game to use, when creating new streets and districts, you would have to alter the game files, which is a big no-no for various reasons (breaking stuff, having it overwritten the next time the game is updated or game files are verified …).
This is where my mod enters the spotlight: It provides a framework for adding custom namelists, XML files that are loaded together with the your savegame. The contents of these files are then dynamically added to the loaded locale in-memory, without ever touching the physical locale file.
On its own, this mod does nothing. To have your names actually appear in game you have to create a namlist: Simply open up a text editor, write your namelist (be careful to adhere to correct XML syntax) and save it in your local mod directory, found in "C:Users<username>AppDataLocalColossal OrderCities_SkylinesAddonsModsYourLocalModNameHere" under Windows. Replace the "YourLocalModNameHere" part with the name of your local mod.
The actual contents of the namelist look like a normal XML file with the following structure:
<?xml version="1.0" encoding="utf-8"?>
<NameList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Namelist Name">
<LocalizedString identifier="IDENTIFIER" key="key">String</LocalizedString>
Of note are the identifier and key attributes of the LocalizedString tag: They identifiy what text in the locale they should replace. The streetnames, for example, are generated through a pattern that may use person names, which are generated from other locale strings themselves. To add more street name patterns, simply add a localized string to the namelist:
<LocalizedString identifier="STREET_NAME_PATTERN" key="">Fifth Avenue</LocalizedString>
Some streets will now be called "Fifth Avenue" when they are created. Note that not all localized strings need a key; keys serve to further identify a subgroup of an identifier as seen in the following example:
<LocalizedString identifier="BUILDING_NAME" key="Eco Commercial 1×1 02">Ye Olde Eco Shoppe</LocalizedString>
This localized string adds the building name "Ye Olde Eco Shoppe", given to eco commercial buildings.
You may have noticed I only talked about adding names so far. I have done so, since, as per default, the in-memory locale is not overwritten, because the way Cities Skyline’s locale works is that if there already is a localized string with the same identifier and key, any strings you add are given a numerical index and used in conjuction with other’s sharing the same identifier and key. Whenever the game then needs a string, it fetches one of these at random, making it possible to have different road naming patterns, example given.
So if you want only your own street names to appear, you’ll have to create a blacklist. A blacklist simply lists the identifier-key combinations that are removed from the in-memory locale, before strings from custom namelists are added. I have not simply blacklisted all these combinations preemptively, as this would lead to your game displaying no (meaningful) text whatsoever!
Download the Viennese Namelists for a practical example how to make your own namelists! Simply subscribe to it and then search for ".namelist" and ".blacklist" in your Cities Skylines steamapp directory.
See the github repo for source code and example files.