Actor foliage performance

I tried deriving from FoliageType_InstancedStaticMesh and FoliageInstancedStaticMeshComponent to try and get some variable on my foliage so I could maybe do this without having to have an extra dictionary from static mesh to the actor to spawn, but it didn’t work. Derived FoliageTypes can’t be used in the foliage painter (which is pretty sad and to me not really understandable, this would be great actually). Deriving from Foliage-MeshComponent would work, but you can’t modify its class defaults from the FoliageType so you’d have to make a child class for each possible actor (which is ugly)…

I would’ve liked to make the mapping in some sort of global dictionary that I could somehow reference instead of defining it in my WeaponBase, but I didn’t find anything suitable. In the end I used a DataTable so I can define the mapping outside of the blueprint.

Let’s see how this’ll work out in the end. Other interesting questions

  1. Foliage you can harvest from like berry bushes, apple trees, maybe even ore deposits. I’d probably need another DataTable (or refactor it so the rows only contain dictionaries and I have one row for destroyable foliage, one row for usable foliage, etc.)

  2. Foliage changing over time, for example young trees having a random timer and getting replaced by grown trees.

  3. Forest growing “naturally”, so the players have a steady source of wood without having to plant seeds themselves. Trees would preferably spawn in the vicinity of other trees.

Is there some kind of foliage blueprint that could be used to handle things like that? Sound like I need some sort of static FoliageManager.