Results 1 to 29 of 29
  1. #1
    MSgt. Shooter Person
    Join Date
    Nov 2007
    Posts
    60

    Default UTPawn Animation Bug?

    So I'm really trying to convince myself I'm crazy, but this looks like a bug to me in UTPawn:

    Code:
    reliable server function ServerPlayAnim( name AnimName, bool bLooping )
    {
      AnimRepInfo.AnimName = AnimName;
      AnimRepInfo.bLooping = bLooping;
      AnimRepInfo.bNewData = !EmoteRepInfo.bNewData;
      DoPlayAnim( AnimRepInfo );
    }
     
    reliable server function DoPlayAnim( PlayAnimInfo TheAnimRepInfo )
    {
      if( FullBodyAnimSlot != None )
      {
        FullBodyAnimSlot.PlayCustomAnim( TheAnimRepInfo.AnimName, 1.0, 0.2, 0.2, TheAnimRepInfo.bLooping, TRUE );
      }
    }
     
    simulated event ReplicatedEvent(name VarName)
    {
      ...
      else if (VarName == 'AnimRepInfo')
      {
        DoPlayAnim( AnimRepInfo );
      }
      ...
    }
    So the play animation goes to the server, sets up a variable to replicate to the clients, and then the clients all call back to the server to actually play the animation? (Never mind that AnimReplInfo is marked repnotify and isn't even in the replication block to be replicated, but even if you replicated it yourself, these functions are broken it seems.)

    I can only guess about this code. It isn't used anywhere it seems and might have been a stub for allowing modders to play custom animations if it worked correctly. I've worked around it by making my own AnimReplInfo that plays the animations clientside.

    I'm just curious if anyone else has ran into this issue and if there's another way we're supposed to be replicating custom animations?
    UT3 Invasion: Try it out by press F10 in game and typing 'open dragon.boldlygoingnowhere.org'

  2. #2
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    I was noticing that DoPlayAnim() doesn't work in net games.. I take it from this post, that this ServerPlayAnim() does not work properly?

    Anyone else know if there's some way to get things to play custom animations from code, that is net-conscious? Or should it all just be done somehow or other in the AnimTree?

  3. #3
    Redeemer
    Join Date
    Nov 2007
    Posts
    1,207

    Default

    Look at how emotes/taunts work (PerformEmoteCommand(), PerformEmoteCommand(), ServerPlayEmote(), PlayEmote() functions in UTPawn).

    In my mod I implemented net-functional custom animations based on that system, although I did make them part of the animation tree as well by implementing some custom AnimTree nodes.
    Last edited by immortius; 05-21-2008 at 05:33 PM.
    Nightblade, a stealth based total conversion for UT3

  4. #4
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    Hmm. PerformEmoteCommand() looks useless, as it just tells the bots to do something depending on what emote was asked for. ServerPlayEmote/PlayEmote would require custom FamilyInfo, apparently, which is not available.

    Any other facilities here? Looks like there's a ton of facilities that might potentially do this kind of stuff, but, do any of them work?

  5. #5
    Redeemer
    Join Date
    Nov 2007
    Posts
    1,207

    Default

    Well, I didn't use the functions, I copied the structure to make my own system.
    Nightblade, a stealth based total conversion for UT3

  6. #6
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    Well, ServerPlayAnim definitely does not work. Would it be 'correct' to fix that by overriding ReplicatedEvent() to call a simulated function to play the anim, rather than a server function to play it?

    edit: hmm. that doesn't seem to fix it either. meh.
    Last edited by Blade[UG]; 05-22-2008 at 06:57 AM.

  7. #7
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    alright, I must be retarded or something, or maybe my 4 months of doing almost 0 coding caused me to forget everything.. but, i can not get this to work.

    I just need a specific animation to play when a pawn fires a weapon. This should be ridiculously easy, but for some reason I'm not getting it.

  8. #8

    Default

    Have you figured out where its breaking down? Perhaps you can subclass UTPawn and add some debugging LogInternal() calls to see where the chain of functions is breaking down.

    Not saying you haven't tried this, but just curious what you might have found.

  9. #9
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    Well, I have it working in single player.

    In multiplayer, I have it set a replicated name variable with the name of the animation to play. ReplicatedEvent picks up the change, and then calls the same function that plays teh animation in single player. It all seems to be working, but the animation is just plain not playing on clients.

  10. #10
    Redeemer
    Join Date
    Nov 2007
    Posts
    1,207

    Default

    Is the function it is calling marked as simulated (doesn't matter for the owning player, but does for everyone else).
    Nightblade, a stealth based total conversion for UT3

  11. #11
    Veteran
    Join Date
    May 2007
    Location
    Above KillZ, Below StallZ
    Posts
    9,953

    Default

    Yeah, all functions involved are simulated .

    The point of failure seems to be directly at:

    FullBodyAnimSlot.PlayCustomAnim( TheAnimRepInfo.AnimName, 1.0, 0.2, 0.2, TheAnimRepInfo.bLooping, true );

    As that code is being executed, it's just not donig anything client side.

    Hmm. Fixed.

    Remember when I said I was retarded?

    Yeah, apparently you can typo in a rep block, and the compiler won't tell you.
    Last edited by Blade[UG]; 06-24-2008 at 10:02 AM.

  12. #12
    MSgt. Shooter Person
    Join Date
    Jun 2008
    Posts
    417

    Default

    I have a problem along these lines. My custom animation plays client-side, but only for the pawn controlled by the player. Any bots that fire the weapon don't show the animation. All involved functions are simulated.

  13. #13
    Redeemer
    Join Date
    Nov 2007
    Posts
    1,207

    Default

    Well, how are replicating the animation to the client? Or is it being played by some action of the player on their end?
    Nightblade, a stealth based total conversion for UT3

  14. #14
    MSgt. Shooter Person
    Join Date
    Jun 2008
    Posts
    417

    Default

    When the player fires their weapon, CustomFire() calls a function similar to PlayEmote on the weapon owner (pawn) that gives the command to play the animation. It looks like this:

    Code:
    //in weapon class:
    simulated function CustomFire()
    {
            ...
            Pawn.PlayWeaponAnim( ThirdFireAnim, false );
            ...
    }
    
    //in pawn class:
    simulated function PlayWeaponAnim( name AnimName, bool bLooping )
    {
    	ServerPlayWeaponAnim( AnimName, bLooping );
    }
    
    reliable server function ServerPlayWeaponAnim( name AnimName, bool bLooping )
    {
    	AR2AnimRepInfo.AnimName = AnimName;
    	AR2AnimRepInfo.bLooping = bLooping;
    	AR2AnimRepInfo.bNewData = !AnimRepInfo.bNewData;
    	
        DoPlayWeaponAnim( AR2AnimRepInfo );
        ClientPlayWeaponAnim ( AR2AnimRepInfo );
    }
    
    reliable client function ClientPlayWeaponAnim (PlayAnimInfo TheAnimRepInfo)
    {
        DoPlayWeaponAnim( TheAnimRepInfo );
    }
    
    simulated function DoPlayWeaponAnim(PlayAnimInfo TheAnimRepInfo)
    {
    	if(Health > 0 && !IsInState('FeigningDeath'))
    	{
    		if(TopHalfAnimSlot != None)
    			TopHalfAnimSlot.PlayCustomAnim( TheAnimRepInfo.AnimName, 1.0, 0.1, 0.1, TheAnimRepInfo.bLooping, TRUE );
    		else if(FullBodyAnimSlot != None)
    			FullBodyAnimSlot.PlayCustomAnim( TheAnimRepInfo.AnimName, 1.0, 0.1, 0.1, TheAnimRepInfo.bLooping, TRUE );
    	}
    }
    AR2AnimRepInfo is in the replication block, but is not repnotify. I tried it with repnotify and had ReplicatedEvent(...) call DoPlayWeaponAnim(...), but then it would only play once on the client-side.
    Last edited by Archasis; 07-05-2008 at 06:43 PM.

  15. #15
    Redeemer
    Join Date
    Nov 2007
    Posts
    1,207

    Default

    Client functions are only sent to the player owning the actor, so that is why that is happening.

    Repnotify should have worked, not sure what went wrong there.
    Nightblade, a stealth based total conversion for UT3

  16. #16
    MSgt. Shooter Person
    Join Date
    Jun 2008
    Posts
    417

    Default

    Thanks, you're right. I found a typo, now Repnotify works... almost. The animation doesn't play every time, only every once in a while. This could be because the weapon fires frequently, so the AnimRepInfo.bNewData switches from true to false to true too quickly and gets lost*. Is there any way around this?

    This was not an issue with emotes because there's a minimum amount of time that must pass between emotes.

    *From UDN's Network Overview: "Variable replication occurs only after a tick completes. Therefore, if in the duration of a tick, a variable changes to a new value, and then it changes back to its original value, then that variable will not be replicated. Thus, clients only hear about the state of the server's Actor's variables after its tick completes; the state of the variables during the tick is invisible to the client."
    Last edited by Archasis; 07-05-2008 at 08:54 PM.

  17. #17
    MSgt. Shooter Person
    Join Date
    Jun 2008
    Posts
    417

    Default

    I noticed that I get this in the log:

    Code:
    UAnimNodeSlot::FindBestChildToPlayAnim - Best Index 1 with a weight of 0.366727, for Anim:...
    Could that be the problem?

  18. #18
    Redeemer
    Join Date
    Nov 2007
    Posts
    1,207

    Default

    To get around the boolean changing too quickly, try using a byte instead and increment it each time the animation is triggered.

    And I believe that error occurs if you try to play the animation when it is already playing. So you could try having the animation's length as time between triggering playing it.

    For various animations I was using I ended up putting them in pawn's animtree with specially coded AnimNodes to trigger the animations which would either restart the animation or swallow up subsequent attempts to play them while they are already in progress.
    Nightblade, a stealth based total conversion for UT3

  19. #19
    MSgt. Shooter Person
    Join Date
    Jun 2008
    Posts
    417

    Default

    Thanks. Are there any resources on coding AnimNodes? It seems like they're all native.

  20. #20
    MSgt. Shooter Person
    Join Date
    Nov 2007
    Posts
    195

    Default

    I've been wondering that myself lately. The player model for my mod does different animations depending on the weapon in use so doing it through UnrealScript isn't really that flexible and requires added code for each new weapon. Having an animnode for it would simplify the matter so much but I've not managed to figure out how to make a my own animnodes as the stock animnodes are almost completely native. Any help would be very appreciated.

  21. #21
    MSgt. Shooter Person
    Join Date
    Jun 2008
    Posts
    417

    Default

    Quote Originally Posted by immortius View Post
    ...try using a byte instead and increment it each time the animation is triggered.
    The byte works perfectly, Thanks!

  22. #22
    Redeemer
    Join Date
    Nov 2007
    Posts
    1,207

    Default

    Quote Originally Posted by Alex D View Post
    I've been wondering that myself lately. The player model for my mod does different animations depending on the weapon in use so doing it through UnrealScript isn't really that flexible and requires added code for each new weapon. Having an animnode for it would simplify the matter so much but I've not managed to figure out how to make a my own animnodes as the stock animnodes are almost completely native. Any help would be very appreciated.
    Let me outline a simple example then. Since it is something I've done before and it is relevant to your interests, a node that has different branches for different weapons, with the active branch determined by the pawn's current weapon.

    Firstly, the node itself:

    Code:
    class MyAnimBlendByWeaponType extends UTAnimBlendBase;
    
    enum MyWeaponAnimType {
    	WAT_None,
    	WAT_Sword,
    	WAT_Mace,
    	WAT_Boomerang,
    	WAT_HandCrossbow,
    	WAT_Crossbow,
    	WAT_Bow,
    	WAT_Musket
    };
    
    var() Array<MyWeaponAnimType> WeaponTypeForSlot;
    
    simulated function SetWeaponAnimType(MyWeaponAnimType weapAnimType) {
    	local int i;
    	for (i = 0; i < WeaponTypeForSlot.length; i++) {
    		if (WeaponTypeForSlot[i] == weapAnimType) {
    			SetActiveChild(i, BlendTime);
    			break;
    		}
    	}
    	if (i >= WeaponTypeForSlot.length) {
    		SetActiveChild(0, BlendTime);
    	}
    }
    
    DefaultProperties
    {
    	Children(0)=(Name="Default")
    	WeaponTypeForSlot(0)=-1
    }
    So this node is a subclass of UTAnimBlendBase, which is a node that can have a number of children, and the active child can be programmatically set. The children can be created and assigned to a weapon type in the AnimTree editor.

    But at this point it doesn't do anything, as nothing will be calling the node to set the weapon type.

    Next I created a pawn subclass like so:
    Code:
    class MyAnimPawn extends UTPawn;
    
    var array<MyAnimBlendByWeaponType> WeaponTypeAnimNodes;
    
    simulated event PostInitAnimTree(SkeletalMeshComponent SkelComp)
    {
    	local MyAnimBlendByWeaponType BlendByWeaponType;
    
    	super.PostInitAnimTree(SkelComp);
    	if (SkelComp == Mesh)
    	{
    		foreach mesh.AllAnimNodes(class'MyAnimBlendByWeaponType', BlendByWeaponType) {
    			WeaponTypeAnimNodes[WeaponTypeAnimNodes.Length] = BlendByWeaponType;
    		}
    	}
    }
    
    simulated function SetWeaponAnimType(MyWeaponAnimType weapAnimType) {
    	local int i;
    
    	for (i = 0; i < WeaponTypeAnimNodes.length; i++) {
    		WeaponTypeAnimNodes[i].SetWeaponAnimType(weapAnimType);
    	}
    }
    In the PostInitAnimTree function I get out a list of all the MyAnimBlendByWeaponType nodes. This means you can have as many as you want in the tree, the code will be able to find and update all of them when the held weapon changes.

    Finally all my Weapons use custom WeaponAttachment classes for the third-person display mesh, which inherit from a UTWeaponAttachment subclass that looks like

    Code:
    class MyWeaponAttachment extends UTWeaponAttachment;
    
    var MyWeaponAnimType WeaponAnimType;
    
    simulated function AttachTo(UTPawn OwnerPawn) {
            local MyAnimPawn AnimPawn;
            
            super.AttachTo(OwnerPawn);
    
            AnimPawn= MyAnimPawn(OwnerPawn);
    	if (AnimPawn != none) {
    		AnimPawn.SetWeaponAnimType(WeaponAnimType);
    	}
    }
    With each subclass setting the WeaponAnimType in its default properties. I set the pawn's weapon type from here because the WeaponAttachment class is already replicated and I can depend on the weapon type always matching the weapon the pawn is displayed as using on the client.

    And that is pretty much that. I have a variety of other custom nodes, but they all work in a similar way - the pawn gets out a list of those nodes and calls a function on them to activate them or change their behaviour when necessary.
    Nightblade, a stealth based total conversion for UT3

  23. #23
    MSgt. Shooter Person
    Join Date
    Nov 2007
    Posts
    195

    Default

    Thanks a lot, dude! That's just the kind of info I was looking for. I'll give it a go when I get a spare moment.

    Thanks again.

  24. #24
    MSgt. Shooter Person
    Join Date
    Aug 2006
    Posts
    296

    Default

    couldn't you just swap out the animation names as they're played in the DoPlayEmote function of UTPawn like epic have already done (check the comment i found )

    Code:
    // HACK! Krall anim spelt wrong :(
    if(FamilyInfo == class'UTFamilyInfo_Krall_Male' && EInfo.EmoteAnim == 'Taunt_UB_ComeHere')
     {
    	EInfo.EmoteAnim = 'Taunt_UB_ComeHear';
     }

  25. #25
    MSgt. Shooter Person
    Join Date
    Jun 2008
    Posts
    417

    Default

    Quote Originally Posted by Bananna_manuk View Post
    couldn't you just swap out the animation names as they're played in the DoPlayEmote function of UTPawn like epic have already done (check the comment i found )

    Code:
    // HACK! Krall anim spelt wrong :(
    if(FamilyInfo == class'UTFamilyInfo_Krall_Male' && EInfo.EmoteAnim == 'Taunt_UB_ComeHere')
     {
    	EInfo.EmoteAnim = 'Taunt_UB_ComeHear';
     }
    That would probably work, but for my purposes, I'd rather integrate it into my code structure rather than hacking old functions... I think it's a control thing .

  26. #26
    MSgt. Shooter Person
    Join Date
    Jun 2008
    Posts
    417

    Default

    Are animations played on the server (ie. emotes)? If not, how can I force them to be?

    I have a weapon attachment that logs its location when doing a custom animation. On the client, it shows the changing position throughout the animation. The server, however, logs a constant location.

  27. #27
    Redeemer
    Join Date
    Nov 2007
    Posts
    1,207

    Default

    Animations can be played on the server. For instance, my mod has footsteps sounds replicated from the server after being generated based on their running animation (replicated to players for which the pawn isn't on their machine and generating footstep sounds clientside anyway).

    However, UT3's emote system specifically doesn't play emote animations on dedicated servers.

    If this is for a gametype or TC then you can override that behaviour in your pawn subclass (copy and fix DoPlayEmote() ). Otherwise you'll need to find some other way to animate the pawn.

    There may be some other properties you need to change to get things working on the server as well.
    Nightblade, a stealth based total conversion for UT3

  28. #28
    MSgt. Shooter Person
    Join Date
    Jun 2008
    Posts
    417

    Default

    Thanks for the quick reply. For my TC, I currently have the functions set up in my pawn subclass as follows:

    Code:
    //for 3rd person weapon animations
    simulated function PlayWeaponAnim( name AnimName, bool bLooping )
    {
    	ServerPlayWeaponAnim( AnimName, bLooping );
    }
    
    reliable server function ServerPlayWeaponAnim( name AnimName, bool bLooping )
    {
    	AR2AnimRepInfo.AnimName = AnimName;
    	AR2AnimRepInfo.bLooping = bLooping;
    	if (AR2AnimRepInfo.PlayIndex < 9)
            AR2AnimRepInfo.PlayIndex++;
    	else AR2AnimRepInfo.PlayIndex = 1;
    
        DoPlayWeaponAnim( AR2AnimRepInfo );
    }
    
    simulated function DoPlayWeaponAnim(AR2PlayAnimInfo TheAnimRepInfo)
    {
    	if(Health > 0 && !IsInState('FeigningDeath'))
    	{
    		if(TopHalfAnimSlot != None)
    			TopHalfAnimSlot.PlayCustomAnim( TheAnimRepInfo.AnimName, 1.0, 0.1, 0.1, TheAnimRepInfo.bLooping, TRUE );
    		else if(FullBodyAnimSlot != None)
    			FullBodyAnimSlot.PlayCustomAnim( TheAnimRepInfo.AnimName, 1.0, 0.1, 0.1, TheAnimRepInfo.bLooping, TRUE );
    	}
    }
    The animation plays correctly for all clients, but isn't playing on the dedicated server. I've tried making ServerPlayWeaponAnim() simulated instead of reliable server, but the result appeared to be identical. Does PlayCustomAnim() in AnimNodeSlot only work on clients?

    AR2AnimRepInfo is in the replication block, is repnotify, which calls DoPlayWeaponAnim() when changed.

    edit: I've also tried monitoring the location of the player's weapon socket, just to make sure the problem isn't with the weapon attachment. Same results.
    Last edited by Archasis; 07-12-2008 at 11:41 AM.

  29. #29
    Redeemer
    Join Date
    Nov 2007
    Posts
    1,207

    Default

    Make sure your pawn has it's skeletal mesh component set to update when not rendered. (Sorry I didn't mention it before, couldn't remember what the setting was called last night)

    Code:
    		bUpdateSkelWhenNotRendered=true
    Nightblade, a stealth based total conversion for UT3


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.