19. stuck in a cave send help
Hello? Is there someone there? It’s me, AMP. I’m all alone here. They dropped me in a rocky cave and told me I wouldn’t get out until I had decorated all of it with these rocks and roots and other stuff… I think I’m going a little nuts, I’m sure I saw some of those rocks move just now…
The above is pretty much how I view level decoration. In the previous months and weeks, I’ve been decorating the cave rooms of our first biome with loot nodes and clutter. Our pipeline in level design starts with graph paper sketches and greyboxing, then proceeds to modelling the actual walls, floors and ceilings (thanks Tiina!), and then proceeds to decoration, followed by a seemingly endless cycle of testing and tweaking.
I’ve been working on level decoration for a good while now. It means painstakingly placing every root, rock, stalac-thing, barrel and empty bottle using the Unity editor. It also includes placing and carving digging walls, and setting up loot nodes which will spawn enemies and other points of interest into the rooms. If I had to pick my least favourite task in the field of game design, it’d be this – level decoration is slow, very detail oriented and actually kind of lonely work. Of course, it’s also absolutely necessary for the game to work out, no one would enjoy empty caves with no playable content, so someone has to do it.
So far, I’ve gone through the 40ish rooms of the first biome twice, or probably more like three times as it took us a few tries to get the editor tools working right. I start with setting out the mineable walls – our set piece feature is freeform mining, and the digging walls give the rooms their basic shape and setting, so it makes sense to start with them. Putting down these walls consists of setting down mining blocks, deforming them to look a little more natural, and plotting out ore veins inside them.
Once the walls are in place, I tend to go for loot nodes. These are what we use to spawn enemies and other interactable loot objects. They further define the room through it’s playable content, which is obviously super important later on when generating mining runs. I also add water spots at this point, since panning for gold is something you’ll be able to do in our caves.
Once the playable stuff is just about there I start decorating. This is the most tedious part of the process, since every rock, root and crate has to be placed manually into the rooms, preferably in a way that evokes feeling or tells a story. This is the bit that takes the most time, and honestly comes closer to art than science. Luckily, the good people of the internet have invented podcasts to keep me company during such drudgery – hit me up for recommendations if you need them! Most recently I’ve been going on a Bigfoot/paranormal binge.
There will likely be another few rounds of room optimization in our future, once we get the level generation parameters set up and working. It’s been fun to be able to focus on the big picture again while working on those, and I’ll write up a post about the topic later.
Until then, don’t forget to say a silent thank you to all of the level designers and decorators who populate your virtual spaces! It’s boring work, but somebody has to do it.
Random development quote: “Tehdään vain 10v vanhoja meemejä peliin. Hello, kids! I can haz cheezburger?“
This week our guest writer is Justus, our code guru and shader wizard. Take it away Justus!
Why bother making cool shaders? Why don’t you just go crazy with post-processing like everyone else?
Because we can’t. With Cave Digger 2 our first target platform is Oculus Quest. Quest is a standalone mobile device, and as such, it uses a rendering type called Tiled Rendering, which is really efficient for most rendering, but causes full screen effects like post-processing to be really slow. These effects will add significant fill-rate overhead and should almost always be avoided. Find out more about how Quest does Tiled Rendering here.
So in order to make fancy looking effects like custom fog, color grading or bloom, while maintaining stable 72 fps on Oculus Quest, we have to make the effects with shaders and particle effects.
But shaders are hard to make 🙁
It’s true that writing shaders can be annoying even if you’re an experience programmer. Cg/HLSL syntax is different from most programming languages. However there is a easier way. The trick is to use a node based editor like Amplify Shader or Shader Graph. You can find plenty of helpful guides and tutorials online. Also Amplify Shader has lots of good example shaders for you to learn from. This allows you to make shaders much faster, however the catch is that the shaders might not be as optimized as they would be if programmed by an experienced graphics programmer
Amplify Shader view of CD2 Gem shader. Cel Shaded lighting and Custom Fog are is done in a custom functions, which makes them more easy to reuse.
So what does it do?
*Slaps the roof of Cave Digger 2 Lit shader*
This bad boy has a custom fog that uses a cubemap for color. It uses a cell shaded lighting that’s similar to Breath of the Wild. It can do triplanar texturing and stochastic texturing.
Also we have a custom Gem Shader for making those loots look shiny and tasty.
How to make it work
To handle controlling the shader settings I created a scriptable object called Atmosphere and also created Atmosphere Manager to manage them
A scriptable object helps to quickly make different atmospheres for different areas. It currently controls the ambient lighting color and fog density.