Resource Spawner Overhaul

by orzelek

Overhauls resource spawning system.

20 days ago
0.14 - 1.1
135K

b Resource generation bug with specific map seed

3 years ago

Hey Orzelek,

First off thanks for the great mod, I've been using it since release without issues.

Now I'm not 100% sure this is an RSO bug, but it is my only resource spawner overhaul in the pack.

Basically, when using the seed "4294967295" my map only spawns two resources outside of the spawn area. Currently I'm using Angel/Bobs, and the two resources it picks for the map seem to be selected at random.

Upon revealing the map with that seed and my mod combination I get results like this..
https://cdn.discordapp.com/attachments/231518135231053825/724624993174028388/unknown.png

When using the same settings except a different seed I get the expected result as seen here.
https://cdn.discordapp.com/attachments/231518135231053825/724629350346915880/unknown.png

It is maybe noteworthy to mention the seed I had originally input for this was in binary, then got converted to the above seed by the game.

I am fully able to reproduce this bug.

Full Map Exchange String with bugged seed:

eNpjYBBiUGBgZACCBvvVq1bZi/Il5qWn5hTrpmUWF5cWpYLEY
VgIKpWXWFJalJijm55YjJA+4MANlc4vSjXEIW6EQ9wYh7gJDnFTH
OJmyOIsyfmJOTB/QQVyUpA9xJlcVJqSqpufmYOsjys1LzW3Ujcps
RjF98wZ+SXIfJHMvLTMvMySVF2s/sauwIiQAmNCCkwIKTAlpMAMW
QEvXAEstGCYtaQoNbUYWYSB8T8QNLTIMYDw/3oGhf//QRjIegBMQ
CDMwNgAVOkAVFnPAAOsyTmZaWkMDAqOQOwEMoiRkbFaZJ37w6op9
owQNXoOUAYDlHEgCSbiCWNE4pZSgTFMYIwP9ozGYPAZiQGxtARoK
VQVhwOCAZFsAUkywhzDwPhn5cdLvkkJ9owe6/fM+nR9lh1Qkhkkw
QQnZs0EgZ32aD5geGAPlbppz3j2DAi8sYfo4AARB7yZGRgdHnMyM
ArwAbkLeoCEggwDA3qIiKAHDchvaAwOpDBqeGfGwCgHsuEEiGBlg
BsJNADqM4d+B0YHeZisJEIJMCCNEDw7B8YUhA9PwkLyMIxxGYmBK
yLsMPxhhxFryNHABbIwBU68YIa7BhieF9hhPIf5DuB4YACp+gIUg
/BAMjCjILSAAzMDAnywZzCSO2UCAGJWCv8=<<<

3 years ago

It's pretty peculiar.. and kind of by design.
Basically this seed value causes seed for every region to be identical. So all of them get identical set of resources.
It's a side effect of the way that region seed is calculated.. and I'm not sure I want to try and change it.

3 years ago

Very strange indeed. First time I've ever encountered something like this.

I just wanted to report, and will now be a bit more cautious about my map generation going forward.

3 years ago
(updated 3 years ago)

This is caused by some rounding - value you entered is literally maximum possible seed value - 2^32 -1
It's multiplied by others then take modulo itself which always results in itself or 0.. something like that.

3 years ago
(updated 3 years ago)

control.lua: line 114:

local function normalize(n) -- keep numbers at 32 bits
return floor(n) % 0xffffffff
end
...
rng.re_seed(normalize(x * 65536))
local valX = rng(65536)
rng.re_seed(normalize(y * 32768))
local valY = rng(32768)

local seed = normalize( valX * valY * global.surfaces[surfaceIndex].seed )

I'm guessing lua doesn't support int64, so the whole normalize(n) might be overflowing, making the function needless. I didn't try them but from what i'm reading online is people making their own int64 extensions or something for their apps, because all numbers are internally double (float) types.

I mean you might need a different kind of algorithm and i don't know how to.

3 years ago

I know I would need a different algorithm and I don't think it's worth searching for.
It only happens because seed ends up equal to module value. So any multiplications on it won't change the end result.

3 years ago
(updated 3 years ago)

not cant see ore on preview ;p
off mod yeah can see ores
i needs help
ps
i use mods all bobs

3 years ago

Please take a look at description page of mod. Ore's are not visible on preview and there is no way to fix that.

New response