UT3 Development Notes

From Gneu.org

Jump to: navigation, search
Ut3-logo.jpg

UT3 Development Links

Below you will find a not quite so comprehensive listing of the notes i have accumulated for developing in UT3. It is bound to update as time goes on and may eventually spur off discussion or tutorials, and be dropped or moved to other pages. I will do my best to keep a listing of such topics at the end of this document.

Contents

Overall Suggestions

Useful Logs

`log( "Something" @ WorldInfo.NetMode, , 'LinePrefix' );
LinePrefix: Something (NM_Client|NM_DedicatedServer|NM_StandAlone)
`log( "Something", 1 > 0, 'LinePrefix');
This is only printed if 1 > 0

Mutators

Replication


Server Priority Client Priority
replication
{
    if( Role == ROLE_Authority )
        iMaxNumJumps, iMaxJumpBoost;
}
replication
{
    if( Role < ROLE_Authority )
        iMaxNumJumps, iMaxJumpBoost;
}

Info Classes

Attaching the info class to a client
function NotifyLogin(Controller NewPlayer)
{
	local Info_JumpMod A;

	if( UTPlayerController( NewPlayer ) != None )
	{
		A = Spawn( Class'Info_JumpMod', NewPlayer );
		A.riMaxNumJumps 	= iMaxNumJumps;
		A.riMaxJumpBoost 	= iMaxJumpBoost;
	}

	Super.NotifyLogin(NewPlayer);
}


Using the ReplicatedEvent to keep track of variable transmission and update the client.
var repnotify int riMaxNumJumps;
var repnotify int riMaxJumpBoost;
var repnotify UTPawn rPlayerPawn;

Replication
{
    if(bNetDirty && (Role == ROLE_Authority))
    	riMaxNumJumps, riMaxJumpBoost, rPlayerPawn;
}

simulated event ReplicatedEvent(name VarName)
{
    if (rPlayerPawn != None)
    {
	rPlayerPawn.MaxMultiJump = riMaxNumJumps;
	rPlayerPawn.MultiJumpBoost = (riMaxJumpBoost * 40);
	rPlayerPawn.MultiJumpRemaining = riMaxNumJumps;
    }

    Super.ReplicatedEvent(VarName);
}

UIScenes

UT3 takes a new approach to GUI development. It is now necessary to add a UIScene to your mutators in order to provide things like the CDKey entry page, Preferences and Mutator Configuration menus.

States

       class SuperWeapon extends Weapon;
       state WeaponFiring extends Active
       {
        Begin:
                `DebugMessage( "Hello World from WeaponFiring within SuperWeapon" );
       }


       class SuperDUPERWeapon extends SuperWeapon;
       state WeaponFiring
       {
        Begin:
               `DebugMessage( "Hello World from WeaponFiring within SuperDUPERWeapon" );
       }

Finding the local player

There is a class titled LocalPlayer. Additionally, line 1690 of Actor.uc:

/**
iterator LocalPlayerControllers()
returns all locally rendered/controlled player controllers (typically 1 per client, unless split screen)
*/
native final iterator function LocalPlayerControllers(class<PlayerController> BaseClass, out PlayerController PC);

Using it will return all local players. Go me.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox