Emigration

JimmyJump

Chieftain
Joined
Jul 18, 2013
Messages
91
Location
Port of Antwerp
Hi killmeplease,

I love your mod but I think it has little balance issues... ;)

In my last game when I was testing Emigration among the other mods (standard map, 12 civs) the modded AI civ, Tuscany, managed to achieve SEVENTY CITIZENS in its capital, FORTY SIX in their second city and FORTY in third. To compare, secong biggest capital in the entire map, mine city, had 30 citizens. Basically every few turns new citizen arrived to Florence, whole world could do nothing about it, and Tuscany grow insanely overpowered. I had over 50 happiness and my citizens still emigrated to this runaway, and this is my second gameplay with this mod in which one civ gets legions of immigrants for the entire game ;/

Is it normal?

In an earlier game I forgot to keep an eye on my Capital (Ghent) and second city (Antwerp) and both went over 80 inhabitants (89 for Ghent and 86 for Antwerp with 50 unemployed folk in both cities), before I clicked "avoid growth". Still, people kept migrating to either city once in a wee while...
Playing on the "Legendary Earth" mod, a huge Earth map.

Have tons of mods and this -quite wonderful I must add- Emigration mod works well with all of them, so far.
 

mokyo24

Warlord
Joined
Jan 16, 2014
Messages
109
I'm going to try this but yeah, I guess there should be other limiting factors to emigration. If you close your borders to a Civ, you're obviously sending a message that you want them to stop jumping the fence. There are still some that will manage to get through (just look at the US-Mexico border) but the chances should be reduced. An Immigration Office should also be nice. If it's possible to track nationality of citizens, deportation will also be a clever political tool. Ruin enemy's appiness, then send their citizens back for extra unhappy. :D

BTW does the migrants consider unworked tiles and spec slots when moving? Would they still move if there's a high chance they'd end up unemployed in an already crowded city?
 

Ymir9

Warlord
Joined
Nov 15, 2006
Messages
126
I do feel some sort of extra unhappiness/instability penalty should be associated with immigration. As it is now, immigration is 100% good and the system acts to weaken the weak and strengthen the strong, which is never a good game rule.

Tweaking the distance factor and significantly reducing maximum distances helps to keep most migrations internal, as they should be, rather than international, but I'd love to see some mechanic that would balance the tables a bit by making countries who receive immigrants receive temporary unhappiness for a few turns, or some other mechanic that would saddle immigrants with a cost.
 

roberto tomas

Chieftain
Joined
Mar 3, 2015
Messages
6
Hi, I am looking at using this mod with EUI (which is also has its discussion thread here). My post describes my efforts to get it to work with EUI, and I was wondering if you can help.

Just now, while searching for this thread to come and ask my question, I ran into another thread that was posted to the wrong location, about a conflict between Emigration and Citystates Diplomacy Mod...and now I am thinking that this may be part of my problem. I'm using the "City-states Diplomacy Mod (CSD) for Brave New World -- no DLL (v14)" .. and now I'm going to go turn that off and restart this process :)

Still, it would be nice to get some definitive advise from the maintainers about how to disable the CityView features in Emigration, which is advised in the mods compatibility list on EUI's discusssion's first page.
 

killmeplease

Mk Z on Steam
Joined
Nov 22, 2007
Messages
2,794
Location
Samara
Hi, I am looking at using this mod with EUI (which is also has its discussion thread here). My post describes my efforts to get it to work with EUI, and I was wondering if you can help.

Just now, while searching for this thread to come and ask my question, I ran into another thread that was posted to the wrong location, about a conflict between Emigration and Citystates Diplomacy Mod...and now I am thinking that this may be part of my problem. I'm using the "City-states Diplomacy Mod (CSD) for Brave New World -- no DLL (v14)" .. and now I'm going to go turn that off and restart this process :)

Still, it would be nice to get some definitive advise from the maintainers about how to disable the CityView features in Emigration, which is advised in the mods compatibility list on EUI's discusssion's first page.

hello Roberto
you should remove CityView.lua/xml files from the emigration mod to remove the prosperity bar/tooltip at the city screen

notifications part maybe too, but in this case you wont know when ppl migrate..
emigration.xml defines notification icons
 

roberto tomas

Chieftain
Joined
Mar 3, 2015
Messages
6
hello Roberto
you should remove CityView.lua/xml files from the emigration mod to remove the prosperity bar/tooltip at the city screen

notifications part maybe too, but in this case you wont know when ppl migrate..
emigration.xml defines notification icons

