Caps Lock

Caps Lock 0.9.5

Finally got a chance to try this. It worked out fairly well. It appeared to be an improvement on the base script. What is the thinking behind the crunch? How well do you think you will need to balance the weightings of the fall back to account for it? If I have suggestions or ideas where would you like me to post - here, steam, git?
 
So, the “crunch” score addresses one of the major problems with the official code: everything is all-or-nothing. If there isn’t a spot that satisfies the buffer rules, the check is just false and every plot is equally bad, with respect to those rules. The algorithm doesn’t care if you’re 9 squares away or just 1. It doesn’t care how many other civs you’re crowded up against. So I resolved that by calculating a score instead of a boolean. The first version calculated the distance to the closest civ within the buffer, but the current version counts every tile of encroachment instead. That penalizes a plot more heavily if more than one civ is too close.

The other major difference in the Caps Lock algorithm is that it counts every violation of the placement rules, instead of prioritizing them from best to worst. That way, if two tiles are tied for civ distance, it still matters whether you are too close to a national wonder, or missing a water supply. Version 0.9.0 gave every check a weight of 1, except for the “crunch” (discussed above), and the water check (which has a weight of 2).

I quickly noticed that version 0.9.0 still had problems with polar snow starts. I dug into the “valid adjacent” check which covers both adjacent terrain and polar locations. After some analysis, I decided that it had three major sub-checks, which should each contribute to the score: distance from poles, blocking tiles (mountains & water), and barren tiles (desert & snow). For 0.9.2, I gave the polar check a distance-based score like the civ buffer, and I scored the other two subchecks 1 point each. I might tune that one further, in particular to detect mountain traps and give them a +10 score like other “impossible” starts.

Along the way, I changed my mind a few times about what to call various scores & whether to count up or down, so the code is a bit chaotic this way. I plan to clean that up before making a 1.0.0 release. I might also try to incorporate YnAMP compatibility if I can do it without creating a separate “patch” mod like is common on Steam Workshop.
 
Something that just occurred to me: It seems like the whole reason behind the fallback system is to keep from running out of regions to put civs. I wonder if everything would work better if you only used the fallback when you run out of regions that satisfy all of the rules? The main drawback of that approach is that you might skip over a fertile region with a minor defect, and instead choose a crappy region that can satisfy all of the validity rules. Perhaps the best approach is to score your best position in every remaining region and choose the best one overall?
 
I found a bug caused by changing the AssignStartingPlots method interfaces from boolean to number. Some map scripts like Got Lakes override the methods, which makes them return a boolean that the scoring system does not expect, and everything crashes. I will try to fix this by adding an extra parameter to select whether the method returns boolean checks or numeric weights, and make the scoring algorithm tolerant of either.
 
I had some trouble uploading version 0.9.4 to Steam. It looks like the new Windows 10 update (version 1709) might break the Steam Workshop Uploader. Luckily, I was able to get the uploader working again by rolling back Windows.
 
Someone needs to tip about this mod to Ed Beach and Firaxis devs, they sure could use your mod and learn how to fix the start positions !
 
I have not had much time to mess with this. The little spare time I had I have played some Civ. However, I did get a chance to mess with something the other day. I tried removing the " + iBonusMajor" and " + iBonusMinor" from the StartPositioner.DivideMapIntoMajorRegions call. This was in the base file rather than in your mod. Regardless, it worked quite well. I got a slightly nicer distribution of civs in the limited runs I did. I put this down to the world being split in to less regions. I assume because there is less chance of a total failure since the fallback was added then less regions is not as big of an issue. However, I did run in to an issue when I ran high sea level, extra mountains and more tundra. Only about half of the city states got placed.

I wonder if it would be possible to attempt placing all civs and city states and then if you run out of regions then rerun with one extra region. This could be iterated up to a sensible value. Without knowing more precisely how StartPositioner functions it is hard to devise how to optimise for it.
 
Someone needs to tip about this mod to Ed Beach and Firaxis devs, they sure could use your mod and learn how to fix the start positions !

Ed is well aware of this bug. In the last livestream (of 2017) he said they're re-writing it to make civs even further apart with CSs in between.

@BWS I'm testing a new map, Scrambled South Pacific, an extreme islands map, which is very impacted by the current start locations. Civs spawn 1-2 tiles away, on the same island :cringe:

Keep an eye out for it cos you may wanna test Caps Lock on it. It'll be done by tomorrow or day after. (I'm cooking Christmas dinner again this year so I'll finish it when I have the time and energy). Merry X'mas! :D
 
So @BWS are you gonna retire Caps Lock after R&F? :)

Care to make a bet on Firaxis fixing start locations? (FYI I won't put my money on it. So just a friendly bet) :D
 
I’m curious to see what they are doing with that system! Based on what we’ve heard in live streams, I suspect that they might have reworked the high-level system that divides the maps into regions. Then the question will be whether they went back to strict rules for plot validity, or whether they are still allowing fuzzy rules. If the latter, then I imagine we’ll still need Caps Lock.

I just pre-ordered my copy of the expansion, so I’ll find out Wednesday night!
 
Based on what we’ve heard in live streams, I suspect that they might have reworked the high-level system that divides the maps into regions. Then the question will be whether they went back to strict rules for plot validity, or whether they are still allowing fuzzy rules. If the latter, then I imagine we’ll still need Caps Lock.

I just pre-ordered my copy of the expansion, so I’ll find out Wednesday night!

I have a bad feeling about this :mischief:

I assume Firaxis will ship the fix with the patch for the base game, but as I am boycotting R&F (due to Cree Poundmaker & getting banned on Steam) can you please tell me if the starts look ok in R&F on two of my maps? Thx ->

https://steamcommunity.com/sharedfiles/filedetails/?id=931053823 (Scrambled North America)
https://steamcommunity.com/sharedfiles/filedetails/?id=920391994 (Scrambled Africa)
 
I just looked at the new version of AssignStartingPlots.lua, and it still has the problematic fallback code. As I suspected, they have changed they way they break up the map into regions, which might ameliorate the previous problems with neighboring starts, but it looks like it might still be possible to end up with polar wasteland starts and similar problems. I will need to do more testing, but I suspect that Caps Lock will still be necessary for a while, and I will work on updating it.
 
Well I haven't seen people complaining about start locations yet so it may have improved a lot just by changing their region division strategy. And I will have Caps Lock updated soon to smooth over any remaining bugs. I just finished updating Map Tacks, which also broke with the update.
 
Top Bottom