The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall

User:Rejecht

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 18:10, 26 February 2012 by Rejecht (Talk | contribs)

Jump to: navigation, search

About

Haphazard hobbyist programming sessions.

Nice to know

  • NumLives is not the number of lives. NumLives is the number of deaths (the number of lives used).
  • Errors found in Unreal Engine 2.5 may also be present in the UDK.

Game mechanical errors discovered in Unreal Tournament 2004

Players who are out can sometimes respawn

Triggers for this error:

  • It must be a TeamGame.
  • (MaxLives > 0) - Assume that this example has (MaxLives == 1)
  • TeamGame.ScoreKill has the errors.

Consequences:

  • The player can respawn despite having died the allotted MaxLives.

Cause:

  • The ScoreKill logic in TeamGame does not always call Super.ScoreKill, which is the one handling the NumLives count and sets bOutofLives accordingly.

First attempt:

  • OK, so let's just override ScoreKill and increment NumLives ourselves, before or after calling ScoreKill!

First consequence of the first attempt: While this solved the original problem, it also introduced another problem:

  • This triggers LateEntryLives (which defaults to 1), forcing latecomers to become spectators (bOnlySpectator) at login, and some people losing hair because they now have a new unwanted behaviour.

This is because some players now get (NumLives == 2), and others get (NumLives == 1), depending on the circumstances in TeamGame.ScoreKill.

Other possible approaches to solve the first consequence:

  1. Clamp the value in your ScoreKill.
  2. Set LateEntryLives to MAXINT in InitGame to override any ini setting, unless you want to use LateEntryLives.