This week I’ve been finishing off the missing parts of the gunplay system before pushing forward with deathmatch tests. Results from first iteration (which are things we mostly knew about) are that gun sounds and hit feedback needs a lot of work.
In the current version of hurtworld, the assault rifle has a lot of trouble maintaining a steady fire rate. There are a few reasons for this, one is aliasing between our update rate and the gun rate of fire not matching, another is rendering framedrops causing interruptions in the Unity sound engine.
I have an almost working framework for sub frame bullet events which should solve most of those issues, however actually synthesizing very fast firing bullet sounds well turned out to be not as simple as I thought. I managed to get some amazing weapon sound source material this week, which provided both full auto recordings and single shot recordings. To my surprise, playing single shots at full auto speed sounds nothing like the recording of actual full auto recordings (and nowhere near as good).
After some experimentation I settled on using time synced 4 bullet loopable samples scheduled with the Unity audio engine ahead of time, then scheduling early stop times when the player doesn’t actually shoot all 4 bullets of the audio chunk, then injecting the tail end of a single shot or burst shot on the end of the fire clip to ensure it doesn’t stop abruptly.
The only problem with this, is as the clips have 4 bullet fires instead of one, the rate of fire can’t be adjusted by simply playing the fire clip more often. What I tried instead was to dynamically scale the playback speed of the clip to the desired rate of fire so the loop still syncs up. This works nicely, but has one side effect of lowering and raising the pitch of the bullets, changing how the gun feels. For example silenced mp5 at 300 rpm slower sounds like a 50 Cal MG. I will likely build some auto loops at different RPMs and pick the closest, then pitch shift to the exact speed. The other option is to do a pitch constant speed modification to the clips, which I have no idea how to do. And from experience in audio tools, algorithms rarely output anything good without artifacts. The last option is to automatically stitch a bunch of single shots together with volume envelopes to make the blend better, I will have to give this a try to determine if I can achieve the same result as the recorded full auto.
Here is a recording from a realtime Unity project running at 20fps with massive garbage collection spikes happening (to test if the bullet stream is interrupted)
I have continued on with these more basic weapon type for the creature weapons. Getting a whole bunch of weapon chassis designs out so we can then select the first designs that I will end up making. After we decide on some designs and maybe do a little more concept art, we will probably do a bunch of simple grey-boxed models. These will help make sure we have all the pieces in the right places so we can cement the animations.
This week I’ve been working on implementing water, and iterating through on the map.
I implemented some cool water effects for the camera, so that when the camera is half or completely in a water volume, we can do cool things like change the fog parameters, apply a vignette, and do caustics or other distortions. This requires solving what I thought was a bit of an interesting problem – calculating the intersection point of a plane along the camera frustum. To do this, we need to get the intersection of the near frustum plane, and figure out where on that plane the water plane lies, and so where the transition between above-water effects and below-water effects needs to happen.
I also made some fixes to the water shader to deal with issues of how it looked when the sun was rising and setting, as it was taking far too much color from the sunlight at these times. It now will take more from the ambient when hit at an acute angle.
The map creation has for the past week been a process of tweaking values and figuring out the relationships between issues in the “feel” and play of the map, and the actual changes needing to be made in the map creation logic. To make this easier and so we have a predictable baseline, I moved a large amount of the common logic to shared sub-biomes. This means I can adjust parameters in one place and it will effect all biomes, which should hopefully speed things up a fair bit in terms of iteration.
This last week I finished of the texturing and material setup for a couple of pairs of shorts, then moved onto getting setup with the item V2 pipeline. Following the setup I went through and generated skin mesh attachments for all the new clothing items I have been making.
To do this I drag a skinned fbx file that I have bought over from Maya into the scene.
Then select your desired skeleton via the radial button, and drag your mesh into the target character slot. Click the Generate SkinMeshAttachments from character button which will prompt you to choose a save file destination.
This will result in a skinmesh attachments file which you can select and apply any relevant material to.
Finally select the Character Default Setup in the Hierarchy which will allow you to select and place various skin mesh attachments into their corresponding slots.
This week I’ve been continuing to work on patching up bugs and exploits. A big thanks to all the community members that have been in contact with us helping us track down and reproduce issues.
Some people were still managing to push themselves through things with closing doors so I rewrote the overlap check to use the physics system, resized the colliders to be more defensive, removed any gameobject scaling and also slightly changed the logic that calls the check fixing some client side bugs and adding the overlap check to the client as well.
We also got some good reports with video about using the crash vehicle to glitch into rocks when getting up. I found a bug where the stand up overlap checks were slightly smaller than the character collider so I’ve fixed that up and also added an additional check using the same method as ownership stakes to see if the exit position is inside geometry.
I also fixed a ui bug where scroll windows weren’t resetting properly meaning you could scroll past some categories of crafting while using a workbench and then when you went into the handcrafted menu they wouldn’t be selectable.
I’ve also extended the radiation zones in the salt flats of Diemensland so you can’t hide in the corners of the map anymore, if you’ve got a base there you’ll want to move out before these changes go live.
Right now I’m working on adding some additional checks to the character controller when it interacts with physics objects pushing it around to make sure the character controller is still in a safe location and rewind to a previous position if it isn’t. This is the major blocker for the next patch so once I’m finished with it we’ll be ready to go.