Ghetto debugging at it’s finest

Well after two days of bleary eyed `log debugging (because nFringe debugging doesn’t work for the UDK yet, you see), I finally figured out why my custom GetDefaultPlayerClass function was not being called in my custom GameInfo. Basically, the stock Engine.GameInfo class has a variable which is called bDelayedStart, which it defaults to true. I would imagine this has to do with some sort of pre-game lobby functionality, which for my current level of implementation is completely worthless to me.

Simply setting that property to false in my DefaultProperties block fixed the issue and allowed my GameInfo to complete it’s full login process, including creating the player Pawn using the class I return from GetDefaultPlayerClass.

Here’s my new (still not terribly exciting) game info class:

class RTGame extends GameInfo;

function class<Pawn> GetDefaultPlayerClass(Controller c) {
	return class'RpgToolkit.RTPlayerPawn';
}

defaultproperties
{
	bDelayedStart = false
	PlayerControllerClass=class'RpgToolkit.RTPlayerController';
	PlayerReplicationInfoClass=class'RpgToolkit.RTPlayerReplicationInfo';
}

Basically our game still does nothing except spawn a PlayerController and create the appropriate Pawn class. It’s not much, but it’s a step forward.

One other nugget of knowledge I’d like to share before I wrap this post up, is the ability to override engine class functions for the purpose of logging. To come to the conclusion that I did with my last issue, I wrote overrides for many of GameInfo’s functions that simply sent out a log message with some variable values, then called the super implementation. This allowed me to trace the entire player creation process and slowly whittle down what was causing it. It’s not breakpoint debugging, but it gets you by until Pixel Mine does an update for the non-commercial version of nFringe to support the UDK.

For example, here is the PostLogin override I used to determine what was causing my last issue:

event PostLogin( PlayerController NewPlayer ) {
	`log("PostLogin: bDelayedStart = "$bDelayedStart$", bWaitingToStartMatch = "$bWaitingToStartMatch);
	super.PostLogin(NewPlayer);
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: