Vercidium Audio - Complete Godot Suite (Patreon)
Content
Vercidium Audio is now available as a C++ GDExtension for 2D Godot games, completing the suite of 4 Godot plugins.
SDK v1.10.0 is also available, featuring new optimisation fields, a new unsafe voxel primitive, many fixes and Godot improvements. Read the full changelog here.
If you've tried Vercidium Audio, please let me know your thoughts in this anonymous survey: Vercidium Audio Feedback Survey.
Godot - 2D C++ GDExtension
All four Godot plugins are now available:
2D C++ GDExtension (new)
The latest is a C++ GDExtension for 2D games, for developers that use the standard (non-C#) version of Godot.
I haven't recorded a setup video as it is essentially the same as the 3D plugin, but with 2D primitives instead of 3D. The 3D setup video shows how the plugin works, please let me know if you run into any issues.
In the above screenshot I noticed the capsule is incorrectly converted to an oval primitive in the debug window. I've created this issue to track it.
Repository Changes
As the number of repositories grows - and 5 new FMOD repos will arrive in v1.13.0 - I've made a few changes:
The vaudio-godot-native-openal-3d-release repo has been deprecated, and releases are now available on vaudio-godot-native-openal-3d instead
vaudio-godot-native-openal-3d-source has been renamed to vaudio-godot-native-openal-3d to match the naming convention of the other plugins
The three native wrapper repos have been merged into a single vaudio-native-wrapper repo
v1.10.0 Optimisations
Debug Windowv1.9.0 introduced a new debug window that ran as a separate process. Data is sent from the SDK to the debug window for rendering, and it took up to 10ms per frame to send trail data for emitters that have high ray/bounce counts.
The latest update uses a new leaner data format, which has reduced the time spent on the main thread time back to v1.8.0 levels. Please let me know if you still notice high main thread times or any other performance issues.
Energy Thresholdsv1.10.0 introduces new properties for controlling when rays stop bouncing:
Emitter.MinimumOcclusionEnergy
Emitter.MinimumReverbEnergy
Emitter.MinimumAmbientOcclusionEnergy
Emitter.MinimumAmbientPermeationEnergy
Previously if an occlusion ray lost 99% of its energy on the first 3 bounces, it would continue bouncing and checking for line-of-sight on each bounce, even though it contributes barely any energy to the final result.
Now if the ray drops below Emitter.MinimumOcclusionEnergy (defaults to 1%), it will stop bouncing. This greatly reduces the number of rays that are cast.
UnsafeVoxelPrimitiveI ported Sector's Edge to the new Vercidium Audio SDK, and it was struggling with performance. In a full lobby with many sounds playing around the map, raytracing was taking up to 12 milliseconds per frame.
Compared to the last Steam version that takes up to 40ms, its a decent improvement. But for a game running at 60 FPS (16ms frame time), it's not efficient enough.
Initially I was using the basic VoxelPrimitive, which required syncing voxel data between the game and the SDK. For a 32x32x32 chunk of voxels with an integer material per voxel, that's an extra 128KB per chunk.
To reduce memory usage, v1.10.0 introduces a new UnsafeVoxelPrimitive. It requires voxels to be stored in a flat 1D array (other formats like octrees are not supported), so it can step through the voxel grid when casting rays.
To convert voxels to Vercidium Audio materials, you must create a class that inherits from UnsafeVoxelMaterialMap, and assign it to World.UnsafeVoxelMaterialMap:
IsSolid and GetMaterial will be invoked from background threads when a ray travels through an unsafe voxel primitive, and it's up to you to convert void* voxels to materials. For example in Sector's Edge, the voxel index/type (dirt, concrete, etc) is stored in a byte, which maps to vaudio.MaterialType via the IndexToVAudioMaterial array.
There is no need to sync data across threads - simply invoke primitive.SetDataDirty() to notify the SDK that voxels have changed.
With this reduced memory pressure, raytracing ran a bit quicker at around 8-10ms.
Future Optimisation: Clustering8-10ms is still not fast enough, and the culprit was bullet impact sounds.
Each time a bullet hits a wall, it plays an impact sound. This sound casts its own reverb rays, and is discovered by the listener's occlusion and permeation rays for muffling.
A fast firing gun can shoot 20 times per second, producing 20 impact sounds. With 10 players all shooting at once, all of these sounds were being raytraced.
To optimise this, the next version of Vercidium Audio (v1.11.0) will introduce a feature called Clustering. This feature reduced raytracing times down to 2ms for Sector's Edge.
Clustering can be enabled per-emitter, with a customisable distance threshold. Two emitters with clustering enabled will form a cluster, sharing reverb and ambience rays. Notice how the number of rays traced in the bottom-left changes as sounds join the cluster:
The same occurs for occlusion and permeation rays. Rather than sending rays towards each emitter in the cluster, rays will be distributed evenly across each emitter in the cluster.
This means the number of rays cast by the listener will not increase when a new emitter joins the cluster:
Without clustering: 1000 rays each cast towards 4 emitters = 4000 rays
With clustering: 1000 rays cast towards a cluster of 4 emitters = 1000 rays
With clustering: 1000 rays cast towards a cluster of 10 emitters = 1000 rays
The first half of the video below has clustering enabled, and the second half has clustering disabled:
Enabled: 0.4ms raytracing
Disabled: 1.3ms raytracing
Next Version: v1.11.0
Clustering will be available in the next version of Vercidium Audio, as well as a new Unreal Engine 5.7 plugin that benefits from the same polish as the Godot plugins.
I'll share Unreal updates here and let you know when the plugin is available for testing. I'm currently tackling world partitioner / large open worlds, which requires a double-precision build of the C SDK.
If you've tried Vercidium Audio, please let me know your thoughts in this anonymous survey: Vercidium Audio Feedback Survey.