This Week In Veloren 65

9 minute read30 April 2020

Authored by Songtronix

This week, work has been done on Airshipper and wgpu. @AngelOnFira gives us a look at external work on Tarpaulin. We also hear from @Sharp on the progress of LoD, as well as from @zesterer about work on sprite and entity LoD.

- TWiV Editors: Songtronix, Slipped, and AngelOnFira

Contributor Work

Thanks to this week's contributors, @Zesterer, @Pfau, @Slipped, @CapsizeGlimmer, @Songtronix, @xMAC94x, and @Treeco!

@Zesterer has been hard at work with projectile collision fixes, as well as a new level of detail system for entities and terrain sprites. @Capucho has been trudging through lots of work to get wgpu working for different systems in Veloren. They are currently working on the main menu UI, as well as the character menu.

@Songtronix is working through many improvements to Airshipper. The next version will offer macOS builds, as well as stable versions of Veloren rather than just nightly.

Game design met to discuss the schools of magic, possibility of spell crafting, "endless" sky islands and caves for exploration, as well as touch on the goals for the Points of Interest. They also decided to address equipment and crafting during the next meeting.

Tarpaulin and toolchains by @AngelOnFira

Tarpaulin has broken recently on our continuous integration (CI) pipeline. Tarpaulin is used to keep track of "code coverage" on the project. When we run tests, we want to make sure it touches as close to 100% of the code if possible. That way there isn't code that is completely ignored. In practice, we really don't have that much code coverage, but that's not the problem here. Tarpaulin breaking is!

Diagnosing this problem took some work. Although I love working with CI, my Rust skills aren't amazing. And this problem was starting to look more like a Rust one. Luckily, I was able to follow a trail of breadcrumbs through areas that I would normally get stuck.

In our CI, we were getting this error while running Tarpaulin:

[INFO tarpaulin] Creating config
[INFO tarpaulin] Running Tarpaulin
[INFO tarpaulin] Building project
error: toolchain 'nightly-x86_64-unknown-linux-gnu' is not installed
Error: "Failed to report coverage! Error: No coverage results collected."

With my limited knowledge of how Rust toolchains work, I set off to learn more about them. I knew our CI had a version of nightly installed, so I first tried to lock down exactly which version. We use the rust-toolchain version to specify a date of nightly that we want. Since the toolchain would be the same on my local version of Veloren, I could just run rustup toolchain list to see the exact version.

nightly-2020-04-17-x86_64-unknown-linux-gnu

Interesting, it appears that Tarpaulin is ignoring the date. I did some research to find out more about the Rust toolchain specification. Next up was to figure out how Tarpaulin gets the toolchain name.

After cloning the Tarpaulin repo, I didn't really know where to look. I searched for "toolchain", "is not installed", and "nightly". I didn't really know what I was looking at, but I stumbled across this function:

fn create_command(manifest_path: &str, config: &Config, ty: &RunType) -> Command {
let mut test_cmd = Command::new("cargo");
if *ty == RunType::Doctests {
test_cmd.args(&["+nightly", "test"]);
} else {
if let Ok(toolchain) = env::var("RUSTUP_TOOLCHAIN") {
if toolchain.starts_with("nightly") {
test_cmd.arg("+nightly");
} else if toolchain.starts_with("beta") {
test_cmd.arg("+beta");
}
}
...
}
}

There was some stuff in here that looked sort of useful, but it wasn't until I came back to it a few times that I started playing with it. I had to learn how to install a cargo command from a local path, which wasn't too bad: cargo install --path <path>. Then I could debug nice and quickly! I added an info message that would print the toolchain it was getting from the env variable, and low and behold, it was what we wanted!

Next, I changed test_cmd.arg("+nightly"); to be test_cmd.arg("+nightly-2020-04-17-x86_64-unknown-linux-gnu");. Running this fixed the original problem, and the right toolchain was being used. Great success! Now that I had a fix, it's time to get it into Tarpaulin. I swapped out some code to just use the env variable if it was available.

if let Ok(toolchain) = env::var("RUSTUP_TOOLCHAIN") {
test_cmd.arg(format!("+{}", toolchain));
}

As far as I know, this solution should work any case. I'm waiting on it to get merged, but we should be able to patch our CI manually in the meantime. This wasn't that complicated of a problem, but I learned a lot on the way!

Snowram merged in some new animals this week, the ram, snowy owl, hyena and parrot!

LOD and lighting progress from @Sharp

A view of the distance horizon utilizing the level of detail system

The LOD branch has been progressing nicely over the last few weeks. One of the factors increasing the workload involved in it is that an overhaul of the lighting system is being performed with the LOD additions, as the two complement each other well. Proper time-dependent lighting has been implemented, providing a more physically realistic interpretation for the sun's effect on the terrain. Better atmospheric scattering along with point-light dependent HDR is also being worked on to improve the overall look and feel of the lighting throughout the game. After replacing magic constants with derived quantities, most of the current focus is on tweaks to the implementation to work out the exact look we want.

Morning time under a rewritten sun

Another portion of the LOD work was geared towards making the low detail terrain feel more natural. Most of the work there involved manipulating the shaders to create a look with more shadow and texture, with the goal of both improving the aesthetic of the far terrain and blending the LOD better with the nearby voxels. The work is very experimental but promising so far.

Before

After

Finally, the last LOD branch focus this week was on underwater visuals, where Sharp is also implementing a realistic approach. The new handling of lighting provides a very atmospheric environment in the oceans and lakes. One of the main ideas is to filter out wavelengths on the red end of the spectrum faster than green and blue wavelengths, much like in reality. We have a lot of ideas for ocean gameplay and discovery later, so getting this right is important.

test

Treating one block as one meter, reds and browns will quickly fade, and while that might sound like dulling the terrain, the results are quite colorful.

An underwater dungeon entrance

Sprite LOD from @zesterer

This week zesterer added a sprite and figure LOD system, while Pfau built it into the UI to make it configurable in the settings. Working independently from the terrain LOD, this is an important follow-up to the towns addition, because it makes the farms much easier to handle, especially on weaker machines.

a low detail dwarf!

The system applies downsampling to the models we use for sprites and mobs in the world. The number of voxels we have on the screen (specifically voxel faces) all impact how the game is able to perform, and since we can't notice small detail from far away, it makes sense to simplify the visuals at distance. Several levels of LOD now exist in the game, providing just the right detail at incremental distances to aid your performance while maintaining a believable impression of the assets.

Flatpak

As a little side note Veloren will now be packaged as a Flatpak which can be installed with flatpak install flathub net.veloren.veloren to support multiple Linux distributions. Please note that due to our frequency of updates the package might occasionally be outdated. We do our best to ensure the best experience for you all!

It already gets downloaded!

Villager work from @Pfau

Pfau is working towards making the villagers much more interesting by the next update by giving them some personality through clothing and tools. With farms being the defining element of the towns thus far, some farm equipment felt right.

A villager in overalls with a rake

Although the villagers won't have complex activities yet, giving them the appropriate equipment has helped the towns feel much more cohesive and real already. In the works are rakes, shovels, brooms, pickaxes, fishing poles and more for them to carry around.

A wise village elder. See you next week!