Example of the
Example of the "wilderness lodge area" prefab in the cavern

More refactoring this week on the native plugin side, for integration of procedural prefabs.

The integration is going well, and now rooms and/or zones can have procedural content special to the room/zone, with some nice distance-based rules. I've set my mind to create one of the examples I was talking about a couple of weeks ago: a wilderness area with a cabin, a campfire, some objects by the wall of the cabin and some objects lying around. The test was successful and is now 90% integrated correctly in the generator (the last 10% is a bug that I've yet to fix). But I digress; back to the scenario, but in more detail:

Wilderness lodge area

  • The area is an empty area (blobby square shape) with a single room, of type "WildernessCabin", that fits in a 16x16 box
  • The area is using a "WildernessCabinArea" preset, with the following placement rules:
    • place up to 3 jugs next to a "wall" tile. Make sure they don't block the way, and they're not next to the zone's border
    • place up to 3 crates on a tile that is NOT next to a wall tile. Make sure they don't block the way, and they're not next to the zone's border
    • place a campfire on a tile that is NOT next to jugs or crates or a wall (in fact, at least 3 manhattan distance away)
  • The "WildernessCabin" preset uses 2 rules for placing things INSIDE the cabin:
    • place a carpet cover in the largest rectangular area in the cabin
    • place a bed that is next to a wall and not near the entrance
Prefab variations. The black area is the parent zone: a cavern, wilderness, dungeon, etc.
Prefab variations. The black area is the parent zone: a cavern, wilderness, dungeon, etc.

This works pretty well! The distance rules have been extremely convenient actually, and allow a wealth of choices like "must be within 2 tiles of wall" or "must not be within 3 tiles of campfire" and so on, and it's flexible to add more generic rules.

Currently there's a bug where if I try to add this preset into a bigger map, the placement rules for the cabin do not work, but it's probably something silly, I just ran out of time.

Another example of the prefab in the cavern
Another example of the prefab in the cavern

Other changes:

  • Some boring refactoring, like renaming source files, breaking down complex files into smaller ones etc.
  • Some bug fixing in the generators. This is a bit of whack-a-mole, as the generator is overall complex enough that a small change might have side effects in very certain scenarios.
  • Some visualisation fix for this round of refactoring: don't display tiles that are not near a walking area or border walls, as it just looks nicer that way.
  • Some GUI for placing prefab zones