A sector is admissible for island placement when land can be grown in every sector within a certain distance. place_island() picks a random start sector, then searches linearly for an admissible sector. If it finds one, it places the island there. Else, it reduces the distance by one and tries again. It fails when none is found even for distance zero. Trying with extra distance is obviously meant to reduce the risk of islands from running into each other without need. Initial distance is @di, the minimum distance between continents, which doesn't really make sense, and is undocumented. Bug: place_island() never tries the start sector. Bias: placement probability is higher for sectors immediately following inadmissible sectors. Because of that, islands are more often placed to the right of existing islands. Players could exploit that to guide their search for land. Rewrite place_island() to pick sectors with equal probability, dropping the undocumented extra distance feature. If it's missed, we can bring it back. The new code visits each sector once. The old code visits only one sector in the best case, but each sector several times in the worst case. fairland performance improves measurably for crowded setups with large @di, else it suffers. For instance, Hvy Fever example given in the commit before previous runs seven times faster for me. With @di reduced to 2, its run time more than doubles. Not that it matters. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
55 lines
2.7 KiB
Text
55 lines
2.7 KiB
Text
Creating a planet with:
|
|
|
|
3 continents
|
|
continent size: 30
|
|
number of islands: 15
|
|
average size of islands: 10
|
|
spike: 0%
|
|
0% of land is mountain (each continent will have 0 mountains)
|
|
minimum distance between continents: 2
|
|
minimum distance from islands to continents: 1
|
|
World dimensions: 64x32
|
|
|
|
#*# ...fairland rips open a rift in the datumplane... #*#
|
|
|
|
seed is 1
|
|
placing capitals...
|
|
growing continents...
|
|
growing islands: 1(7) 2(14) 3(13) 4(3) 5(16) 6(4) 7(17) 8(9) 9(11) 10(12) 11(13) 12(14) 13(17) 14(11) 15(9)
|
|
elevating land...
|
|
writing to sectors file...
|
|
|
|
% % % % . . . . . . . . . . . . . . . . . . . . . . % % . . . .
|
|
% % % % . . . . . . . . . . . . . . . . . . . . . . % % . . . .
|
|
. % % % . . . # # . . . . . . . . . . . . . . . . . . . . . . .
|
|
% % % . . . # # . # . . . . . . . . . . . . . . . % % % . . . .
|
|
. . . . . . # # c c # . . . . . . . . . % % % . . % % % % . % %
|
|
. . . . . # # # # # # . . . . . . . . . % % . . . . % % . . % %
|
|
. . . . . . . # # # # . . . . . % . . . % % % % . . . . . . . .
|
|
. . . . . # # # # # . . . . . % % . . . % % . . . . . . . . . .
|
|
. . % . . # # # . . . . . . . . . . . . . . . . . . . . . . . .
|
|
% % % % . # # . . . . . . . . . . . . . . . . . . . . . . . . %
|
|
. % % % . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
|
% % % . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . % % . . . . . . . . . . . . % . . . . .
|
|
. . . . . . . . . . . . % % % . . . . . . . . . . % % . . . . .
|
|
. . % % . . . . . . . . % % % % % . # # # # . . % % . . . . . .
|
|
. % % . . . . . . . . . % % % % . . # # # # . % % % . . . . . .
|
|
. % % % . . . . . . . . . % % . . . . # # # # . % % % . . . . .
|
|
. % % . . # # # . . . . . . . . . . # a a # # . . . . % % % . .
|
|
. . . . # # # # # . . . . . . . . . # # # # # # . % % % % % % .
|
|
. . . # # # # # . . . . . . . . . # # # # # # . . . . % % % % .
|
|
. . . # b b # # # . % % % . . . . . . # . . . . . . . . . . % .
|
|
. . . # # # # # . % % % % % . . . . . . . . . . . . . . . . . .
|
|
. . . . # # # # . . % % % % % . . . . . . . . . . . . . . . . .
|
|
. . . . # # . . . . . % % % . % . . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . % . % % . . . . . . . . . . . . . . .
|
|
. . . . % % . . . . . . . . % % % . . % % % . . . . . . . . . .
|
|
. . . % % % . . . . . . . % % % . . . . % % . . . . . . . . . .
|
|
. . . % % % . . . . . . % % % % . . . % % . . . . . . . . . . .
|
|
. . . % % % % . . . . . . . . . . . . . . . . . . . . . . . . .
|
|
. . . % % % % . . . . . . . . . . . . . . . . . . % % % . . . .
|
|
. . . % . . . . . . . . . . . . . . . . . . . . . % % % . . . .
|
|
. . . . . . . . . . . . . . . . . . . . . . . . . . % % % . . .
|
|
|
|
A script for adding all the countries can be found in "sandbox/no-spike-newcap_script".
|