Weight for Nested Chunks

So, just discovered nested chunks, think they’re great, don’t know why they’re not used in almost every mapgen file. The problem I’m seeing is that they ignore any “weight” you assign them.

Just for testing, I set up a blank canvas and two different nested chunks to spawn within the blank terrain. The two seem to spawn at a 50/50 ratio, even when I set the “weight” of one to 1000000 and the other to 1.

Is there a different entry I should be using rather than weight? The only instance I could find of nested chunks was in the lab finales and they all spawn with equal frequency.

If not, how hard would it be to make chunks accept a “weight” entry?

Ah, figured it out.

Good thing I wasn’t looking right at the answer for 20+ minutes or anything. That would have been embarrassing.

o_o

Care to share with the rest of class? I’d like to know, and the title is so clearly on subject that it may be helpful to anyone looking for that information.

Well, I wanted to make a trailer park (didn’t know there was already one in game) where each trailer would be pulled from a random assortment of nested chunks. This would make each trailer park a pseudo-random experience.

But I also wanted rare spawn trailers (like one with a suicide or a meth lab or whatever). I thought that I could use “weight” to make them rarer. You can’t, though.

What you can do, though, is break those into their own set. IE: Basic trailers would have one nested_mapgen_id (tp_single, in my case) and then rare ones with a separate id (tp_single_rare).

Then, when you are spawning your chunks in the main mapgen entry, you can weight those categories. I’m not good with the exact terms for these things, so that all might sound like nonsense. But basically it looks like this.

"place_nested": [ { "chunks": [ [ "tp_single", 99 ], [ "tp_single_rare", 1 ] ] "x": 0, "y": 0},

This way it should pull from the standard nested chunks 99% of the time and from the rare chunks 1% of the time. Uh, that’s if I understand how those numbers work.

Again, sorry I don’t know coder words and phrases. I hope all that made sense.

You can find examples of this in mapgen/labs/lab_rooms.json, which is where I figured it out. I was originally looking at lab_floorplans_finale1level.json, which didn’t have what I was looking for.

As a side note, I don’t think the trailer thing is going to work out. They just turn out as small houses and I’m not sure how people feel about preconstructed neighborhoods.

EDIT: At least I’m pretty sure that’s how it’s supposed to work but I’ve been effing with it for about 20 minutes and my chunks won’t show up. So maybe I don’t know as much as I thought.

2 Likes