With the March Alpha, we plan to reach another big milestone: multiple avatars. This means that you will be able to choose your in-game looks. So why is this a milestone?
Integrating multiple (as opposed to a single one, which was difficult enough, thank you!) avatars into SpellShokked was (and still is) difficult for a number of reasons:
First, there’s the inverse kinetics that need to be overlaid onto the model’s skeleton to make it move naturally. While ‘inverse kinetics’ already sounds scary, it’s even worse in real life. The problem we need to solve is this: We have three fixed points in space that all face a specific direction: the HMD (head) and two controllers (left and right hand). We now need to position and animate a virtual skeleton in a way that it exactly fits the three points, plants the feet on the floor, and looks natural (i.e. bends the knees into the correct direction). Once that is done, we’ll have to wrap the skin around the skeleton that builds the model. Since all our models are slightly different in size and configuration (they all have different skeletons, and one even floats above ground), bringing a single new avatar to SpellShokked requires multiple steps
… with the last two points bringing us to another obstacle: how do we make avatars accessible to players? At first, we thought that was easy: we created a brand new room you can go to, and choose your new looks. You can do that any time you are not in a duel. Initially, creating the room was quick (any yet our artist has outdone himself with a breathtaking arrangement of fog, flames, ivy and some rocks. No, really – It looks great!). But then we hit another problem: since you are the Avatar, you can’t see how you look – unless we provide you with… a mirror! [cue crash cymbal followed by scary music]
Now, this might sound silly at first, since mirrors are common in the real world. But in computer games, mirrors pose a Big Problems – capital “B” and “P”. Do you recall a video game that provides functioning mirrors? There are some games that can do this (Life is strange 2 has some scenes that feature a working mirror. There was at least one level in Duke Nukem 3D that had a working mirror). Most games, however, employ tricks that make it seem as if you are seeing reflections (water, glass), but in reality the game places a pre-rendered static image onto a surface to create a reflective effect that doesn’t really reflect anything at all. This can look very convincing – until you move close to the surface and realize that it doesn’t reflect dynamic (moving) scene elements like the player (in Watchdogs 2 there are office building with highly reflective doors. When you approach the door, you’ll notice that it does not reflect the player). Thus, in most games, mirrors are either cracked, broken, or so dirty that they don’t work anymore (see Fallout 4 where all mirrors are blind, or Far Cry 5, where the mirrors (e.g. rearview mirrors) show some weird texture, but not the player. Both games have great-looking water puddles that reflect the scenery; walking over them you’ll find they never reflect you. This is especially noticeable in in Fallout 4 VR, one of the greatest VR games available right now – if it wasn’t for the controls).
The reason for this is how current-generation game engines work: objects that are close to the eye occlude those that are further away. Technically, reflected objects in a mirror are – due to their reflection – behind the mirror (further away). This messes with the game engine’s depth buffer. Worse, mirrors also screw up the coordinate system of the reflected image (a mirror inverts the directions of the X-axis and Z-axis, but leaves Y as is. Stand in front of a mirror, and raise your left arm. Your mirror image raises it’s right arm if it was a real-world person. Move closer to the mirror, and the image also moves close, decreasing the distance twice as fast as you are moving towards the mirror). If you move from left to right in front of a mirror, the reflected scenery objects move from right to left. A GPU using z-buffering and the painter’s algorithm (almost all of them do) will always have problems with mirrors, and these problems are very costly (in performance terms) to overcome.
Next generation game engines that can use more general rendering algorithms based on ‘raytracing’ (as opposed to raster-based z-buffering) don’t have this problem, and these can render reflections and mirrors just fine. But raytracing requires almost an order of magnitude more performance to render a scene that essentially looks the same as a classic render – minus true mirroring, some refractions and slightly more realistic shadows, which are all side-shows in current games. That’s why it’s not a given that raytracing will make it to mainstream anytime soon – Nvidia’s RTX cards notwithstanding.
Anyway – here we are, sitting in our beautiful new avatar scene and need a mirror to check out our slaying lewks. We know that it’s not impossible, but expensive and difficult to create working mirrors in a computer game – so naturally, we decide to give it a try.
We wrote a couple of shaders (little render engines) with increasingly convincing, but still insufficient, results. Until we realized that SpellShokked’s mirrors can be tweaked to the scene since we control what’s in there – we can place and orient mirrors carefully vis-à-vis the VR rig so that they never overlap, and show only what we want to. This simplifies the problem. We scrapped the shaders we already had, and wrote new, highly performant shaders to reflect the scene from a point exactly opposite to a plane where the player stands. This kind-of-worked, but synchronizing issues and capturing all post-processing effects (fog, fire in the background, god rays) provided too much of a headache.
So we returned to an idea we investigated at the very beginning, but dismissed due to performance concerns: multiple cameras. Long story short: we now have deployed a number of functioning, good looking mirrors in some scenes. Yes, they are camera-based, yes they consume a lot of performance, and no, they aren’t true mirrors. But in conjunction with a (mostly) fixed head location, and some added pseudo-real-time reflections onto the glass above the mirror, they do look great. Most importantly: they fulfill their goal of giving you a good idea of how your avatar looks when you wear it.
With that squared away, we are now facing another obstacle that we have been working on for a while: integrating the avatars with network play. Because – making an avatar work with a VR rig is challenging. Making the same system work with two independent rigs, one of which is remote-controlled is double the fun. Right now, our system is working reliably for the solo levels, and we are hard at work getting the networked avatars talking to each other.
Ah, sorry, rambling again.
Anyway.
The next release will probably feature:
In coming releases, we might add, change, and/or remove these avatars. Specifically, we are currently tracking some issues with the way some of them move, and we need to tweak their individual solvers. If you are large in real-life (190 cm /6’3″ or more), your avatar may look somewhat strange when you move, and foot placement is awkward. Likewise, should you be sitting in chair whilst playing, your avatar may assume a number of unflattering poses. We are working on that. We are also looking into different items and clothing, but currently we are limited by both time and budget for these.
So, look forward to the coming release in about two weeks.