hey, thanks for the response. So I just remove:
  • UI\InGame\CityView\CityView.lua
  • UI\InGame\CityView\CityView.xml
and not UI\InGame\CityView\CityView_small.xml

Previously I was removing that entire UI\InGame\CityView folder (which does not suffice).

How would I handle the notifications part, exactly? I'm really not looking forward to doing that, because I would like to know when people emigrate :) But for now, just to get the mod working would be nice.
 

killmeplease

Mk Z on Steam
Joined
Nov 22, 2007
Messages
2,794
Location
Samara
hey, thanks for the response. So I just remove:
  • UI\InGame\CityView\CityView.lua
  • UI\InGame\CityView\CityView.xml
and not UI\InGame\CityView\CityView_small.xml

Previously I was removing that entire UI\InGame\CityView folder (which does not suffice).

How would I handle the notifications part, exactly? I'm really not looking forward to doing that, because I would like to know when people emigrate :) But for now, just to get the mod working would be nice.

CityView_small is for smaller resolutions.. Dont know why removing the folder didnt help.

notifications part is very tricky. i changed it several times using most popular "3rd party" solutions to help my mod's compatibility. dont know if its compatible with yours in this aspekt. if you want to combine the two mods you should take either notification system if those differ and change either of the mods to use the chosen system.
 

Tim_the_Texan

Chieftain
Joined
Mar 6, 2016
Messages
7
about to make v6


That's awesome. I love your mod. I actually just finished modding your mod to account for the religious make up of a city. It doesn't affect the relative likelihood of immigration or emigration, but it does make it so that if a muslim citizen moves from city A to city B, then city A will loose one muslim follower and city A will gain one. You're then notified that a you got a muslim immigrant from city A.

It's pretty simple code and I just edited the emigration.lua file directly. Although it was my first time modding anything so the code is pretty ugly. If you want, you can give it a look at http://forums.civfanatics.com/showthread.php?p=14189080#post14189080. Feel free to steel the idea or the code for your new version.

Also, I noticed in the code that there is nothing to make the AI want to produce more or less pp (or declare war/peace) if they want their cities to grow or shrink. It's just that without this, the more control a human player has over the amount of immigration/emigration, the more of an unfair advantage we have over the AI. (Although we all know the AI cheats anyways so maybe it's ok to allow the humans to cheat this time.) Just a thought.

Anyways, keep up the good work and keep us posted!
 

killmeplease

Mk Z on Steam
Joined
Nov 22, 2007
Messages
2,794
Location
Samara
Great news, will it be compatible with the community patch?

i'll see if it can be done

That's awesome. I love your mod. I actually just finished modding your mod to account for the religious make up of a city. It doesn't affect the relative likelihood of immigration or emigration, but it does make it so that if a muslim citizen moves from city A to city B, then city A will loose one muslim follower and city A will gain one. You're then notified that a you got a muslim immigrant from city A.

It's pretty simple code and I just edited the emigration.lua file directly. Although it was my first time modding anything so the code is pretty ugly. If you want, you can give it a look at http://forums.civfanatics.com/showthread.php?p=14189080#post14189080. Feel free to steel the idea or the code for your new version.

Also, I noticed in the code that there is nothing to make the AI want to produce more or less pp (or declare war/peace) if they want their cities to grow or shrink. It's just that without this, the more control a human player has over the amount of immigration/emigration, the more of an unfair advantage we have over the AI. (Although we all know the AI cheats anyways so maybe it's ok to allow the humans to cheat this time.) Just a thought.

Anyways, keep up the good work and keep us posted!

whoa, this is great! :eek: this will make it alot easier for me.
great job, i will add you to authors. can you give me a link to your steam profile?

i wonder if your follower moving algorithm works properly with pantheon?
i have found pantheon does not behave like a normal religion or atheism, i.e. it shrinks when a major religion spreads to a city..

p.s. i dont really know how to program AI and suspect its not even possible with only Lua so dll coding is required what would make the mod incompatible with other dll mods and honestly i dont want to invest that much effort into a mod :blush:.
 

killmeplease

Mk Z on Steam
Joined
Nov 22, 2007
Messages
2,794
Location
Samara
Tim_the_Texan, it seems your formula for the source city conversion is not quite right. It works for 2 religions but for more it is not very prescise.
e.g. there are 3 religions, and followers distribution is 3 islam, 4 protestantism, 1 atheism.
1 muslim leaves, by your formula protestantism gets 100/(3*3)=11%, atheism gets 100/(4*3)=8%
if pressure points were like 300, 400, 100
the new distribution should be 228, 456, 114 (19% to protestantism and then 6% to atheism)
while your formula produces 246, 433, 121, what is pretty close and may actually end in right follower numbers... but in some other cases i fear it may break...
 

