Resource Spawner Overhaul

by orzelek

Overhauls resource spawning system.

13 days ago
0.14 - 1.1
1678330

g Using RSO as an ore spawning library?

1 year, 10 months ago

Would it be possible for me to call specific parts of RSO to spawn resource patches in my maze mod?

1 year, 10 months ago

There is no support for something like that currently.
I'm not sure how much it would take to add this.
It depends on what you would like to use - just something like place_ore(name, settings) ?

1 year, 10 months ago

I'd ideally like two functions and a way to tell RSO that it's being used as a library (so mods don't fight over who gets to clear out the ore, and who gets to place the ore)

place_random_ore(location, area) - pick a random ore based on relative frequency, and put it in a constrained location with richness appropriate for its distance from spawn (I don't want resource patches crossing maze walls, but I'd like them to be pretty shapes)

place_starting_resources(location, area) - puts a full set of starting resources in the specified area.


Area could be a radius, or a size factor, or a bounding box, or whatever is easiest for you to let me stop patches being too big for my clearings.

1 year, 10 months ago

With RSO there is no clearing of ore. All ores are set up to not generate (with few exceptions due to other mods).
I'm not sure if you can change mod setting from other mod since that would allow you to disable RSO ore generation through it. If not then there would be a need for interface to do that.

Starting area is pretty simple I think - RSO already does it internally. Limiting it in size might get tricky since it's meant to randomize ores in quite large area.

Function to place random ore might be a bit more tricky since chosing random ore to place and placing it are two separate places in code now. And they talk through a global table so I'd need to move things around a bit.
What might be a bit more tricky is the size limitation. I can get RSO to clip ore patch hard to given area but it might degrade this patch to simply fit this area if it would be much bigger then this according to normal generation rules.

Since maze seems to fun way to play I'll think about this a bit and see if I get some time to prepare something.
What kind of area definition would work best for you?

Since ore config decides on size and richness anyway I can limit size in any way really - will need to figure out how to scale the patch down potentially to not just fill that area.

1 year, 10 months ago

With RSO there is no clearing of ore. All ores are set up to not generate (with few exceptions due to other mods).

I didn't know you could do that. I'm doing massive stuff in onChunkGenerated, so I'm currently just removing any resources as I find then.

I'm not sure if you can change mod setting from other mod since that would allow you to disable RSO ore generation through it. If not then there would be a need for interface to do that.

I remember seeing something in the api docs about mods talking to other mods. No clue how hard it is to deal with - I've not had to touch it so far.

Starting area is pretty simple I think - RSO already does it internally. Limiting it in size might get tricky since it's meant to randomize ores in quite large area.

I'm currently hard-coding the starting area to a 15-chunk-sided square, but I keep thinking that it would be very cool to make my maze PvP capable by having an option for multiple starting areas. This is just a twinkle in my eye at the moment. If starting resources fit in a 15-chunk square then I can make sure my starting clearing lines up with your starting area.

Function to place random ore might be a bit more tricky since chosing random ore to place and placing it are two separate places in code now. And they talk through a global table so I'd need to move things around a bit.

Happy to have to call "pick a random ore" and then "place named ore" if that's easier for you. I just don't want to have to go through all the effort you've already gone through to handle every modded ore under the sun. So anything you can do is appreciated.

What might be a bit more tricky is the size limitation. I can get RSO to clip ore patch hard to given area but it might degrade this patch to simply fit this area if it would be much bigger then this according to normal generation rules.

Since maze seems to fun way to play I'll think about this a bit and see if I get some time to prepare something.
What kind of area definition would work best for you?

"Centerish point" and "radiusish length"? My resource clearings are all chunk aligned squares (3-15 chunks to a side, clearing size is not dependent on distance from spawn), but I'm trying to make the whole thing not look too much like it's chunk-aligned, while keeping it chunk-aligned (yes, I'm aware that's impossible, but if I'm going to build it on a square grid then I might as well let people use their chunk-aligned blueprints), so being able to put a bit of wobble in resource positions would be nice.

Since ore config decides on size and richness anyway I can limit size in any way really - will need to figure out how to scale the patch down potentially to not just fill that area.

I really appreciate you taking the time and effort to help with this. I'm not always good at getting things like that across, especially in text. So before it gets lost : Thank You!

1 year, 10 months ago

For starting area I already have a system through remote interfaces that allows setting up multiple starting points (with first one always at 0,0 atm as base one others anywhere else). And RSO will spawn starting resources for any of those as well as clear ore/trees I think. It was meant for PvP but n ot sure if it's used by any mod. So only potentiall issue might be if your first starting area is not at 0,0 but that could be handled somehow - I'd need to provide you a method to skip that initial starting area and then you could add new ones normally.

Currently default starting area size if I remember correctly is a circle with radius of 7 chunks that would match what you are planning to do. I would need to stop it from using map size multiplier to not let users multiply it by 6.. (this surprised some already after seeing that nearest ores are 1.5k tiles away).

For ore spawning I'd still need to redo it to run without my global "map" of what should be where so no need for two separate calls most likely.

I think simple rectangle would be enough to give as area for ore spawning. I have a system tha tries to fit the ore in some area.. but it's not meant to be very precise. If you'd give an actual area where ore needs to go as rectangle I'd simply use it's center as first location then others would land around it. Should end up pretty well inside rectangle - might be cut off at edges depending on how weights used for patch land but thats not a big problem I think.
Not sure how would that work for oil like resources.. those don't really mind area currently but on the other hand they don't spread out much.

Also - is this a new mod? I can only find some deprecated one on your mod list.

1 year, 10 months ago

That all sounds good :)

As long as it can handle a 3-chunk square at the edge of the map I don't see a problem with occasional straight edges. 3 and 5 chunk clearings are where I mostly want to put resources, with the bigger clearings left empty more for base building.


Yeah, it's a new mod.

I decided I didn't like the restrictions of Ribbon Maze's generation algorithm, and found a good way to generate an infinite maze in all directions without eating all the processor time. Ribbon Maze is so locked into it's generator that it's easier to start over.

And then I figured out I could do wiggly walls that combine water bits, cliff bits and water+cliff bits to make it feel more like an old-school RTS map than Ribbon Maze's dead-straight corridors.

I might include an optionto turn off the wiggly walls if it's asked for, but I'm really liking how they've come out so far.

New response