As I Was Saying
My Friday blog was cut short due to a little fatigue on my part, but I did have more to say. I resume my monologue in a rare weekend blog post and I want to start with a nice screenshot of what I have been working on in the last 36 hours.
As you can see, I have been working on blending the character shader into the rest of the visual feast. In doing so, I found it convenient to bring in the AI and Character physics module as well, which went in a little too smoothly. It was this lack of pain that caused me to carry on and run out of steam.
I returned to a decent place in the code, and could carry on with the AI some more. Right now the character can initialize and immediately connect with the DarkAI brain that was running in the prototype. Shows my plan to create prototypes that also directly plug into the main engine was the right one.
The new code is not without it's challenges though. The character seems to stretch some internal limbs, hides the in-hand weapon and has a strange glitch which is very subtle to detect, thus fix.
Bring In The Bullet Ray
As these glitches are vague, I thought I would connect the other necessary part of the AI system which is the ability for the player to fire the weapon and have the AI character respond to this impact. This will allow the creation of a video which shows running around a small scene and knocking over characters. Almost there, just a few more lines and tests and it will be in.
As I copy, paste and correct the legacy 'entity hit' code from the classic FPSC, I respect the fact it's quite huge now, and probably not highly optimized. The current code uses an entity loop and checks every entity against a ray from the players gun. A bit crazy really. Not too bad in overall performance, but this idea of an entity loop multiplies out and I cannot shake the idea that there is a better way, something more spacial in nature might be better all round. For now I can keep the current approach, but I will be looking for other options.
I did do a little optimizing though and the main character animation and combat system runs on a smaller loop, only including characters in the level.
You may notice I also worked on the character shader, cleaning up the normal map shader code and more significantly added self-shadowing for them. As character animate 'all the time' the initial shadowing artifacts from the depth camera resolution made the end visual pretty bad. By tweaking an epsilon for shadows close to the casting pixel I made it a little nicer at close range. I still have to do more distant shadow tweaks, but it's a good start I think.
I am just finished off the ability of the editor/engine to allow the test game to kill the characters but restore them when you are back in the editor, and the ability to dive back in and shoot them again. This will allow more testing and start the process of my 'multiple test game' nodes which will allow you to go into the test game as an editing mode. Things you do in first person view can remain in place and saved back in the editor. At one point the characters did just that, but it's not quite right that your well placed level assets start walking off :) Again very pleased the character AI just dropped in, which means I can dive straight into the other million connections required to complete the character system.