(Fake) Indirect Illumination

Over the past couple of weeks I’ve been working on a new graphical feature: some sort of fake, mostly physically incorrect, but (hopefully) ambience-enhancing, indirect illumination.
For this I’m mixing in 2 approaches at indirect illumination. The first one is the well known Color Bleeding, a SSAO of sorts acts at at neighboring pixels with semi-facing normals, but spreads colors at those areas instead of just darkening them.
This Color Bleeding approach was the most challenging one because UDK does not offer a Normal Scene Buffer, so I had to reconstruct it from the Depth Buffer.
The second approach was an idea of my own, which involves creating a special camera that saves the scene to a RenderTarget, except it does it from a top-down view and with enough clipping to not capture anything above the player. Then a PointLight is created below the player, and it projects that captured scene upwards mapped to match the scene. Graphically the result is that any colors below the player will be projected back upwards, giving the effect that the light is rebounding with the colors from the objects in the ground.
Then the same thing happens but upside down so that I also project down anything above the player, this time without clipping so that even the sky will be projected back downwards.

But talk without pics is usually a waste of time so here is one. Left is with my cheap fake Indirect Illumination enabled (notice the big blue ball’s colors are projected upwards to the player).

Indirect Illumination Test

 

 

 

 

 

 

 

 

 

Of course the effect here is quite visible because there’s a big blue ball below the player, but in a regular outdoor environment (with all terrain, rocks and trees) the effect is quite subtle. I figure the effect will show its best in indoor and/or night scenes where there is much more contrast between lit and unlit parts.

And as with anything at first, it needs optimizing. Specially the Color Bleeding part which cuts down performance by ~20%.

 

Edit: Ok I’m adding a better comparison picture:

 

 

 

 

 

 

 

 

 

 

 

HitMask Blood

I finally got around to use the HitMask feature on UDK uniquely on each of the character’s body parts (by making every body part a unique Actor attached to the Pawn), which has allowed me to make the game “paint” a mask where fighting hits are detected, so it serves as a mask to display blood at the precise place a character was hit.

To fully show the effect I used a Bow to shoot an enemy. Here’s how the poor guy ended up:

ehitmasks

Too much baggage!

For a while now I’ve been working on the game’s inventory. Having persistent characters made this an important feature to have and now was a good time to implement it.

The menu isn’t polished: it needs some icon indicators to make up what each item stat is, and the word ‘Inventory’ at the top and the box it’s in might just go away to make more room. In theory there should also be tabs to separate the different item types, but Aiove Defense will only be about collecting/replacing weapons and armor so that won’t be needed. The inventory menu should also be to the most left position but my game is in WideScreen and my Scaleform scene isn’t, and I haven’t implemented a fix for that yet,
I’ll also want a special camera that focuses on the character and allows the user to rotate it (rotate the camera itself, not the character. putting a 3D Character on top of a Scaleform Menu is a pain I don’t need to go through), which is kinda there now but I need it to be offset so that the character rests on the space to the right.

Still, it works. Pressing the “I” key opens/closes this screen which refreshes the list with items currently in the inventory, displays its name and stats (weight / quality which is weapon damage, armor rating, etc / durability / money value – though there won’t be shops in Aiove Defense, it’s just there as information).
Clicking items will equip/unequip items, if you try to equip an item that can go into different slots (ie. a Sword can go into the right or left hand, in the main or the alternate weapons set), a small popup menu will appear asking where you want to equip it.
Depending on the item type, a generic icon is displayed to the left. It’s generic because I won’t be spending time in creating unique icons for each item, there’s already enough work in making the 3D models which are visible in the character anyway, and the icon is so small it wouldn’t make much difference.
Below it all, the total weight is calculated. In the future it will tell the total weight of the equipment and the maximum allowed weight. Exceeding the maximum weight will cause severe penalties like barely being able to move. However even below the maximum allowed weight there will be smaller penalties like slightly reduced movement speed, etc. A mule player will certainly be slower than one carrying just his equipment.

Anyway here it is.

 

 

 

 

 

 

View full article »

Tutorial: How to re-bind keys in-game

I’m working on a menu that will allow the player to re-bind the game actions to different keys. Before the menu comes though, there’s some stuff needed to make it work: being able to re-bind a game action to a different key.

As you probably know the keybinds are found in UDKGame/Config/UDKInput.ini. If you press a key it goes and tries to find the apropriate function in the PlayerController class, and then on his owned Pawn class. However you might not know that before looking in the PlayerController class, it looks in the Input class. To keep things clean then, we’ll implement this functionality in the Input class.

View full article »

Character Progression: Strength

While lately I’ve been mostly working on character blood and gore, I took a small pause for the last few days to add a new feature regarding character progression. Now the character’s strength is represented graphically in its model, but instead of trying to describe it I’ll let the image do the talking. Remember these are just the two extremes between an interpolation, so any intermediate values exist from a smooth transition.

 

 

 

 

 

 

 

 

The implementation’s theory is quite easy here. According to the Pawn’s Strength variable I change a material parameter’s value that LinearInterpolates between 2 NormalMaps: a ‘Strong’ and a ‘Weak’ one.
The same Strength variable also blends in a MassBoneScaling SkelControl that I created inside the character’s AnimTree. It’s a shame that the bone scales can’t be controlled non-uniformly with different values along X, Y and Z, but at least the results using a uniform scale were good enough to make the character look more chunky without looking weird.

Improved hit detection

For a while I’ve been meaning to improve the hit detection system used in melee fights. Today I was inspired by this video and decided it was a good time to get my hands on it.

The old system is what people in the UDK forums usually do or suggest: To detect a melee hit run a trace from the weapon’s hilt to the tip every frame while an attack animation is playing. This solution presents a number of problems, the most important one about its accuracy.

View full article »

Dual Wielding

Here’s a new video showing the dual wielding system. The two swords are actually different weapons, they just use the same meshes.

You can also see how item dropping looks like (with physics), and picking up items and equipping them in action (notice the scabbards being equipped/unequipped too)

New Effect

As of late I’ve been working further in the Character Customization menu as well as the game menu all around.

While I finish that I took a little break to implement a new screen effect based on health. It’s a mix of tunnel vision and the screen going red specially at the edges.

Here’s what it looks like:

Low Health Effects

Character customization is fun

More work of the character system in the menu. This time I present the character customization menu, which now also shows a better menu level: the gameplay level itself. Since Elium: Aiove Defense will most likely only feature a single level I guess it makes sense to use it in the menu too.

Update: I created the rest of the stuff I needed so now all of the values update and change accordingly. I ended up using a color picker a custom palette to avoid having all sorts of weird colors, since this is a medieval/low-fantasy game where dying clothes isn’t supposed to be easy. Here the clothing color palette is visible, but a different one is used for the hair colors (where colors from blonde to redhead and brunette are available) and another one for the belt and boots (representing leather colors).

Character Creation Menu

 

The actual Character Menu

With saving and loading characters semi-implemented and now actually equipping the weapons that were only dummies in the regular Sapitu save/load system, I went ahead and created the code and scripts to have a character creation menu inside the game menu interface.

The menu art is all placeholders but the idea of having the menu with a simple level where to put a character is there. The code also makes it so that just by clicking on the different names on the character list, the corresponding Pawn will be loaded and shown.