Tim_the_Texan

Chieftain
Joined
Mar 6, 2016
Messages
7
First off, my steam profile is here http://steamcommunity.com/profiles/76561198279871742/

Your right about the math error. Ok, try this. It should fix the problem and I think I wrote it using the same variable names.

As for the pantheon immigrants, they seem to immigrate just fine. I tested it last night and I saw pantheon immigrants to a city that no longer had any pantheon followers.

Also I noticed some things with the notification text that I want to fix. Little things like adding the religion icon for the emigration notification too (I think the knowledge that your loosing citizens is helping spread your religion is a small comfort). Also, in my code, on line 249 I have
religiousIconList[-1] = " ";
If I get rid of the space and just make it "" will that cause any problems? Because the formatting looks kinda weird on the notification popup.
 

Attachments

  • problem fixed.txt
    538 bytes · Views: 129

killmeplease

Mk Z on Steam
Joined
Nov 22, 2007
Messages
2,794
Location
Samara
so here is a revised religious migration algorithm which considers the pantheon problems

immigration (destination city)

p = sity size after migration

AddFollower(iReligion, pCity) - a function which converts 100/p percent of each religion presented in pCity to iReligion

1. if immigrant is an atheist, AddFollower(-1)
2. if immigrant is a pagan, see if toPlayer:HasCreatedPantheon()
2.a. if it has, AddFollower(0)
2.b. if not, AddFollower(-1)
3. if immigrant is a follower of a major religion (iReligion > 0), see if there are pantheon followers in the city
3.a. there are no pantheon followers: AddFollower(iReligion)
3.b. there are some:
3.b.1. get number of atheists = af, number of pantheon followers = pf
3.b.2. convert 100*(1+1/pf)% of pantheon to atheism
3.b.3. convert 100/(af+pf+1)% of atheism to iReligion
3.b.4. convert 100*pf/(af+pf)% of atheism to pantheon


emigration (source city)

1. get number of atheists = af, number of pantheon followers = pf
2. convert 100% of pantheon to atheism
3. if iReligion = 0, set iReligion = -1
4. get number of iReligion followers in the city = f, city size = p
5. determine conversion percent x=(f-p)/(1-p)/f
6. get num followers for each religion other than iReligion wgt = { w1, w2, ... wn }
7. divide each value in wgt by (p-fx), where fx is a number of iReligion followers
8. set corr = 1
9. loop city religions other than iReligion { rel1, rel2, ... reln }
9.1. for each rel convert x*w*corr from iReligion into rel
9.2. set corr = corr*(1+w)
10. recover an old value of iReligion (before step 3) and convert some atheists to pantheon:
10.a. if iReligion is atheism, convert 100*pf/(pf+af-1)% of atheism to pantheon
10.b. if iReligion is pantheon, convert 100*(pf-1)/(pf-1+af) of atheism to pantheon
10.c. if iReligion is a major religion (>0), convert 100*pf/(pf+af) of atheism to pantheon
 

killmeplease

Mk Z on Steam
Joined
Nov 22, 2007
Messages
2,794
Location
Samara
Emigration 6 is ready!
available in the steam workshop

What's new in v6:
* migrants carry religion
* part of conquered population escape as refugees
* emigration system reworked: progress bars instead of probabilities

also i have improved compatibility by not using save utils (all the mod's information is now stored in dummy buildings) and custom notifications (switched to standard notifications).

cityview issue havent gone though..
i hope they'll make modular UI in civ6 :)

thanks Tim_The_Texan and Tomahawk.nsk for their input
 

Putmalk

Deity
Joined
Sep 26, 2010
Messages
2,639
Location
New York
cityview issue havent gone though..
i hope they'll make modular UI in civ6 :)

What issue are you experiencing? What part of the UI is not moddable?
 

Cvv

Chieftain
Joined
Mar 9, 2013
Messages
57
Location
Rus
Gamebreaking bug in Refugees.lua,
city:SetPopulation(city:GetPopulation() + refs);
must be
city:SetPopulation(city:GetPopulation() + refs, true);
On city captures some ghost citizens appear which take food and do noting.

Figuring out now lua to fix it without loosing game
 
Top Bottom