Resource Spawner Overhaul

by orzelek

Makes resources more sparse than base game. You will need to use trains much earlier to get resources. Game will be more difficult especially with higher enemy settings.

Tweaks
a day ago
0.14 - 2.0
143K
Environment

i Crowded spawn generation

5 years ago

Yesterday I was toying with the resource generation for Pyanodons Ores and noticed that once I increased the resource size above 150%, spawn would get overcrowded with resources which was kinda expected since there are so many and they were big.

So, next I increased my starting area and for my surprise, nothing changed.
I took a look at the spawning code and noticed that it his generating ores in a fixed radius (200) and ignoring the size of the starting area.

It would be nice if the starting area size was taking into account to make this spawn resources more apart from themselves. Another variables to take into consideration could be the number of resources at spawn, if there are more then normal, spawn them on a bigger radius so they can be more spread around or even give them some priorities so, main resources like iron/copper/coal are always closer to the spawn centre and the less priority resources gravitate around the mains ones on a bigger radius.

5 years ago

Changing the radius based on starting area size is a good idea. Priority might be a bit more problematic since it would need additional information on resources to decide which ones are more important.
Current game size setting goes up to 600% and it might be to much for RSO in general. Multiplier in config is max 3 so I might need to reduce the impact of map setting.

5 years ago

Please check it out in new version that I just posted and let me know if it's better.

5 years ago

Honestly, I see no difference!

I even had to compare the files to confirm you didnt uploaded by mistake a version without the changes... :p

The thing is, all resources seems to be spawned way before the max radius is hit. And since the starting area size is only affecting the max_radius, it has no impact on resource location.

My suggestions to improve it:

  • first, that maxRadius is constant in the loop, so calculate it only once outside the loop
  • second, the position calculation needs to take into account the max-radius. So, distance would actually be a number from 0 to 1 based on some rng like now.Then, when calculating the position, you multiply this distance by max-radius. This way, when you increase the starting area, the distance from the centre increases.
  • third, the initial maxRadius should depend on the region side, so... if I also increase the region size (like I do to 12), my initial ores will also be more spread around inside the now even bigger starting area!
5 years ago

The thing is... I don't want all the resources spawned to far. There is enough of running around as is at start of the game and it's good to have them pretty close. Thats why it spawns in steps - to try and fit them as close as possible.
Adding region size to calculations won't help without changing the algorithm. And I'm a bit on the fence should I add one more option to make starting resources more spread out.

5 years ago

How about... taking into account the number of resources you need to spawn at the start area?

I understand that for 4-5 resources, running around is bad but when you have like10... maybe the couple last ones should be on a outer radius so they dont cram on top of each other...

5 years ago

It would be an option.. I'd need to calculate how many of those are and use that to somehow scale the spawning radius.

New response