Resource Spawner Overhaul

by orzelek

Overhauls resource spawning system.

13 days ago
0.14 - 1.1

b Resource generation bug with specific map seed

2 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..

When using the same settings except a different seed I get the expected result as seen here.

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:


2 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.

2 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.

2 years ago
(updated 2 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.

2 years ago
(updated 2 years ago)

control.lua: line 114:

local function normalize(n) -- keep numbers at 32 bits
return floor(n) % 0xffffffff
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.

2 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.

1 year, 8 months ago
(updated 1 year, 8 months ago)

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

1 year, 8 months 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