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

Emigration

Discussion in 'Civ5 - Mod Components' started by killmeplease, Oct 6, 2010.

  1. Djohaal

    Djohaal Chieftain

    Joined:
    Oct 9, 2010
    Messages:
    12
    A simple and excellent idea. Kudos for using the proper term (emigration) too :)
    I wonder if emigrants could be given a sense of location so they'd emigrate to the happier city closest to them (eg, if the city is just next to the otomans it'll emigrate to them, but if it is across the country near the egyptians it'd emigrate to them instead)
     
  2. TheeLord

    TheeLord Warlord

    Joined:
    Apr 16, 2005
    Messages:
    140
    Location:
    Chicago
    Terrific work, keep it up!!
     
  3. Thalassicus

    Thalassicus Bytes and Nibblers

    Joined:
    Nov 9, 2005
    Messages:
    11,057
    Location:
    Texas
    Here's some further thoughts I had while playing with this... I was pondering ways to smooth out spikes in happiness level or number of emigrants, and weigh several factors that would increase the likelihood of emigration.

    If the emigrants are prioritized to come from recently conquered cities of high population and few/no happiness buildings, I think both realism might be improved and the possibly destabilizing effect wouldn't be entirely up to chance. For example, with complete randomness you can get that rare 2% chance of depopulating a core city for wonder or military production ten turns in a row. By allowing for some decision-making capability (through garrisoning units, building happiness buildings, higher culture in the city, etc), it gives the player more control over the progress of the game.

    It has some precedent, as CiV has transitioned to this deterministic approach in several aspects of the game, like no longer having a 2% chance to lose Great Generals in each battle, or a 2% chance to get that Great Prophet in the modern era when you really needed a Great Engineer.

    While I was thinking about this, some pseudocode came to mind:

    Spoiler :
    PHP:
    for each (player in game.alivePlayers)
        
    happinessQueue[player].pushFront(player.happiness);
        if (
    size(happinessQueue[player]) >= 10 multiplierGameSpeedthen
            happinessQueue
    [player].popBack();
        
    happinessAverage sum(happinessQueue[player]) / size(happinessQueue[player]);

        if (
    player.happiness 0) and (happinessAverage 0)
            
    numEmigrants = (-happinessAverage 10) + 1;
            while (
    numEmigrants)
                
    numEmigrants -= 1;
                
    currentCityIndex random (1player.numCities);
                
    count player.numCities;
                while (
    count)
                    
    count -= 1;
                    
    pickedCity player.cityByIndex(currentCityIndex);
                    
    pickedCityIndex = (currentCityIndex 1mod player.numCities;
                    if (
    pickedCity.population 1) and (
                            
    random(1player.numCities)
                            <=
                            ( 
    pickedCity.population
                            
    / (pickedCity.HappinessInCity 1)
                            * 
    cityConquered(pickedCity)
                            * 
    cityGarrisoned(pickedCity)
                            ) ) 
    then
                        emigrateFromCity
    (pickedCity);
                        break;

    cityConquered (city)
        if 
    city.isRevolting return multiplierRevolting;
        if 
    city.isPuppetState return multiplierPuppetState;
        if 
    city.isOccupied return multiplierOccupied;
        return 
    1;

    cityGarrisoned (city)
        if 
    city.isGarrisoned return multiplierGarrisoned;
        return 
    1;
     
  4. ( Tchey )

    ( Tchey ) Chieftain

    Joined:
    Oct 9, 2010
    Messages:
    5
    Location:
    France, Finistère
    Mod adopted. Thank you !
     
  5. Tamman

    Tamman Chieftain

    Joined:
    Jan 4, 2004
    Messages:
    36
    Just a thought when cities are razed would this work so people would flee the city to other civs?
     
  6. Opera

    Opera Deity

    Joined:
    Sep 21, 2008
    Messages:
    4,643
    Gender:
    Female
    Maybe not all then. I always assumed razing a city was equal to killing every last inhabitant.
     
  7. Dragonlord

    Dragonlord Fantasy Warlord

    Joined:
    Oct 11, 2002
    Messages:
    2,234
    Location:
    Stuttgart, Germany
    Great mod! Using it in my current game and have lost quite a few emigrants to AI civs when I got into unhappiness ... makes keeping my citizens happy a priority, just as it should be!
    IMHO, keep it just as it is, except for the bug where immigrants are said to be arriving from my own civ - but someone else already reported that.
     
  8. blazekid87

    blazekid87 Warlord

    Joined:
    Oct 5, 2010
    Messages:
    179
    Location:
    NYC
    This is nice...good job. I also like the idea of a revolution starting when there is only 1 citizen left. This would give it a nice extra touch.
     
  9. TheDisco

    TheDisco Warlord

    Joined:
    Jun 19, 2008
    Messages:
    163
    Agree in general as well without getting into specifically how it would work. But there are probably a few factors that should drive where and how often the emigrants leave and where the go to. Conquered cities would be rife with emigration, and probably civs that have a lot of policies on the Freedom tree for instance might get more of them (at least in higher proportion than just happiness).

    Mod is a great start though, and I'm sure it will continue to evolve either as part of this mod or as these type of ideas are incorporated into larger modpacks. It is a fundamental gameplay element that is here to stay I think.
     
  10. Lazy Knight

    Lazy Knight Chieftain

    Joined:
    Sep 10, 2010
    Messages:
    78
    Location:
    Europe
    Could you add the name of the city into the mouseover tooltip when Emigration takes place? That would be cool.
     
  11. Common Sensei

    Common Sensei Warlord

    Joined:
    Nov 2, 2005
    Messages:
    262
    Along the same lines as immigration benefits from Wonders and Policies, there could also be Unique Abilities which act as an influence. For example, America could have "Manifest Destiny" replaced with "Melting Pot" considering how immigrants are explicitly mentioned in their Dawn of Man intro.
     
  12. Nitro2985

    Nitro2985 Chieftain

    Joined:
    Oct 6, 2010
    Messages:
    32
    Do citizens emigrate to countries you are at war with? If they do I would strongly suggest that you add a very strong malus for emmigration to such places because realistically, who's going to move to a place that's trying to kill you?

    Also is it possible to keep some sort of tally of where the citizens came from so you can get some sort of indication how cosmopolitian your empire is? You could also use this information to favor the citizens returning to their home country if it becomes happy again over other countries if the one they are living i now becomes unhappy.
     
  13. SlothMD

    SlothMD Chieftain

    Joined:
    Jun 3, 2009
    Messages:
    88
    Sounds like a feature.
     
  14. Nitro2985

    Nitro2985 Chieftain

    Joined:
    Oct 6, 2010
    Messages:
    32
    I think the city should flip ownership if you're in that situation. Cities should never disappear through random chance, it should only happen because a player or AI razes them.
     
  15. killmeplease

    killmeplease Mk Z on Steam

    Joined:
    Nov 22, 2007
    Messages:
    2,794
    Location:
    Samara
    it was reported here that cities can drop to size 0 but then grow to 1 and so forth. should to be tested tough.

    thanks all for feedback, i'll upload v2 this week. your comments help much!
     
  16. Valkrionn

    Valkrionn The Hamster King

    Joined:
    May 23, 2008
    Messages:
    14,450
    Location:
    Crestview FL
    Just wanted to say that I've recommended people use this with my mod (as it is compatible ;)).

    If in v2 you make it modular (using new lua files, rather than overwriting, and therefore need to modify InGame.xml) let me know, I'll add the necessary line to my own mod to ensure they are compatible. ;)

    I've also pointed this mod out in a discussion in the tester forums. ;)
     
  17. MilkmanDan

    MilkmanDan Chieftain

    Joined:
    Dec 24, 2005
    Messages:
    54
    suggestion, how about adding internal migration? a city with poor production per pop point (and thus sort of poorer pay for workers), would tend to have people migrate to the city where they can make more.

    down/upside is city food surplus would no longer be dominant factor in having a large population.
     
  18. CYZ

    CYZ Toileteer

    Joined:
    Sep 29, 2010
    Messages:
    1,376
    Wouldn't really work since happyness is empirewide now.
     
  19. Djohaal

    Djohaal Chieftain

    Joined:
    Oct 9, 2010
    Messages:
    12
    That is exactly what he mentioned, instead of using happyness it'd use labor or some other variable. Internal (e)migration would be interesting too.
     
  20. Thalassicus

    Thalassicus Bytes and Nibblers

    Joined:
    Nov 9, 2005
    Messages:
    11,057
    Location:
    Texas
    I've had a city that drops to -3 population and then regrows, so I can confirm this. Beyond a simple bugfix, this is one reason I think a weighted approach might be valuable, so it's unlikely to hit the same city many times in a row (population will drop and reduce chance of emigration from that city).
     

Share This Page