This Week In Veloren 16

6 minute read 20 May 2019

This week, we make a call for testers! We also take a look at some of the work that contributors have been doing. We have updates from @Zesterer, @Slipped, @imbris, @Desttinghim and @Algorhythm.

Thank you to this week's contributors, @Zesterer, @imbris, @Desttinghim, @Slipped, @AngelOnFira, @Pfauenauge, @Cody, and @Qutrin!

Programming

Call for testers

This week is all about one thing: testing! With the 0.2 release just a week away, our main priority is switching from feature addition to bug finding and fixing. This weekend, fixes will be the team's only focus.

If you are willing to help, we would be super grateful! The more people with diverse computer hardware, the better. In the Discord server, feel free to make use of the #testing and #support channels to find out what you can do. Another way to submit issues you find is through the Gitlab issue tracker.

"Your specimen has been processed and we are now ready to begin the test proper."

Chonks by @Zesterer

The storage of world data is currently rather primitive. The terrain exits in large, heap-allocated arrays called "chunks". These had some issues, however.

  1. If a chunk was all the same type of block, it still required a lot of memory to store

  2. Chunks took a long time to generate

  3. We can't represent really tall things in the game without using a lot of memory

To solve all of these issues, I decided to start work on an alternative system to store terrain data. These structures are a combination of "columns" as used in older versions of Minecraft) and 3D "chunks". "Chonks" was the natural combination of these two words.

Chonks work by splitting the world up into square-based columns. Each column has an "offset" value that determines at what altitude its data is intended to represent. After that follows any number of "sub-chunks": cubic chunk-like structures that contain block data. The important thing to realize is that these structures are dynamic, and so will grow only according to the complexity of the information they have to store. Above the sub-chunks, the chonk returns "air" and below the offset, the chonk returns "stone".

Visual representation of Chonks

Sub-chunks also have an additional optimization: homogeneity. Sub-chunks can be represented by a single block if all of their constituent blocks are identical. This ends up being an extremely common thing, with homogeneous blocks making up most underground spaces and virtually all above-ground spaces.

After implementing this system, the game experienced a massive reduction in memory usage, huge improvements in terrain generation performance, significantly lower network bandwidth, faster collision detection, and the ability to create arbitrarily high mountains (the maximum limit is actually only a little under 12x the distance to the moon).

Here, we can see that the new generation system only works to generate what it needs to. This means that worlds will load much faster.

Work by contributors

Animations and pets by @Slipped

First thing I was able to do this week was swapping out the /pet spawn from a duplicate of the player into a pig! Check him out, he's pretty cute. This marks the first quadruped that we've bought into the game, and it's especially nice because it should make bringing in a whole lot of other 4-legged animals much easier since we're going to be able to use its skeleton as an animation template for others. With minor tweaks, we should be able to really amp up the number of mobs. We've rigged up the pig and taught it how to idle, jump and run just like the player does, and he'll follow you around as long as you're in-game.

Second, in a really cool team effort we've managed to get hangliders in this week! Zesterer got some awesome physics completed for it, Pfauenauge created a great model, and I managed to create the new gliding animation. Gliding from mountain to mountain is a ton of fun, so check it out, especially with a group!

Third, the WIP part of my update is combat animation. Timo has nearly gotten the huge attack merge request completed, and that means that we'll soon be able to fight the pigs and other players! Sorting out how to integrate combat animations into the existing skeleton is a bit tricky, I've been exploring the options for the cleanest way to do it that will provide all the options we could need. The goal for 0.2.0 is a simple swing with a 2-handed sword, and I'm hoping I'll have something to show around the middle of this week.

UI interactions by @imbris

We had a lot going on this week as the date for feature freeze is rapidly approaching. This week I added a new widget, the ImageSlider. It is based on conrod's slider widget but uses images instead of just drawing rectangles. Additionally, it can be used to select discrete (ie. integer) values which will be useful in the character selection screen and other menus.

On that note, I worked with @Pfau to create a slider to adjust the volume of the newly added music and lowered the default volume to 50%. Additionally, @Pfau, @Zest, and I added another slider for adjusting the view distance. The currently allowed range is from 1 to 25 chunks with a default of 5. Both these sliders can be found in the settings menu in-game.

In complement to this, I have also added three new buttons for: screenshots (F4), toggling the debug window, which shows fps (F3), and toggling fullscreen (F11). For maximum immersion, you can enable fullscreen and then hide the hud using F2 (perfect for screenshots).

In addition, I fixed the crash that occurred when minimizing the voxygen's window. This was due to a resize event to a size of zero which actually triggers two separate panics.

First, the new pre-processed render target texture was resized to 0 which panics. Second, the camera was assigned NaN for its aspect-ratio. The former was fixed by not resizing the buffer to have dimensions < 1 and the latter was fixed by defaulting to an aspect ratio of 1.0 if the calculated ratio was not normal. Learn more about that here.

You may have also noticed this week that we now have backtraces automatically produced without having to set any environment variables. This was accomplished by using the backtrace crate in our custom panic hook. Finally, I have worked on displaying character's names and health bars via drawing conrod widgets within the 3d world.

Fun with specs!

Audio work by @Desttinghim

This week I worked on implementing the beginnings of the audio layer for Veloren. Right now, the system is only capable of handling music and playing one audio file at a time. Music is selected at random whenever one song ends.

Chunk meshing by @Algorhythm

I re-wrote some of the chunk meshing code to make it more efficient. The previous system re-meshed a lot of chunks several times per tick and cloned mesh data over 1 voxel at a time, which for 34^3 = 39304 voxels per chunk wasn't very efficient. Now the meshing code uses a HashMap to remove duplication and only clones around Arc which is much faster. With @Zesterer's other improvements, chunk meshing is now really fast.

Art

Health bars and name tags

View distance with new changes

Flight!

Interesting terrain generated by cosine interpolation