1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

UE3 - UT3 Pawn.AirControl not getting replicated

Discussion in 'Programming' started by DannyMeister, Dec 29, 2011.

  1. DannyMeister

    DannyMeister UT3 Jailbreak Coder

    Joined:
    Dec 11, 2002
    Messages:
    1,270
    Likes Received:
    0
    Based on the replication block in Pawn.uc, any changes to AirControl will be replicated to the owning client.

    Code:
    // variables sent to owning client
    if ( bNetDirty && bNetOwner && Role==ROLE_Authority )
    	InvManager, Controller, GroundSpeed, WaterSpeed, AirSpeed, AccelRate, JumpZ, AirControl;
    However, AirControl never gets updated for the client in the following code called on the server. The result is a very jittery experience as the client updates its position in the air based on user input and then gets corrected by the server.

    Code:
    function PerformSpecialHandicap()
    {
    	local UTPawn P;
    
    	if(HandicappedPlayer != none)
    	{
    		P = UTPawn(HandicappedPlayer.Pawn);
    		if(P != none)
    		{
    			P.AirControl = 0;
    			P.DefaultAirControl = 0;
    		}
    	}
    }
    By adding a call to the following function after setting the AirControl to 0 above, I can get rid of the jittery effect, but this seems unnecessary.

    Code:
    // this shouldn't be necessary! AirControl is supposed to be replicated to owning client.
    simulated unreliable client function ClientRemoveAirControl()
    {
    	local UTPlayerController O;
    	local UTPawn P;
    
    	O = UTPlayerController(Owner);
    	if(O!=none)
    	{
    		P = UTPawn(O.Pawn);
    		if(P!=none)
    		{
    			P.AirControl = 0;
    			P.DefaultAirControl = 0;
    		}
    	}
    }
    Anyone have any ideas? Thanks.
     
  2. Wormbo

    Wormbo Administrator Staff Member

    Joined:
    Jun 4, 2001
    Messages:
    5,911
    Likes Received:
    35
    The thing with the replication block is, that it only tells that something is supposed to be replicated, but not when. Try forcing an immediate update by setting bForceNetUpdate=true when modifying AirControl.
    Then again, DefaultAirControl is not replicated at all and ifs used to reset AirControl after landing. So if you want to permanently change the (default) AirControl, you have no other choice than replicating a function call or using an additional (repnotify) variable.
     
  3. DannyMeister

    DannyMeister UT3 Jailbreak Coder

    Joined:
    Dec 11, 2002
    Messages:
    1,270
    Likes Received:
    0
    Sorry, I forgot to mention that I had already tried to use bForceNetUpdate=true to no avail. I could run around for10 minutes after AirControl was set to 0 and it never replicated. This was quite surprising to me.
    Fortunately DefaultAirControl isn't really needed in this case as I believe it only really used for resetting air control on the server anyways (at least according to the initial glance I gave it. )
     

Share This Page