Commit 800e085

While we have a new artist working on concept and new tile work, we have continued working on development. As the artist works on tiles, we want to work hard on supporting technology that will give the levels unique ambiance and depth.

First of all, levels in BattleCrypt are created with a program called Tiled. Tiled is excellent at creating layered, tile-based levels. But it’s not really a full-fledged level editor. So you have to establish conventions around how to create elements in Tiled that turn into real game entities when the level is loaded. Things like particle effects, player spawners, liquid areas, collision and more. FlatRedBall has plugins to load .tmx (Tiled format) files and a few basic conventions, then I have a stack of additional ones built on top of that. I have been working on making those more friendly and less-buggy to ease the artist workflow.

Second, I’ve been really interested in learning a little about post processing and how shaders work. I doubt realtime lighting can exist in BattleCrypt due to time and skill constraints! That being said, I would like to explore options for faking certain aspects of lighting, water effects and bloom.

The first problem to solve was setting up render targets and rendering the scene to a temporary texture instead of the screen buffer. I started with abstracting shader loading and render targets into some interfaces so it was easy to stack one-or-multiple effects. Then, I wrote a desaturation shader because it was one of the simplest things to figure out.

first-effect

Shader loading and a basic desat shader applied.

Next was starting to work towards Bloom filter. Bloom is actually several effects: a huge contrast increase (called an extract), a Gaussian blur, and then an additive blend back with the main scene. What this does is makes the brights brighter and gives them a blurred glow that simulates the gleam of lighting. The Gaussian blur was a bit challenging, me not being the mathematically-skilled type. The blur itself is actually two passes, one for horizontal blur and one for vertical. Once I sorted that out and debugged all the little quirks, the extract and add were fairly simple. Here’s what each pass looks like (click for larger):

bloom-blur

A gaussian blur effect applied to the scene.

bloom-extract

An extract effect, basically just a strong contrast increase.

bloom-extract-blur

Blur and extract both applied, this is ready to additive blend with the main screen buffer.

bloom-comparison

Before/After the final product. Notice that the bloom has lightened the entire scene. This is a pretty liberal application of bloom and probably not what the final product would look like.

Categories: BattleCryptGameDev

Leave a Reply

Your email address will not be published. Required fields are marked *