When we rolled out the new roadmap at the tail end of last year, we stated that the post-Alpha 3 stage would be one of optimizing and fixing parts of the game. The purpose of this DevBlog is to discuss some of the optimization tech we’ve been working with, and what they mean for the players. Keep in mind that many of these are still in early development, and may not even be released. However, we understand that many in our community are interested in the development behind our game, so we decided to feature them.
Dual Universe features highly-detailed environments, filled with non-interactive items we call ‘decors’. These include things like grass, trees, small rocks, and more. The engine we use for the game, Unigine, calculates the geometry of these items—usually in the tens of thousands at any given time—using the computer’s CPU, and decides which are more important. For example, items that are behind the player or less visible (i.e. somewhere in the far-off background) will not be rendered. This is particularly important in more dense environments, such as forests. This process is known as ‘culling’, and our team of developers have coded the engine to utilize the computer’s GPU to do these calculations instead of the CPU. Considering it’s already responsible for rendering these decors, this will significantly improve how fast these calculations are produced. What this means for the gamer is improved framerates and more detailed environments.
At any given moment in Dual Universe, there will usually be multiple light sources in a given scene, either natural such as sunlight, or man-made such as headlights or floor lamps. These provide individual light sources for the purpose of creating shadows, and historically have only operated in that way (which is incorrect, given that we can still see in shadows due to scattered light from various surfaces). Global illumination aims to make light sources behave more realistically by simulating indirect lighting: reflection, scattering, and ambient occlusion. Reflection and scattering are pretty self-explanatory, but let’s touch on this last feature. Ambient occlusion is a geometric approach which determines how bright an object is relative to the light source—in other words, whether certain parts of it are being blocked by other objects in the scene. By using dynamic global illumination based on light fields, we can map these for any given scene, and this will make the game look more realistic and dynamic. Finally, this will also dramatically improve low-light visibility, which many players have had an issue with.
When rendering terrain in Dual Universe, there are lots of requirements depending on the environment, such as the type of biome, different texture orientations (such as cliffs), and more. Unlike other games, Dual Universe is unique in that it must be completely customizable by the players, so blending different textures together to create one congruent piece of terrain is more difficult. Currently, we render terrain in one pass through a network of vertices. That is to say, there is a lot of unnecessary texture sampling occuring, which eats up valuable computational power. The new method of ground shading, which is still a work in progress, requires multiple passes for various different operations: rendering the geometry depth, getting an outlay of the geometry’s landscape, rendering the height of materials, rendering the material’s surface texture (i.e. rough vs. smooth), and then rendering any variables for object weight. This method, which is still a work in progress, will eat up less resources when computing individual scenes, by reworking the terrain rendering into multiple passes for its various properties (i.e. height, texture, landscape, etc.). This gives us the ability to make planets look significantly better, while providing better performance in terms of framerates.
This new technology was developed entirely in-house, and was created to solve issues regarding procedurally-generated planet voxels. Dual Universe stores its voxels, which make up almost the entirety of the game with the exception of certain elements, in a cubic grid. Hexoctree is a new type of voxel grid, made specifically for planets, that dramatically simplifies many of the internal operations related to planet geometry. A 'regular' voxel grid does not align nicely with the surface of a sphere, making calculations tedious, especially as we get closer to the core. Hexoctrees, on the other hand, 'bend' the voxel grid into a spherical shell shape, making the grid align perfectly with a planet's surface, allowing us to very quickly reason about the relationship between the planet's surface and the voxel grid.
Dual Universe also employs the use of heightmaps, defined by the yellow lines in the above diagram, to model elevation. The diagram on the left is our current way of using these heightmaps to compute voxels. As you can see, as the level of detail (LOD) moves up a level, these shapes are haphazard. In the example on the right, they are more uniform.
Dynamic load balancing
The goal of this is to essentially restribute players across the entire server architecture, and serves the purpose of balancing each server processor’s workload. The benefit of this is increased operational stability, significantly less lag, and the ability to connect large quantities of players in close proximity.
The general idea behind visibility as it pertains to server technology is what the server chooses to show to players, as well as the amount of resources it decides to allocate towards them. The server is also responsible for deciding how frequently objects in the game world are updated. For example, if you were walking along the surface of Alioth with a companion towards a ship in the distance, this other player would require high visibility due to their proximity, and the server would update their actions frequently. The far-off ship, however, would be less detailed and would only need to be updated by the server intermittently. Of course, objects behind your player and floating kilometers above the planet’s surface would have zero visibility, since they have no impact on your immediate circumstances.
This server orchestration technology, which controls the lifecycle of our server components, automates an application’s operation, deployment, and scaling. Think of each server component as an individual that’s part of one giant cluster. When individual components have more work to do, this system will add more replicas, and then remove them when that load is reduced. This way, we can more easily balance load across multiple replicas and provide a constant low-lag gameplay experience. This system also offers the future potential of providing a 24/7 gameplay experience with little to no downtime for maintenance.
Sometimes when launching Dual Universe, some objects can appear muddy or low-quality. This is because the server has to load a large amount of individual voxel data, and imposes a low-poly count LOD. However, what mesh server technology allows us to do is pre-load mesh constructs, which are significantly less taxing and will end up looking much better. No more generic, ugly shapes, and more highly detailed models! In the case of PvP, this will also significantly increase how well collision detection works.
We hope that gives you all a look at some of the new tech optimizations we’re currently working on. Remember that while these are all in the early research and development phase, and may be changed for future releases. As always be sure to follow us on Twitter for more news, and check us out on Instagram for exciting new content.
The Novaquark team