Spectator mode is in, storage and QoL tweaks, and more!
https://blog.smartlydressedgames.com/unturned-ii-devlog-031/
Transcript
4.20.3.0 update with spectating, quality of life improvements, and more!
Sorted from most to least interesting.
Two devlogs a week apart?! Next week there is an Unturned update I should put together. Following that my hope is to continue focusing on Unturned II for at least a couple months.
Spectating
Spectating NelsonDesktop (in-editor player name)
You can now press ‘P’ to switch to spectator mode. It should show essentially 1:1 what the other player is seeing, or allow freecam flying. In the future this will of course be limited to a permission, and be integrated with server settings.
For the most part this was straightforward to setup because it’s been planned for from the start. One twist was that several pieces of code, especially the UI, were watching the local player rather than the view target player, but these have been cleaned up.
Another interesting case was spectating yourself in splitscreen. The game was tagging objects in the stencil buffer with a controller index which would not work correctly if both splitscreen views were from the same pawn. This controller tagging was reworked as a viewer bitmask so that, for example, a focused interactable is relevant to viewer 0, viewer 1, both or neither.
Storage Depth
Being able to store a backpack within a backpack within a backpack within a backpack within a backpack is a bit much.
One workaround to this would be to limit container space to be smaller then the storage item itself, but that would make them much less useful.
What I decided is to limit the storage depth to three inventories deep. This allows a first aid kit within a backpack within a backpack, but not another container within the first aid kit. To transfer this item hierarchy into a storage crate one of the interior containers would need to be removed.
Quality of Life
Drag-dropping items into the nearby inventory grid locally stores their preferred drop positioning. This allows the nearby inventory to be somewhat sorted.
Items drag-dropped behind the inventory panel are dropped into the world.
In the previous update there was an infinite weight bug when removing items from sub-storage. The cause was simply due to not subtracting the removed sub-storage weight. Several automatic tests are now in-place for weight bugs.
Holstered items (e.g. guns in the backpack) now weld to the collision hull for item physics in the world.
Attachment Listener Code Cleanup
Quite a few places throughout the code wanted callbacks when any child or grandchild item was attached or detached. This was leading to a lot of repetition binding attach/detach events for all nested items.
Moving the grandchild (grand-grandchild, etc.) binding into attachments themselves seemed overkill, and it’s nice that all of the attachment events as-is are blueprintable.
What I decided was to create a listener class for these as well as attachment observers, and register raw pointers to itself with the hierarchy of items. Other systems then create a subclass of the listener and call back into themselves as-needed. Many of the weapon and UI cases have been converted to this now.
Snow Improvements
Outfit meshes now register themselves to displace snow. When implemented snow ghillies will not displace snow.
Snow and season previewing now work in the editor. This was sort-of implemented a year ago, but there were complications because only one instance can be managing the render targets at a given time and was disabled. These intricacies have been sorted out, so PIE takes priority and then the focused level editor viewport.
Unreal Level Editor