Sunday, 9 May 2010

9 May 2010 - Replay Value

Another big issue has been solved with a straightforward solution - which is more than welcome at this late stage of the project.

There are ways for the player to destroy the vehicle during the game. Should the player end up destroying their car through lack of water or falling off a hazard, they need to be put back to the start so they can try again. I got this this to work when the level started up but if the player destroyed their vehicle in-game, it would place the player at the start of the level as desired... but out of the car. This breaks the gameplay because at no point in-game should the player be able to leave the vehicle.

I think I overcomplicated the issue by assuming it was something code related and fully failed to check something that I have used before that was right under my nose. I suspected Kismet would have the answer, but I overlooked something so basic I can't believe it's taken this long to try out.

Every Action / Event in Kismet has a set of properties. These properties can be adjusted to alter the performance of the event being defined. So, the player is placed in the car, but this only works once. The solution? Look for the Max Trigger Count of the event, and change the value to zero.

If the value is 1, the Event will happen once, if it is set to 2, the event will happen twice, and so forth. But if it is set to zero, it will happen an infinate number of times, allowing the player to reappear in the car after destroying themselves for as long as they keep playing the game. This is EXACTLY how passing under the water towers and getting them to 'fill up' the car works.

Setting the Max Trigger Count of this Event/Action to zero was the solution to the problem

I can see how this could be used and adapted to create a 'lives' system limiting the player to a certain number of attempts to play the game. I have no plans to implement a lives system but it is a thought - especially if I want people to be able to play the game at the end of year show.

Once the player was able to respawn into a vehicle, the only thing left was to tell the game to instantly create a new car at the start of the level for the player to be placed into in the event that they destroy themselves. By default there is a delay for this in the UDK of about 30 seconds. As I don't want the player hanging around and waiting, I had to find where to change this.

Changing vehicle respawn time in UTVehicle.uc - Default value is 30

Changing the above float value in UTVehicle.uc speeds up the respawn time. I tried setting this to a value lower than 1.0 so that the car is replaced instantly, but this seems to break the game with no car respawning at all. So, through trial and error, I looked for the lowest value that doesn't do this. 1.5 seems to work and although it is not instant, it seems to give the desired effect. I have been testing this by destroying the car and pressing a button to 'reset' the game as quick as I can but the car always respawns before I reset the player to the start, which is good.

So, another functionality issue has been resolved. If I can find out how to 'fix' the camers to the vehicle i'll have a game that can realistically be played without having to explaint o people how to 'get around' gameplay issues I haven't addressed - which again, for the end of year show, would be fantastic.

No comments:

Post a Comment