My latest additions to ACE’s codebase are a generic heatmap service (to replace the existing appeal heatmap) and a concept of “wilderness” that’s primarily used for modifying the spawn rate of trapping zones but can also be integrated into other entities (imagine a bird bath that, if there’s enough wilderness around it, periodically does an effect of birds or other animals coming up to it).
The heatmap service allows you to set up a heatmap by providing just a few settings and functions in a Lua file and adding the proper index to stonehearth_ace/services/client/heatmap/data/keys.json
. The appeal heatmap was the first converted into the new system (plus a small fix for it being offset by 0.5 on the x axis for some reason), and naturally I made a wilderness one as well. The third example heatmap is for “ore detection:” it shows where ore veins are underground, with a brighter color for ore that’s closer to the surface or more numerous (my idea is that this will detect ore up to 10 voxels deep, or 20 if you’re playing as dwarves or have a particular town bonus, but of course that’s all subject to change). It does not show what type of ore, but it’s still a little cheaty because you can use it very effectively in slice mode (however, it doesn’t detect ore that you wouldn’t be able to see normally because it’s too far away; so it’s no more cheaty and rather simpler than preview-mining everywhere).
These latter two heatmaps are square rather than circular. For the wilderness one, this was important because I wanted the calculation to be very similar between the heatmap and the wilderness_signal_component
which is used in trapping zones and is necessarily rectangular (it doesn’t just display in a square, it also looks at all entities within a rectangular region centered on the point [for the heatmap] or region [for the trapping zone] when calculating wilderness values). For the ore one, it just made sense because it’s a world of squares, and the ore veins are all rectangular.
This segues nicely into the concept of wilderness. The primary goal was to make trapping zone spawn rates more reflective of the area they’re in. In the base game, the only alteration that’s made to spawn rates is checking what the majority ground material is: if it’s “rock,” the spawn interval is between 70-100 in-game minutes; otherwise, it’s between 50-70 in-game minutes. The new wilderness_signal_component
factors in dirt, grass, plants, and “animal”-kingdom critters (not pets, pasture animals, or farmer crops) as positives and buildings as negatives. “Mobile” critters are equipped with a separate wilderness_component
that periodically checks to see if it’s within a wilderness signal region (or if it’s left one it was in before) and updates those signals accordingly. The wilderness_component
can be attached to any entity to specify its wilderness value (and setting is_mobile
to true
will make it periodically check its location).
Raw default wilderness values are as follows: 5 for an animal, 1 per voxel in the collision or destination region of a plant, and -2 per voxel in the collision or destination region of a building. When a sampling region is passed to the wilderness_util.get_value_from_entity(...)
function (as it is with the wilderness signal and heatmap), only the part of the building or plant region that intersects with the sampling region is counted. For both the wilderness signal and heatmap, the sampling region extends past the visible bounds of the region by a set amount to take into account nearby entities. Additionally, dirt terrain and grass terrain add 0.01 and 0.02 wilderness value, respectively, to a voxel. The total value of all the entities and terrain in a sampling region is then divided by the flat area of that region to come up with the actual wilderness value, which is then compared to a table of “tiers” similar to the tiers of appeal (and to the water affinity tables used by the water_signal_component
and growing/evolving crops/plants).
In the future I hope to integrate humidity and temperature a little more mechanically with biomes, seasons, and weather, but in the shorter term I at least want to get biome-specific spawn rate modifiers implemented (e.g., you shouldn’t need the same number of big trees in the desert in order to attract the local wildlife as you need in the temperate forest). I already have a modifier for the type of animal you’re trying to trap (critters require less wilderness than normal, bugs require a normal amount, and big game* require more).
*Oh, did I forget to mention that I also added a level 6 tier of trapping grounds for big game? Currently only deer (and somewhat rarely “horned deer”) will spawn there, but we’re planning on adding bears, and perhaps wolves also.