Sid Meier's Civilization VI

Sid Meier's Civilization VI

Yet (not) Another Maps Pack
Glindor 26 Sep, 2020 @ 4:05pm
Leader Randmization do not consistently follow seed
When trying to recreate a game with the same seed, if YnAMP is active you will not get the same randomization of leaders.

This seems to be caused by the "availableLeaderList" table and the following loop:
for leaderType, bValid in pairs(availableLeaderList) do

Since tables do not preserve ordering that loop will run differently each session.
Sorting the list would make it repeatable, but I can't claim to be lua-savvy enough to know it there is a better way.
< >
Showing 1-3 of 3 comments
Gedemon  [developer] 28 Sep, 2020 @ 7:40am 
thanks for finding that and reporting it.

could you try to effectively sort the table before it's randomized to see if it fixes the issue ?

with that line added

table.sort(filteredRandomLeaderList)

just before

local shuffledList = GetShuffledCopyOfTable(filteredRandomLeaderList)

full code would be

local filteredRandomLeaderList = {} for leaderType, bValid in pairs(availableLeaderList) do bValid = bValid and #CachedQuery("SELECT LeaderType from Players WHERE Domain = ? AND LeaderType = ?", playerDomain, leaderType)>0 if bValid then table.insert(filteredRandomLeaderList, leaderType) end end table.sort(filteredRandomLeaderList) local shuffledList = GetShuffledCopyOfTable(filteredRandomLeaderList) local listIndex = 1

~lines 1685 to 1694 in AdvancedSetup.lua

TIA
Glindor 4 Oct, 2020 @ 2:18pm 
That sort looks like it does the trick. A quick test give a good result and to me it looks like a sensible place to place it.
Gedemon  [developer] 4 Oct, 2020 @ 9:44pm 
thanks !
< >
Showing 1-3 of 3 comments
Per page: 1530 50