• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

PSA: Wilderness Townships/Districts method

EvilPolygons

Survivor
With the recent changes to RWG, very large wilderness POIs have become a problem. They tend to spawn inside city limits, wrecking city tiles, and can also overlap other wilderness POIs and paths, generally causing a big mess. Especially on smaller maps.

@stallionsden and @zztong developed a solution that involves taking those old, oversized wilderness POIs and spawning them on (or building them into) rwg_tile_cap tiles. These tiles can then be set to spawn as one-tile settlements out in the wilderness, and the RWG townplanner will even draw roads to them.

The problem is, that setting these up individually as a bunch of separate townships causes each one to have a 100% chance to spawn, which can quickly begin to crowd out other settlement types on RWG maps. So this is a solution to that problem:

<append xpath="/rwgmixer/world[@name='tiny']">
<property class="bigwaste">
<property name="count" value="1, 1, 2"/>
<property name="tiles" value="1, 1"/>
<property name="distance" value="2"/>
</property>
</append>

(Other map sizes omitted to keep the post a reasonable length)

<append xpath="/rwgmixer">
<township name="bigwaste">
<property name="spawn_trader" value="false"/>
<property name="spawn_gateway" value="false"/>
<property name="biomes" value="wasteland"/>
</township>

<district name="bigwaste">
<property name="tag" value="bigwaste"/>
<property name="prefab_name" value="bigwaste"/>
<property name="spawn_weight" value="1"/>
<property name="required_township" value="bigwaste"/>
<property name="preview_color" value="0,0.5,0"/>
</district>

<streettile name="rwg_tile_bigwaste_cap">
<property name="mintiles" value="0"/>
<property name="maxtiles" value="1"/>
<property name="maxdensity" value="3000"/>
</streettile>
<streettile name="rwg_tile_bigwaste_cap_01">
<property name="mintiles" value="0"/>
<property name="maxtiles" value="1"/>
<property name="maxdensity" value="3000"/>
</streettile>
</append>


