Cubitect / cubiomes-viewer

An efficient graphical Minecraft seed finder and map viewer.
GNU General Public License v3.0
1.02k stars 60 forks source link

[Bug] Incorrect Spawn Location calc (Low continentalness at 0,0) #219

Closed Jereaux closed 1 year ago

Jereaux commented 1 year ago

Cubiomes-viewer 3.2.1 (Built: Feb 18, 2023)

While searching for spawn locations for seeds where there is a lot of low continentalness near 0,0, I'm seeing the calculated spawn location from cubiomes-viewer show up on mushroom islands or on main land, when the actual spawn location might be on a island or in water hundreds of blocks from the calculated location. Prior to this most recent build I had never seen a spawn location in cubiomes-viewer show up on a mushroom island and now it's showing quite often.

Seed: 2597023598558688362 - Cubiomes-viewer shows spawn at -384, 1452. Actual spawn point for player was -421, 1295 Seed: 2597023590718544676 - CV shows -176, -688 spawn. Actual is 68, -864 Seed: 2597023592226198646 - CV shows 192, 688 spawn. Actual is 428, 941 Seed: -4034707975793618908 - CV shows -288, 528 spawn. Actual is -93, 708 Seed: 2597023598544435327 - CV shows 1272, -1088 spawn. Actual is 1064, -872

Nel-S commented 1 year ago

After checking the actual Java code for 1.19: the spawn algorithm, if the initial block it decides upon is waterlogged (i.e. is part of a river/ocean), then spirals outwards for up to 5 chunks in every direction in an attempt to find a non-waterlogged block to use instead. Cubiomes was doing the same, but

I submitted a pull request to fix the first issue, but there's not really any way to fix the second. (I'm personally of the opinion that Cubiomes should not even try to model that aspect and just return the original estimation, both because there's so many factors that the game can take into account that Cubiomes can't, and because under this system the worst-case error is 2(16)(5.75)sqrt(2) ~ 260 blocks instead of 16(5.75)sqrt(2) ~ 130--but until I can find some hard evidence to demonstrate or refute that I think it would be best to just implement the current fix for now.)

Nel-S commented 1 year ago

Update: I ran some tests using 200 seeds with known spawnpoints, and I retract my previous opinion; the spiral code significantly increases the number of correct estimates compared to not having it, even if the error does increase slightly if the estimate turns out to be wrong. (Also, if one really wanted to avoid the spiral iterator they could always just use estimateSpawn() instead.)

Test Nothing Fixed Spiral Fixed Spiral + Allow Frozen Oceans
Correct Spawn (# of seeds) 15 95 100
Total Average Error (blocks) 17.54 11.19 10.64
Incorrect Estimates Average Error (blocks) 18.96 21.31 21.28