The technology of Avoyd - voxel editor and multiplayer networked voxel octree game engine using cross platform C++, OpenGL, Runtime Compiled C++ and enkiTS.
Doug Binks - Juliette Foucaut - 25 Feb 2021
Our Avoyd Voxel Editor has come a long way since the last devlog post about it in 2018, and having just released a significant update which enhances the Minecraft import pipeline this seems like as good a time as any to talk about it once again.
Minecraft maps Greenfield city and Cuirassé DSD-401 by MrBatou imported and combined together in Avoyd's Voxel Editor.
As many of you know, in addition to making the Avoyd game free to download, we make the Avoyd Voxel Editor which is bundled with it. As well as being the tool we use to build everything in the game, the editor can import Minecraft maps, MagicalVoxel files, Slab .vox files, heightmaps, and export to Wavefront .obj vertex data (for use as general 3D data in tools like Blender 3D). So it's a usable general voxel tool designed to work with large voxel models/worlds.
In october 2020 we started to see one of our early Minecraft import videos featuring Westeroscraft's King's Landing gain a large (for us) number of views, all down to a Lazy Assassin Youtube video "10 SHOCKING THINGS THAT ARE MADE IN MINECRAFT! 😱😱".
I decided to make an updated video with some new content, and set off to download a new map I'd heard of - Greenfield City - and try it out. This turned out to be in a new Minecraft map format which I didn't support in the enki Minecraft Import library enkiMI, so a small step turned into a journey down a long and winding road. The views along the way were, however, pretty sweet.
Doug Binks - 02 Feb 2020
This tutorial takes a small DirectX11 project, the Dear ImGui Example, and adds Runtime Compiled C++ to it. This enables us to edit the code at runtime and see the results live, without recompiling and restarting the project.
This is a Windows only project but both Dear ImGui and Runtime Compiled C++ are cross platform. Thanks to Jonathan Bleeker and Milviz for funding this tutorial.
Runtime-Compiled C++ (RCC++) is a way to reliably make major changes to C++ code at runtime and see the results immediately. It's aimed at games development but could be useful in any industry where turnaround times are a bottleneck.
RCC++ is primarily designed to shorten iteration times in development - developers can build their project, run it, make changes during runtime and see the results in a few seconds.
Juliette Foucaut - Doug Binks - 21 Jun 2019
The first part of this post describes how we use procedural generation to create environments in our game, Avoyd, out of simple boxes. It is an extension of the 'Boxes in Space' talk Juliette gave at Feral Vector.
The second part shows the trial and error process we went through to create Avoyd's procgen worlds and how we procedurally generate the light and atmosphere.
The third part consists of procedural generation demos, giving complete instructions to create the boxes in space worlds, Menger sponges, trees that avoid obstacles, and how to change the lighting and atmosphere in Avoyd. The worlds created can be saved and used in game.
Juliette Foucaut - 05 Apr 2019
I decided to write this post after reading about a very cool procedural NPC name generator and thinking that it might be of interest to show a much more basic example. This post is intended for people who have never used procedural generation and know very little programming. The examples are written in Python. I'll do my best to keep things simple and introduce the complexities progressively.
The algorithm is basic: names are generated by randomly assembling four syllables. First I'll explain how it's built, then the features I added to it to make sure the names are within an arbitrary size range, and more importantly, unique.
Doug Binks - 31 Oct 2017
It's rare for me to read a blog post and immediatly put the information to use, but this post from Aras Pranckevičius (@aras_p on twitter) Best unknown MSVC flag: d2cgsummary is one. Within a short time I had cut elapsed compile and link times for Runtime Compiled C++ live coding with Visual Studio by 1.5x, and eventually 3x with total compile time (total time for all compile processes in a multithreaded system) down 10x. This post explains how.Adding a new menu item using RCC++ with the changes made to improve compile times. The above video compile time was a little longer than I finally achieved due to FRAPS taking some CPU time.
Doug Binks - 05 Sep 2015
This is the second in a series of articles detailing the inner workings and evolution of the permissively open source multithreading task scheduler enkiTS for C and C++ (including C++ 11). In the first article of this series I covered the external interfaces and their implementation. This post will cover the task threading function, running tasks, and waiting for tasks.
enkiTSExamples - Further enkiTS examples adding profiling instrumentation.
Figure 1: Screenshot of Avoyd being profiled with microprofile and ImGui integration available in enkiTSExamples. Solid bars above named tasks show when threads are active - the wait functionality allows the core to idle or other threads to run.
Doug Binks - 22 Aug 2015 - edited 28 Jun 2019
This is the first in a series of articles detailing the inner workings and evolution of the permissively open source multithreading task scheduler enkiTS for C and C++ (including C++ 11). The interface has evolved somewhat since this article, and whilst I've made minor changes to update it, keeping it fully up to date is difficult, so please check out the full code on github.
enkiTS - Code and basic examples for the task scheduler described this article.
enkiTSExamples - Further enkiTS examples adding profiling instrumentation.
If you're writing a compute intensive programming task on consumer hardware, and you want to use as much of the systems resources as possible, then you'll need to consider multithreading on the CPU. There are a number of ways to approach this, but the current gold standard approach for developers who want both simplicity and control is a task scheduler which can handle data-parallelism (in the games industry a task is often referred to as a job). Task parallelism allows you to run different types of computation at the same time, whilst data-parallelism enables you to run the same computation over a set of data across different threads at the same time. Note that I won't consider Single Instruction Multiple Data (SIMD) parallelism here, but if you're doing computations you probably should. Additionally, I won't cover multithreading methods for handling large latency, such as waiting on hard disk or socket transactions.
enkiTS in our game, Avoyd, being profiled using the microprofile and Dear ImGui integration available in enkiTSExamples. This is an old image of the game and the current codebase uses newer enkiTS API features such as priorities and pinned tasks making for a much more complex task graph.
Doug Binks - 31 Jan 2015
As usual, whilst working on one aspect of Avoyd I hit a hurdle and decided to take a break by tweaking some visuals - specifically looking at the normals for my surfaces. I added a step to generate face normals in the pixel shader using the derivatives of world space position [see: Normals without normals by Angelo Pesce and the Volumes of Fun wiki on Computing Normals], and immediately noticed precision issues when close to the surface. I'll demonstrate the issue and my quick fix which uses eye relative position instead of world space, before explaining what's happening in full.
Figure 1: The image on the left shows the face normals calculated in the pixel shader using the world space position, and on the right we take the eye relative world space position.
Doug Binks - 22 Oct 2014
In this post and video I'm going to cover the recent changes I've made to Avoyd's technology to add shadows, ambient occlusion and procedural texturing. I'll describe simple procedural texturing and its anti-aliasing, along with the use of voxel octree data to generate lighting and ambient occlusion using ray casts and 3D textures in the game Avoyd.
There's a good deal of information on all of these topics online, and they certainly aren't novel additions to a game - however in Avoyd I'm taking a slightly unusual approach so I thought it worth documenting. It's worth checking out the video before reading further.
Doug Binks - 27 Feb 2014 - edited 27 Oct 2014
This post follows on from earlier posts on Octree Streaming. You should be able to read them out of order, but you get cake if you read part 1 first, then parts 2 and 3.
The video showcases three players zooming around at high speed in an environment being streamed from one player's PC to the other two, with the recording being done on one of the clients. This devblog post is about the steps I took to get this working smoothly.
Performance tuning is a large and varied topic, so I'm going to concentrate on one aspect which came up during development of the streaming system - framerate hitch removal. A framerate hitch occurs when one frame takes longer than most of the rest of the frames. To the player it can feel like a sudden start/stop. If frequent, the game takes on the feeling of being played on sandpaper.
Doug Binks - 16 Jan 2014
The post follows on from the earlier post on Octree Streaming. You should be able to read them out of order, but you get cake if you read part 1 first, then part 2.
This tech update video shows off multiple players rapidly and smoothly editing fairly large sections of the environment whilst in edit mode. Materials and rendering are all still simple debug visuals for clarity rather than beauty, but there's still a fair degree of artistic freedom available. It's a real pleasure being able to carve and paint geometry fluidly in a connected online world.
Getting this to work, and work well, took a fair amount of effort and I'll explain some of the technical details here.
Doug Binks - 14 Jan 2014
The post follows on from the earlier post on Octree Streaming. You should be able to read them out of order, but you get cake if you read part 1 first.
Our latest tech update video shows off players moving through the world shortly after joining the game - the video starts only a few seconds after where the last one ends, so about 30 seconds after loading. At this point large sections of the world are still being streamed to clients, but the prioritization of nearby regions ensures detail is present close to the player.
Doug Binks - 12 Jan 2014
The original Avoyd stored the internal voxel representation of its game world as a standard 3D array. At the time this provided a good trade off between performance and memory for the size of levels we required for a multiplayer PvP game with a fully modifiable environment. In the new version we wanted to increase the size of worlds we could handle, whilst maintaining large view distances.
Our second technology update video shows off how the voxel octree streaming gives rapid loading over the internet.
Doug Binks - 05 Dec 2013
I was recently testing my LAN server browser dialogue menu with multiple machines running servers when I encountered an unusual issue. I had two machines, each running a server and a client. On one machine the client could see both servers, but on the other machine only the local server was found. The application had firewall permissions, and since the server was both sending and receiving packets without problem the firewall didn't seem to be the culprit.
Working LAN discovery with two servers running on two different machines. Note the two IP addresses listed for Machine 1.