In this example, our township is named "bigwaste" as it's meant for very large POIs that we only want to spawn in the wasteland biome.
The "bigwaste" district is set up in pretty typical fashion, spawning only in a "bigwaste" township.
The streettiles are set up as rwg_tile_caps, named sequentially as required by the RWG. Each tile either has a POI built directly into it (like zztong's Ravenswood village) or it has a POI spawn marker that is tagged to spawn in the POI matched to that tile via tags, as usual (see the compopack for examples of that method). Note that if your tiles are spawning in the world, but you get an error during mapgen and no POI spawns into a tile's marker, that's almost certainly because you didn't tag your POI properly.

Because each "bigwaste" township only supports a single tile, and because each tile is set to a max of 1 per map, the end result is that you get a random roll between the tiles (which are essentially giant POIs) available to the township. If your worldsize allows for only 1 bigwaste settlement, then the game will choose one randomly and you'll only get that one. If your worldsize allows for two of these settlements, then you'll get one (and only one!) of each.

If your worldsize allows for more "bigwaste" settlements than you have tiles, then I have no idea what would happen because that means you screwed up and should have been more careful. So don't do that.

Anyway, it works. I've tested it. Give it a try!
 
Last edited:
Ah, so you provide several rwg_tile_bigwaste_cap tiles...

rwg_tile_bigwaste_cap_01
rwg_tile_bigwaste_cap_02
rwg_tile_bigwaste_cap_03
rwg_tile_bigwaste_cap_04
rwg_tile_bigwaste_cap_05

... and then tell RWG it can only place 2 bigwaste settlements, each with one bigwaste district of one tile.

Since there are 5 tiles to pick from and you only need 2, you get variety from map to map.

Yes? If so, that should be expected behavior and I think should work in the long run.
 
Ah, so you provide several rwg_tile_bigwaste_cap tiles...

rwg_tile_bigwaste_cap_01
rwg_tile_bigwaste_cap_02
rwg_tile_bigwaste_cap_03
rwg_tile_bigwaste_cap_04
rwg_tile_bigwaste_cap_05

... and then tell RWG it can only place 2 bigwaste settlements, each with one bigwaste district of one tile.

Since there are 5 tiles to pick from and you only need 2, you get variety from map to map.

Yes? If so, that should be expected behavior and I think should work in the long run.

Haha, yup, it seems so simple now. But I've been beating my head against the desk for two days over this. Nothing in vanilla functions exactly like it, so I went down a lot of false paths trying to figure it out. However, it totally obeys all the rules of the rwgmixer and is 100% compatible with the townplanner. No weird hacky stuff required -- it's just a different way of going about what vanilla already does.
 
Nothing in vanilla functions exactly like it...

It's a matter of perspective. Districts have always randomized their tile choice, but if you only have Vanilla tiles then you generally only have one tile of each type. (Sometimes two.) At first, only the downtown district had more than one, which was our clue it could randomize. Later, the gateways got multiple choices after A21 broke out the gateways as their own thing.

But you're the first I know of to use it in combination with a scarcity, such that no map could have every combination.
 
It's a matter of perspective. Districts have always randomized their tile choice, but if you only have Vanilla tiles then you generally only have one tile of each type. (Sometimes two.) At first, only the downtown district had more than one, which was our clue it could randomize. Later, the gateways got multiple choices after A21 broke out the gateways as their own thing.

But you're the first I know of to use it in combination with a scarcity, such that no map could have every combination.

It was lack of randomness that really bothered me. And my 4k test maps were starting to get really crowded. So I figured there had to be another way. However, the only reason I was able to figure this out is because of the method you and stallionsden cooked up (which this is entirely built on top of).

If xpath v1 had access to random() function calls then I would have had this done in an hour. Xpath v1 is incredibly limited.
 
More credit to Stallion. He's the one who showed me a single tile settlement always uses a cap.
Well, I never would have even considered building an entire POI directly into a 150x150 tile if not for your Ravenswood village. That was incredibly clever. I have already used that method on one of my conversions and it's perfect.

The big limitation with this method however, is that you kinda have to divvy your POI/settlements up by biome, because everything is organized under townships -- and that's where the biome restrictions are applied. Now, that's not necessarily such a big deal, but I am very picky about assigning specific biomes to nearly every singe POI in the game (and I even maintain my own custom rwgmixer rules for a huge chunk of the compopack and your zztong pack, among others). I'm just OCD like that.

Anyway. Luckily, it's pretty simple to convert over to this method. It's mostly just renaming your rwg_tiles and making sure POI marker tags are correct.
 
Last edited:
Extra info, things to watch out for, etc:
As I mentioned above, biome restrictions are enforced at the township level. I tried thinking of ways to do it at the tile level, but it just won't work as far as I can tell. Because the townplanner doesn't pay attention to any biome tags but its own. This is why it's important to get your POI tags correct when using this method, because otherwise the following issue can occur:

-- the townplanner wants to place a settlement
-- the settlement's township biome is wastleland only
-- the townplanner places a tile for the settlement
-- this particular tile includes a POI spawn marker
-- the POI chosen for that spawn marker has biomeTags="forest" set somewhere in the rwgmixer
-- tile spawns in the wasteland, but the POI bugs out because it can only spawn in the forest

This will throw a warning in the console: SpawnMarkerPartsAndPrefabs failed

The townplanner will NOT make any decisions about whether a tile or POI is really appropriate for its biome. It will try to place any tile with a sequentially-named filename which matches your township, regardless of how badly you tagged that tile or its POI spawn markers.

It would be great if you could simply create one single "bigwildPOI" class/township and use it to spawn ALL of your oversized wildness POIs.
But that could only work if the townplanner was able to intelligently choose which tile/POI combinations are appropriate for a given biome -- and it can't do that.

So if you want biome restrictions to apply when using this method, you MUST create separate class/townships for different biomes:

<append xpath="/rwgmixer">
<township name="bigwaste">
<property name="spawn_trader" value="false"/>
<property name="spawn_gateway" value="false"/>
<property name="biomes" value="wasteland"/>
</township>

<append xpath="/rwgmixer">
<township name="bigforest">
<property name="spawn_trader" value="false"/>
<property name="spawn_gateway" value="false"/>
<property name="biomes" value="forest"/>
</township>

<append xpath="/rwgmixer">
<township name="bigdesert">
<property name="spawn_trader" value="false"/>
<property name="spawn_gateway" value="false"/>
<property name="biomes" value="desert"/>
</township>
 
I'm continuing to tinker with this method, trying to improve it. The original setup required individual tiles for each individual POI that you want to spawn. I didn't really like that because it potentially makes for a veeeerrry long rwgmixer file. So here's a nifty example of what you can do using "generic" cap tiles which act more or less like city tiles, except of course they spawn out in the wilderness:

<append xpath="/rwgmixer/world[@name='large']">
<property class="bigforest">
<property name="count" value="2, 3, 4"/>
<property name="tiles" value="1, 1"/>
<property name="distance" value="2"/>
</property>
</append>

<append xpath="/rwgmixer">
<township name="bigforest">
<property name="biomes" value="forest"/>
<property name="spawn_trader" value="false"/>
<property name="spawn_gateway" value="false"/>
</township>

<district name="bigforest">
<property name="tag" value="bigforest"/>
<property name="prefab_name" value="bigforest"/>
<property name="spawn_weight" value="1"/>
<property name="required_township" value="bigforest"/>
<property name="preview_color" value="0,0.5,0"/>
</district>

<!-- generic tile with 60x60 marker -->
<streettile name="rwg_tile_bigforest_cap">
<property name="mintiles" value="0"/>
<property name="maxtiles" value="2"/>
<property name="maxdensity" value="9999"/>
</streettile>
<!-- additional tiles, generic or not -->
<streettile name="rwg_tile_bigforest_cap_01">
<streettile name="rwg_tile_bigforest_cap_02">
<streettile name="rwg_tile_bigforest_cap_03">
<!-- etc etc you get the idea -->

<!-- here are two 60x60 POIs that have been tagged to spawn into our generic cap tile -->
<prefab_spawn_adjust partial_name="example_wilderness_poi_01" biomeTags="forest" min_count="1" max_count="1"/>
<prefab_spawn_adjust partial_name="example_wilderness_poi_02" biomeTags="forest" min_count="1" max_count="1"/>
</append>

So, in this example, when a generic tile is chosen by the townplanner, any POI appropriately tagged and sized has a chance to spawn on that tile.
Note that <property name="maxtiles" value="2"/> can be set to whatever you want, but there's not much point in using a generic tile if you're only going to use it once! In this case, I only have two compatible POIs, both of which I want to have the chance to spawn, so maxtiles is set to 2.
 
Back
Top