Thursday 25 February 2010

25 Feb 2010 - Seeing Red - or not...

The successful implementation of the water tower means I am one step closer to having a basic working game. The Trigger volumes used to boost the health are a really simple way to both increase and decrease the health of the player vehicle.

One snag with the default settings in the UDK is that any damage inflicted on the player results in an on-screen alert that appears quite drastic - the screen edges flash red, the player's view shakes and a red 'target' appears in the centre of the screen shoing the direction from where the impact came from.


This would be fine for a game where a player is under attack but I want to use these 'health decrease' volumes regularly along the race track to decrease the health of the player (which is the water level of the vehicle in-game) and a constant red flashing on-screen would suggest to a player that they are doing something wrong. This is not something I want to be happening during the game as it is misleading and frustrating from a player's perspective, even if the game is simply a demonstration. There is no excuse for confusing a player in a game.


The red damage effect is part of the game's Heads-up-Display (HUD) and with the help of some more of the UDK forum members, I was able to find the script that deals with this red damage indication - which is in the UTHUD.uc script file. Seems pretty obvious now, but it still took me a lot of time to figure it out!

By 'commenting out' the body of the DisplayHit function using *// in front of the lines of code (UTScript differs slightly from standard languages such as C++) it becomes a useless piece of script that has no impact on the game. The reason for making a blank function and not getting rid of the entire code is that other seperate Unreal scripts in the UDK refer to the DisplayHit function and deleting it entirely causes compiling errors and game crashes later on.

Here is the result of removing the code when passing through the 'health decrease' water tower:


Once again, quite a bit of effort to see nothing at all. Still, it's what I want, so it's all good!