Afforess
The White Wizard
I measured the time it takes to select an icon in the city interface and add it to the construction queue and it's taking 2 seconds... in the Renaissance. It gets worse as the game progresses.
I've made a few changes, per EmperorFool's suggestions.
However, I'm thinking about caching some of the CanConstruct code that doesn't change in-between turns and just recalculating it turn by turn, instead of several hundred times. Specifically, things I could cache would be the min/max latitude, which never changes, a check for coastal or peak requirements, which never change, prerequisite terrain, which only would change when the city expands culture or loses some borders, prerequisite civics, which only change when a player changes civics, competing buildings, which only change when a new building is constructed, and prerequisite city vicinity resources, which only change when a new resource is discovered. This should eliminate most of the hefty computations... (The compuations are not actually that bad, except that when a function is called ~400 times, it adds up...)
I think I would create 2 new arrays, one for the player, for the player (empire-wide) CanConstruct function and one for each city.
Quick question, how hard is it to add an array with TWO Boolean values for each index? I need to save whether it returns true or false and bTestVisible...
I've made a few changes, per EmperorFool's suggestions.
However, I'm thinking about caching some of the CanConstruct code that doesn't change in-between turns and just recalculating it turn by turn, instead of several hundred times. Specifically, things I could cache would be the min/max latitude, which never changes, a check for coastal or peak requirements, which never change, prerequisite terrain, which only would change when the city expands culture or loses some borders, prerequisite civics, which only change when a player changes civics, competing buildings, which only change when a new building is constructed, and prerequisite city vicinity resources, which only change when a new resource is discovered. This should eliminate most of the hefty computations... (The compuations are not actually that bad, except that when a function is called ~400 times, it adds up...)
I think I would create 2 new arrays, one for the player, for the player (empire-wide) CanConstruct function and one for each city.
Quick question, how hard is it to add an array with TWO Boolean values for each index? I need to save whether it returns true or false and bTestVisible...