June 12th 2020 by SDGNelson
18.104.22.168 update with trees.
Obviously certain elements like the magical downward swing insta-killing trees are temporary. Main changes compared to original Unturned:
- Felled trunk is permanent (rather than an effect) and will be harvested for sticks and logs.
- Stumps do not respawn.
- Trees can be planted.
- Art is manually designed somewhere between the early 3.0 trees and the later speedtrees, aiming for good performance with a distinct look.
Eventual features for future updates:
- Tools for uprooting stumps.
- Damage dealt by falling trunks.
- Heat the pine cones to release the seeds. Grow a sapling before transplanting into the forest.
- Melee direction left/right to cut vertical trees and up/down to cut the timber.
In 3.0 a map truly feels like a new biome once it has new trees and foliage. It was really exciting when developing the Russia map seeing the Autumn birches, drab pines, and cattails come together.
For that reason I decided to take a more botanical approach to the foliage in 4.0, so that each location can be more accurately distinct. The first two tree types are a Jack Pine and a crowded Latifolia variant of Lodgepole Pine. Small characteristics like the upward tilting branches and spiked cones of the Lodgepole Pine will help set it apart from future Conifers.
One trick that I found really helps is pushing out the needles at small screen sizes, this way the trees still appear dense at long range:
The earliest 4.0 trees seen in the Pineridge posts were much closer to the early 3.0 trees. When revisiting the models to finalize them I considered a more geometric design, but decided to go for a mix of the simple rounded cutouts with mesh knolls, twigs and roots.
When chopping down the trees I experimented with a few physics setups, like attaching the spawned trunk to a spring that breaks, but ultimately decided that having it sort of "jump" away from the stump was the most fun.
Saving and loading game state was further optimized because I expect average size maps to have tens of thousands of trees. (and I benchmarked a 3.0 Russia-size field with 35,000 trees) Players can also end up placing tons of items.
Items in corpse totems as well as name tags are now persistent too.
My first approach was to use instanced meshes for the trees for rendering performance and convert them to actors when interacted with, but this seriously complicates replication. There are a few potential approaches for this like tracking relevant instances per-player and using a per-player actor to replicate them, or having per-grid-cell actors tracking nearby instances.
For the meantime I have decided to keep it simple and just make all trees actors because that's how Fortnite (Unreal) handles this, and if it becomes an issue in the longterm deal with it then.