(And I also can't wait for the time where circumstantial flavor minors are possible.)
Thank you very much for modding this game and keeping improving it.
I don't think I have used that term before, but I liked it and it's fitting.The search revealed this is the first time you mention those (at least in this thread). What are these about?
Have we discussed including minor religions ? The mechanism in RFCA is quite nice in this regard. Nestorian Christianity, Sikhism, Jainism, Judaisim and Shinto are very relevant as minor religions and even Hellenism in the early game which would disappear in time.
For example.Ooh, does this mean stuff like Kievan Rus, Teutonic Order, Genoan Republic, Kingdom of Naples, Crimean Khanate etc?
Trade Routes are gone. I keep meaning to write a civilopedia article on it, but basically it has been replaced with a much simpler concept.
Instead of trade routes, you have connected cities. This is what is shown where trade routes used to be, in the top left of the city screen. Certain buildings give commerce from having connected cities. Certain civics may increase or decrease the commerce from connected cities. Connectedness is similar to trade routes in that you must have a path (either road or ocean) to have the game consider a city connected. But the differences are that by default, you earn nothing from connected cities, and certain buildings provide a flatbonus. See the port building for an example of this.
I wrote up a lengthy rationale for the change many months ago, but the distilled version is this: Trade Routes were hard to understand, it was impossible to predict the effects, and finally, bad for game performance in the late game. This trifecta, of complexity, unpredictability, and slowness caused us to look into a system to replace Trade Routes. Connected Cities is this system. In contrast, connected cities are easy to understand, as connected cities are listed in your city screen (and paths are pretty obvious to see visually), easy to predict the effects, as long as you are capable of counting, and simple to calculate.
Okay, that makes sense. But aren't you generally connected to every city in the world?
And the connection calculation is what is computationally expensive afaik.
If I remember correctly, the city connections cut down on the number of nested loops. Now that certainly isn't the only way to do that. There was also a lot of discussion on how to take the existing mechanic and improve it.To calculate trade routes for the entire game:
Loop over each player,
- Then Loop over each city "X" a player owns
- - - Then loop over each player,
- - - - - Then loop over each city each player owns,
- - - - - - - Check if the city is connected to city X (above) and save it as a potential trade route
- - - - - - - Loop over the number of trade routes possible for our city and find the best
The deepest most nesting of loops (iterations) is 5, hence N^5. That means with 10 players and 10 cities per player, in 1 turn, the game must calculate 10 ^ 5 (100000) statements just for trade routes.
In a game with 50 players and an average of 25 cities per player on a gigantic map, this becomes 50 * 25 * 50 * 25 * 12 (18750000). That is a lot. Per turn.
To reduce the amount of performance impact trade routes cause, you must reduce the number of nested iterations. Tweaking the logic will not produce any gains. The exponent factor with nested iterations creates huge results even with small numbers.
Originally Posted by Afforess View Post
To calculate trade routes for the entire game:
Loop over each player,
- Then Loop over each city "X" a player owns
- - - Then loop over each player,
- - - - - Then loop over each city each player owns,
- - - - - - - Check if the city is connected to city X (above) and save it as a potential trade route
- - - - - - - Loop over the number of trade routes possible for our city and find the best
The deepest most nesting of loops (iterations) is 5, hence N^5. That means with 10 players and 10 cities per player, in 1 turn, the game must calculate 10 ^ 5 (100000) statements just for trade routes.
In a game with 50 players and an average of 25 cities per player on a gigantic map, this becomes 50 * 25 * 50 * 25 * 12 (18750000). That is a lot. Per turn.
To reduce the amount of performance impact trade routes cause, you must reduce the number of nested iterations. Tweaking the logic will not produce any gains. The exponent factor with nested iterations creates huge results even with small numbers.
... this is really a lot and bad style programming. It is faster to:
Loop over each city (n)
- Loop over all cities beginning at n+1
- get the owner of the city and do what must be done