1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Map Labels

Discussion in 'Civ5 - Modpacks' started by hazel16, Jul 23, 2014.

  1. hazel16

    hazel16 Chieftain

    Joined:
    May 5, 2014
    Messages:
    64


    Map Labels Mod

    Download Link
    Latest version: v6 beta (Updated 8/29/2014)​

    Description
    This mod provides capability for labels with custom text and icons to be placed directly on the map. There are four types of labels: Feature and Region Labels are automatically generated by the Dynamic Labels Generator (randomly choosing names based on nearest civ's culture).






    Battle Labels are automatically placed at locations of major battles and when cities are razed. Player Labels are custom labels placed by the player. The player can also add, edit, move or delete any label during gameplay.



    Through Options (accessible through the Map Options menu by the minimap), there are many customization options: you can enable/disable types of labels, change the appearance of each type of label and make changes to the algorithms for Battle Labels and the Dynamic Labels Generator.

    See post 2 (For Players) and post 3 (For Modders) for more details.

    Note: This is a beta release. I plan on uploading this to Steam Workshop but first I'd like to get some playtesting feedback to make sure it's working smoothly. If you try it, please let me know how it works for you. Comments/questions/complaints/suggestions/bug reports are all very much appreciated!

    Thanks
    --This would not have been possible without WHoward's excellent UI Tutorials, plot iterators and inspiration in the form of his Map Pins mod.
    --Special thanks also to Pazyryk for TableSaverLoader.
    --Thanks to Leugi for pushpin graphics/icons (used in header and minimap list)
    --Thanks to TPangolin for additional Australian, Canadian, SE Asian and South American names
    --Thanks to RawSasquatch for United States (Western, Southern, Northeastern) names
    --Thanks to Sukritact for more SE Asian names
    --Thanks to Gedemo for French names
    --Thanks to Janboruta for Slavic names
    --Thanks to idvhl for finding real-life forest names
    --And special thanks to everyone who has sent in bug reports and suggestions to help me improve the mod!

    Compatibility
    Spoiler :

    Cultures are automatically assigned to custom civs in following mods:

    Other mods may have their own built-in compatibility with Map Labels. If the custom civilization mod you're using isn't assigned a culture, you can manually assign a culture in-game through Dynamic Labels Generator --> Assign Cultures button.

    Tested and compatible with Enhanced User Interface v1.22

    To maximize compatibility, UI modifications are done without overwriting any game files. Does insert elements into MiniMap and WorldView contexts, so things may look funny if another mod alters these (if a mod alters the MiniMap and Map Labels no longer shows up in the Map Options list, you can still access everything with CONTROL-SHIFT-L). So far only tested with BNW.

    Future Plans
    Spoiler :
    - add more cultural names for Dynamic Labels Generator (Pacific, Indian, Slavic, Hispanic, French) done
    - add tooltips done
    - hide label when unit enters the plot (will add overhead, so make this optional?) (may not do this unless there are requests)
    - add more functionality to labels list done
    - assign cultures to custom civs in-game done
    - optimize code, move more data from lua into database tables done
    - make global lua functions so modders can add labels on the fly done

    Limitations
    Spoiler :
    - map labels appear behind all UI elements, including unit/city flags but are on top of unit graphics
    - would like to rotate map labels, but doesn't appear possible in lua

    Known Bugs
    Spoiler :
    - bottom arrows of scroll bars appear in seemingly random places on the screen; scrollbars are still fully functional
    - rivers and regions sometimes get multiple labels

    Changelog
    Spoiler :
    :c5moves:8/29/2014 v6 beta :)trade: backwards compatible through v4)
    Spoiler :
    -fixed Map Labels malfunctioning if mods make alterations to tables in Map Labels but don't list it as a reference; from now on, if Map Labels is not listed as a reference, another mod's changes to Map Labels-specific tables will not be loaded

    :c5moves:8/28/2014 v5 beta :)trade: backwards compatible with v4)
    Spoiler :
    -Now saves appearance options, DLG and battle options for user across games (note that all save functions only work on turn 2 forward); along with this there is a new Options panel called "Other" with a Restore Default Settings button
    -Bug fixes: fixed popup always opening on closing city screen, added check on icon panel to bypass some icon incompatibility, added check to DLG processing so that having labels in ML_Labels_Dynamic with cultures not in ML_Cultures does not cause script to fail; fixed DLG panel offset to work with resolutions other than __x1050
    -New/updated cultures: lots of new names (more SE Asian names from Sukritact, French from Gedemo, forests from idvhl, US regions from RawSasquatch, Slavic from janboruta)
    -Mod compatibility with Gedemo's civs
    -For modders: added outside LuaEvent funtion calls to add/edit/remove labels (documentation pending); modders can now change colors of individual labels; modders can create their own label MainTypes and SubTypes
    -Other changes: changed main header graphic and Map Labels icon to pushpin (thanks to Leugi for those); added REDO button to DLG results message; optimized code for finding nearest starting plot

    :c5moves:8/10/2014 v4 beta (Not compatible with previous saves)
    Spoiler :
    -transitioned from SaveUtils to TableSaverLoader (v0.16)
    -big changes to how data is stored, cleaned up Options.XML, added certain label-type specific preferences to own tables
    -mode changes: new Quick-Add mode (CTRL-A) that adds Player icon-only label to map, right-click in a mode now exits mode
    -added ability to assign cultures to civs in-game; civilizations can be assigned multiple cultures
    -new cultures: added Slavic, Portuguese and French, as well as (thanks to TPangolin) Mesoamerican, South American, SE Asia, Australia, and Canada
    -labels: battle label tooltips now show range of years and civ's shortdescription
    -mod compatibility: now automatically assigns cultures to TPangolin's, Leugi's and tarcisiocm's civs
    -UI: added tooltips to options and DLG panels
    -bug fixes: dynamic labels generator feature header text, generated labels will no longer be added to plots with natural wonders, cities or existing labels, DLG no longer fails if civ does not have defined culture

    :c5moves:7/28/2014 v3 beta
    Spoiler :
    -fixed save game bug introduced in v2
    -dynamic labels generator changes:
    -------added Pacific, Indian and Spanish culture names to dynamic labels generator
    -------if culture preference is set to 'By Civilization' and civ has no assigned culture/culture undefined, will not create labels for that civ (previously would assign random culture)
    -------now if dynamic labels generator fails, an error message will appear containing info to post here
    -icon panel changes:
    ------recently used icons at top
    ------limit displayed icons to base game and map labels icons (icons added by other mods are not displayed unless file name added to ML_IconFontTextures table)

    :c5moves:7/25/2014 v2 beta
    Spoiler :
    - now allows labels with no name
    - can now Edit/Delete directly from labels list
    - notification and dynamic labels generator appear for new games only
    - couple small optimizations (no longer redraws all labels after making changes to a label)
    - fixed first icon (blank icon), razed city tooltip, Arabian labels not generating

    :c5moves:7/23/2014 v1 First beta release
     
    Martinov likes this.
  2. hazel16

    hazel16 Chieftain

    Joined:
    May 5, 2014
    Messages:
    64
    Map Labels
    For Players

    Add, Edit, Move or Delete Labels
    Map Options menu (by minimap)--> Map Label button (world icon) or CONTROL-SHIFT-L


    Click the Add, Edit, Move or Delete label button on the Map Labels panel, then follow the on-screen instructions.

    CTRL-A will allow you to quickly add a new icon-only player label
    CTRL-SHIFT-A will allow you to add a new labels with full options

    Dynamic Labels Generator
    Map Options menu (by minimap)--> Map Labels Options button (cog icon) --> Dynamic Labels

    When you start a new game, a popup appears allowing you to generate map labels for Features (mountains, forests, lakes, rivers, deserts) and Regions on the map. You can customize the algorithm to generate labels for more or fewer features and be more or less selective.

    (How this works: the mod looks at every plot on the map, finds groupings of X feature and then labels those features with a randomly selected name that is from the defined culture of the nearest major civilization.)

    Tip: For a more culturally consistent experience, use with Gedemon's Culturally Linked Start Locations.


    Change Label Appearance
    Map Options menu (by minimap)--> Map Labels Options button (cog icon)


    You can:
    -- hide labels
    -- choose display (text+icon, text only, icon only)
    -- font size and color
    -- background color and transparency
    -- icon (can choose from base game icons or 88 new icons included in this mod)
     
  3. hazel16

    hazel16 Chieftain

    Joined:
    May 5, 2014
    Messages:
    64
    Map Labels
    For Modders

    NOTE: Code for Static Labels XML has changed with v4 onward. View attachment Map Labels Static Example.zip reflects these changes, as does the LabelsToXML() function. Any XML for static labels created for previous versions of Map Labels will no longer work. I know this is inconvenient, but the changes were necessary. I plan on having full backwards compatibility in future updates.

    There are many features here for modders. If your mod uses worldbuilder maps, you can hand-place your own feature labels (ex. add accurate feature names to a real-world map or create immersion in a fantasy map). If your mod has custom civs and uses randomly generated maps, through XML you can replace the default cultures with your own cultures, assign cultures to your civs, and provide your own lists of place names for the Dynamic Label Generator to choose from.

    You are welcome to use my code in any way you want in your own mod (though be warned I am a novice programmer, so it may be messy!). In general, though, I would recommend keeping this mod as a separate dependency so players can keep it up to date with any new features/bug fixes (this will be easier once it's uploaded to Steam Workshop). Either way, it needs to load before yours, so changes you make to tables can be applied.


    ML_Options Table
    This table currently contains some global parameters and debugging options.

    Assign Static Labels to a Custom Map
    See example mod: View attachment Map Labels Static Example.zip .


    :c5moves:In Game (aka the easy way)
    Make sure debug mode is enabled before starting.

    1. Open your map in game with the Map Labels mod loaded.
    (If you're using debug menu to reveal map so you can place labels, either change Options.XML 'DrawLabelsInFog' to 1 or type into Lua console: g.Options.DrawLabelsInFog=1)

    2. Add all labels to the map and format them through Label Display and Label Appearance in the Options menu.

    3. Open FireTuner and open ML_Main context.

    4. In the input box, type:
    Code:
    LabelsToXML(sTxtKeyPrefix, sLang)
    Both arguments are optional; sTxtKeyPrefix is the prefix you want to add to the TXT_KEY names (e.g. giving the string "ML" will start all TXT_KEY names with "TXT_KEY_ML_"); sLang can be, for example, "en_US" (and defaults to "en_US" if not given)

    5. Open the Lua.log file in \Documents\My Games\Sid Meier's Civilization 5\Logs\ (recommend using a program other than default notepad as it may not handle the length of the file well; Notepad++ works)

    6. Scroll to the bottom of Lua.log and copy everything between the ****'s to a new XML file in your ModBuddy project (during my tests, this does not appear in FireTuner--maybe the string is too long for it)
    Spoiler :
    Code:
    *******************************************
    PRINTING XML CODE FOR STATIC MAP LABELS.
    COPY ALL CODE BETWEEN *'s TO A NEW XML FILE.
    *******************************************
    
    <?xml version="1.0" encoding="utf-8"?>
    <GameData>
    	<ML_Labels_Static>
    		<Row Name="TXT_KEY_ML_SHIA_CRESCENT" PlotX="68" PlotY="20" MainType="REGION" SubType="REGION"/>
    		<Row Name="TXT_KEY_ML_ARABIA" PlotX="66" PlotY="7" MainType="REGION" SubType="REGION"/>
    		<Row Name="TXT_KEY_ML_NEPAL_MANDALA" PlotX="47" PlotY="18" MainType="REGION" SubType="REGION"/>
    		...
    	</ML_Labels_Static>
    
    	<Language_en_US>
    		<Row Tag="TXT_KEY_ML_SHIA_CRESCENT">
    			<Text>Shia Crescent</Text>
    		</Row>
    		<Row Tag="TXT_KEY_ML_ARABIA">
    			<Text>Arabia</Text>
    		</Row>
    		<Row Tag="TXT_KEY_ML_NEPAL_MANDALA">
    			<Text>Nepal Mandala</Text>
    		</Row>
    		...
    	</Language_en_US>
    
    	<ML_Options>
    		<Update>
    			<Where>
    				<Type>MapType</Type>
    			</Where>
    			<Set><Value>STATIC</Value>
    			</Set>
    		</Update>
                ...
    	</ML_Options>
    </GameData>
    
    *******************************************
    XML END
    *******************************************
    
    (Note:won't work with special characters, so you'd have to add them manually in XML)

    7. In ModBuddy, Project Options, Association, make sure Map Labels (ID: e576894a-ed2b-4033-be14-ed1c8ceb81d3) is listed as a Dependency or Reference.

    :c5moves:Manually (aka the hard way)
    Create your own XML file and update the ML_Labels_Static and ML_Options tables manually. You can get a plot's X,Y coordinates by mousing over it in WorldBuilder or Civ V (if debug mode enabled). Make sure you set the ML_Options MapType value to STATIC.

    Customize Dynamic Labels Generator Labels
    Attached Excel 2010 spreadsheet View attachment DLG.zip will automatically generate XML from a list of labels.

    You can delete from and add your own entries to the following tables. If you want your mod to work without error if Map Labels is not loaded, I'd recommend using SQL to add "CREATE TABLE IF NOT EXISTS" for the tables you're updating.
    Code:
    ML_Labels_Dynamic (ID INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT, MainType TEXT default "FEATURE", SubType TEXT, CultureType TEXT)
    MainType --> SubType
    REGION --> REGION, OCEAN, ISLAND
    FEATURE --> MOUNTAIN, FOREST, LAKE, RIVER, DESERT
    PLAYER --> PLAYER
    BATTLE --> BATTLE, RAZED
    CultureType is from ML_Cultures table
    
    ML_CultureGroups (ID INTEGER PRIMARY KEY AUTOINCREMENT, Type TEXT, Description TEXT)
    You can create new culture groups
    
    ML_Cultures (ID INTEGER PRIMARY KEY AUTOINCREMENT, Type TEXT, 'Group' TEXT, Description TEXT, SuggestedCivs TEXT);
    Group is from ML_CultureGroups and is required for Culture to show up in ingame Choose Culture popup
    [INDENT]CULTURE_GROUP_ASIAN
    CULTURE_GROUP_EUROPEAN 
    CULTURE_GROUP_AMERICAN 
    CULTURE_GROUP_PACIFIC 
    CULTURE_GROUP_MIDEASTERN 
    CULTURE_GROUP_AFRICAN[/INDENT]
    SuggestCivs is optional, shows up as tooltip ingame in Choose Culture popup
    
    ML_CivCultures (ID INTEGER PRIMARY KEY AUTOINCREMENT, CivType TEXT, CultureType TEXT, CultureEra TEXT DEFAULT 'ANY')
    CivType is from Civilizations table Type column
    CultureType is from ML_Cultures table
    CultureEra is 'ANY', 'ANCIENT' or 'MODERN'; for most uses should be 'ANY'; Cultures from CultureEra ANCIENT or MODERN will show up as defaults in Choose Culture popup (used for civs that have different place names in different eras, usually as a result of colonialism)
    
     
  4. bladex

    bladex Emperor

    Joined:
    Oct 29, 2010
    Messages:
    1,358
    this is awesome i've always used map pins but it has limited icons and sometimes i want to put something on the map to remind me of something you can't do that in map pins.
     
  5. hazel16

    hazel16 Chieftain

    Joined:
    May 5, 2014
    Messages:
    64
    bladex -- thanks! hope it's useful for you. I also used to use Map Pins all the time (would usually mark sites for my 2nd, 3rd, 4th cities, and then have the AI settle on top of the pin...)

    I actually noticed this suggestion in the Map Pins thread the other day:

    I don't know if WHoward is still adding features to Map Pins, but this is something I could fairly easily add to Map Labels. I'm just thinking as I type, maybe in the front page of the panel where it shows and filters your list of labels there could be options in the drop-down for strategic resources, natural wonders, ruins... anything else? They could have some kind of marker saying whether they're in other civs territory, or whether they're improved or not, or even the distance from your capital or nearest city? Any thoughts?

    Also would it be helpful to add in a list of CS and foreign cities (like Map Pins has)?
     
  6. Zyxpsilon

    Zyxpsilon Running Spider

    Joined:
    Oct 29, 2009
    Messages:
    3,062
    Gender:
    Male
    Location:
    On Earth
    Go right ahead and consider the "Idea(s)" for integration... to me, Pins or Labels perform very similar functions with only some slight differences in features and design.
    Automatic principles should be just what the name implies -- rational gameplay help, Automated. ;)
     
  7. bladex

    bladex Emperor

    Joined:
    Oct 29, 2010
    Messages:
    1,358
    i've lost track of how many times that's happened to me. i'm like hey pal i marked that spot 1st it's mine...and than take their cities anyway. thanks for settling it for me bud! :lol:

    edit - when i click the icon in add new label an error box appears: could not load font xml file. also it wont let you put the label unless you name it. most of the time i don't use names just the icons :p
     
  8. hazel16

    hazel16 Chieftain

    Joined:
    May 5, 2014
    Messages:
    64
    I'm going to look into this. Does the icon dialog box still come up and show custom icons as well as default ones (more than just these)?

    ETA: Think I may have found the problem, but I can't test it because I'm not getting the error; I just uploaded the latest version, let me know if it's still happening.

    Ah, yes. I'll put this capability in the next update.

    Thanks for your feedback!
     
  9. hazel16

    hazel16 Chieftain

    Joined:
    May 5, 2014
    Messages:
    64
    Map Labels v2 is uploaded.

    Changes:
    - now allows labels with no name
    - can now Edit/Delete directly from labels list
    - notification and dynamic labels generator appear for new games only
    - couple small optimizations (no longer redraws all labels after making changes to a label)
    - fixed first icon (blank icon), razed city tooltip, Arabian labels not generating​
     
  10. bladex

    bladex Emperor

    Joined:
    Oct 29, 2010
    Messages:
    1,358
    yes they will show but i have to click ok on that error box 2 times before it does. most of the time having to alt tab out to get it to show up.

    and sorry still appears in v2. I have bnw maybe that's the problem?
     
  11. hazel16

    hazel16 Chieftain

    Joined:
    May 5, 2014
    Messages:
    64
    I'm not sure what's going on, but thank you for trying it again and letting me know! All my testing has been done on BNW. Are you using any other mods--if so, which ones? (It shouldn't be a problem, but Map Labels does try to load all icons added to the game, so it's possible that there could be an error if another mod adds icons with data missing).
     
  12. bladex

    bladex Emperor

    Joined:
    Oct 29, 2010
    Messages:
    1,358
    no i dont use map labels with this i use other mods but i dont think any of them would interfere most are just mods that replace or change stuff and dont use font file?
     
  13. TPangolin

    TPangolin Just the worst person

    Joined:
    May 23, 2013
    Messages:
    4,029
    Location:
    Sydney, Australia
    This is great, hopefully we can include compatibility with all our civs. I can see myself using this one hell of a lot. Already drafted the regions for Canada (used by Canada, Inuit, Vinland, Iroquois, Cree, Anishinaabe, Wabanaki, Cascadia, Dene and Salish) and Australian regions (used by Australia, Koori and Anangu) (I put in 10 of each).

    You should consider an SEA one (that would work well with civs like Vietnam, Malaysia, Philippines, Indonesia, Champa, Guinea etc.).

    I'd also advocate a Mesoamerican one that'd be suited for Mayans, Aztec, Mexico, Buccaneers, Haiti, Cuba, Yucatan.

    South American for Gran Colombia, Bolivia, Argentina, Tupi, Brazil, Aymara, Inca, Peru, Muisica, Chile, Peru and Tiwanaku.

    Happy to help with whatever needs to be done.

    EDIT: Getting this error -

    Spoiler :
     
  14. Auda

    Auda Chieftain

    Joined:
    Oct 5, 2008
    Messages:
    28
    Location:
    Chella, Valencia, Spain
    Brilliant!!!
    But I have a problem: it works perfectly at the begining, it generates the labels and everything works. The problem is that every time I load a save, the labels are gone and the map menu or the hotkey menu doesnt work (the menu sometimes appear, but is empty and the buttons are no responsive, like in the image of TPangolin).
    Thanks for future answer.
    PD: Excuse my english, it isnt my native language.


    EDIT: I've done a test with v1 and it seems to work as intended. The problem seems to be introduced by v2, possibly by "notification and dynamic labels generator appear for new games only".
     
  15. hazel16

    hazel16 Chieftain

    Joined:
    May 5, 2014
    Messages:
    64
    Thanks, I'm looking forward to seeing what you come up with for the Canadian/Australian civs! I just uploaded v3 that has Spanish and Pacific (Japanese, Polynesian) cultural names. As far as South America, the First Americans culture has names from Maya, Aztec, Inca. I'm planning to add capability to choose multiple cultures per civ to a later update, which will allow choosing Spanish+First Americans to create a more post-colonial feel. (Or French+Germanic for a Swiss civ).

    The culture names I still plan to add are Slavic, Portuguese and French.

    That being said, if you or anyone wants to create more specific lists of names for more specific base game civs or regions, I'd be more than happy to include them in the mod. I just added my Excel template (uses macros from Excel 2010) to this post, which automates a lot of the XML creation (I hate repetitive tasks!).

    This looks like the Dynamic Labels Generator failed. I don't think whatever happened here will be fixed with the current update, but I did add an error message to hopefully catch it next time. Let me know if it happens again and what the error message says.
     
  16. hazel16

    hazel16 Chieftain

    Joined:
    May 5, 2014
    Messages:
    64
    Hi Auda, thanks for your feedback! I found the bug (a variable defined a few lines too late) and uploaded a new version tonight. It should be backwards-compatible (so it should work with your prior saves). Let me know if you come across anything else.
     
  17. hazel16

    hazel16 Chieftain

    Joined:
    May 5, 2014
    Messages:
    64
    Map Labels v3 uploaded (link in first post)

    Changes:
    -fixed save game bug introduced in v2
    -dynamic labels generator changes:
    -added Pacific, Indian and Spanish culture names to dynamic labels generator
    -if culture preference is set to 'By Civilization' and civ has no assigned culture/culture undefined, will not create labels for that civ (previously would assign random culture)
    -now if dynamic labels generator fails, an error message will appear containing info to post here​
    -icon panel changes:
    -recently used icons at top
    -limit displayed icons to base game and map labels icons (icons added by other mods are not displayed unless file name added to ML_IconFontTextures table)​

    Also, posted an Excel 2010 file that will generate dynamic labels XML from a list of names. You can download it from post 3.
     
  18. bladex

    bladex Emperor

    Joined:
    Oct 29, 2010
    Messages:
    1,358
    v3 won't even appear now. i click map labels than click the gear nothing happens. i click the earth button thing next to that nothing again. i can't even make labels now.
     
  19. hazel16

    hazel16 Chieftain

    Joined:
    May 5, 2014
    Messages:
    64
    Sorry to hear it's still causing problems for you! Can you attach a copy of your lua.log file? Thanks
     
  20. bladex

    bladex Emperor

    Joined:
    Oct 29, 2010
    Messages:
    1,358
    i won't be able till i start a new game and activate them again
     

Share This Page