UScript: Chat, Questions, Discussion

For questions and discussion about UnrealEd, UnrealScript, and other aspects of Unreal Engine design.

Moderators: Semfry, ividyon

[]KAOS[]Casey
Skaarj Berserker
Skaarj Berserker
Posts: 426
Joined: 25 Sep 2008, 07:25

Re: UScript: Chat, Questions, Discussion

Post by []KAOS[]Casey »

Update: Looks like 224v/225f are not effected. 226b {unreal gold} is. Looking like some change that happened in UT, since from what I'm told, UGold is essentially backport of UT. I'll get smirf on the case.
User avatar
Buff Skeleton
>:E
>:E
Posts: 4175
Joined: 15 Dec 2007, 00:46

Re: UScript: Chat, Questions, Discussion

Post by Buff Skeleton »

OK, this is a bit of a tricky netcode thing: anyone got bright ideas on replicating PrePivot to a child actor that exists clientside?

I recently made leglessness handled within EXUKrall instead of having a second class with transferred variables, which was awkward, messy, and buggy. This new mode works great, except for one thing: overlaid effect meshes online.

Example: I have a Krall with glowing eyes. This is accomplished with an effect that inherits the owner's mesh, DrawScale, etc. at spawn, uses PHYS_Trailer, bTrailerSameRotation, bTrailerPrePivot, and bAnimByOwner. It exists clientside since there's no reason for the server to mess with it; it's just a visual overlay on a pawn.

The problem I'm having is that when the Krall gets de-legged, the PrePivot and collision, among other things, are changed accordingly, but the PrePivot is not working for clients; it remains as it was before, so the eye glow overlay gets offset from the mesh.

This is how the PrePivot is scaled based on a pawn's DrawScale to handle large boss-like Krall:

Code: Select all

	SetCollisionSize( CollisionRadius, CollisionHeight * 0.456 );
	PrePivot += vect(0, 0, 25) * DrawScale;

I use this to push the new PrePivot, which works offline, but not online for clients:

Code: Select all

	foreach ChildActors( class'Effects', E )
		if( E.DrawType==DT_Mesh )
			E.PrePivot = PrePivot;
From what I've gathered by logging this whole process, the effect overlay exists clientside, but not serverside; however, the owner is not replicated to the client, so I can't use a simulation hook proxy actor like I have for other things:

Code: Select all

class PrepivotProxy extends EXUClientEffectProxy;

simulated function PostBeginPlay()
{
	local Effects E;

	log(self$" spawned");

	if( Owner==None )
		return;

	foreach ChildActors( class'Effects', E )
	{
		if( E.DrawType==DT_Mesh )
		{
			log(owner$" child actor found: "$E$" with PrePivot "$E.PrePivot$" and Owner.PrePivot is "$Owner.PrePivot);
			E.PrePivot = Owner.PrePivot;
			log(owner$" child actor PrePivot now is "$E.PrePivot);
		}
	}
}
So given that the above doesn't work, and bTrailerPrePivot doesn't seem to apply after PostBeginPlay is called, is there some sort of way I can manually replicate the PrePivot value? Do I need to set a vector and pass that, then set the prepivot in the effect based on the vector, and constantly update it in Tick()? That seems like it could be choppy and would mess up simulated movement physics.

One thing I haven't tried yet is destructing the overlay effect and spawning a new one with the correct PrePivot, but that seems kinda hacky and more like running away from the problem, and I'm not even sure that would work for dynamic PrePivot (i.e. based on DrawScale).

Thoughts?
Image
[]KAOS[]Casey
Skaarj Berserker
Skaarj Berserker
Posts: 426
Joined: 25 Sep 2008, 07:25

Re: UScript: Chat, Questions, Discussion

Post by []KAOS[]Casey »

Completely, 100% untested.

Try

Code: Select all

class PrepivotProxy extends EXUClientEffectProxy;


replication
{
	Reliable if (role==role_authority) //send from server to client
		PrePivotThing;
}

simulated function PrePivotThing(actor A,vector V)
{
        if(A != None)
	          A.PrePivot = V;
        else log("THAT SUCKS");
}

simulated function PostBeginPlay()
{
   local Effects E;

   if( level.netmode == NM_Client || Owner == None)
      return;

   foreach ChildActors( class'Effects', E )
   {
      if( E.DrawType==DT_Mesh )
      {
	       PrePivotThing(E,Owner.PrePivot);
      }
   }
}
Note: vector replication is compressed so uh... it might not work 100% correctly.
User avatar
Buff Skeleton
>:E
>:E
Posts: 4175
Joined: 15 Dec 2007, 00:46

Re: UScript: Chat, Questions, Discussion

Post by Buff Skeleton »

Awesome, thank you for this!

OK, looks like the theory here is sound - only problem is that Owner is None on the client - isn't there a way to replicate the owner? I guess I COULD create a fake Owner variable and explicitly replicate it in EXUKrall... I'll give that a shot. But if there's a simpler, better, way to replicate Owner to the client, that looks like it would solve the problem entirely!

[Edit] Nevermind, that's not even the half of it - Owner is none on the client because pawns only exist server-side, so if the effect is clientside, then... what the ffffkjhdkfhgv /o\ They must be disassociated at that point.

Do I need to do something like kill any existing effects and just respawn them? That's kinda shitty but uh, not sure what else... or else I could check anim sequence in the overlay effect and set prepivot if it ever does the LegLoss anim. Or something.

If Owner is none on the client and the effect is clientside, then how does bAnimByOwner even work?

[Edit 2] LOL thought of a hilarious shit hack: spawn a clientside actor that does a foreach VisibleCollidingActors within the pawn's collision radius and for every effect with the same mesh, prepivotize. lol. Might just work. I swear, these proxy actors are going to be the death of me. I wish I just understood replication better, on a more intuitive level.
Image
User avatar
[UDHQ]Jackrabbit
Skaarj Warrior
Skaarj Warrior
Posts: 89
Joined: 02 Aug 2012, 07:38

Re: UScript: Chat, Questions, Discussion

Post by [UDHQ]Jackrabbit »

Just a quick clarification- you shouldn't have to worry about the owner client side as the purpose is to copy the owners prepivot server side and then replicate that value (prepivotthing) for the effect client side.
User avatar
Buff Skeleton
>:E
>:E
Posts: 4175
Joined: 15 Dec 2007, 00:46

Re: UScript: Chat, Questions, Discussion

Post by Buff Skeleton »

I gotcha - so it's likely that the vector just isn't getting replicated then?
Image
User avatar
[UDHQ]Jackrabbit
Skaarj Warrior
Skaarj Warrior
Posts: 89
Joined: 02 Aug 2012, 07:38

Re: UScript: Chat, Questions, Discussion

Post by [UDHQ]Jackrabbit »

That's what seems to be the case. Off hand for debugging purposes I would recommend adding a simulated function timer to your EXUPlayerpawn class and every few seconds iterate through all effects and do a BroadcastMessage(prepivotthing) as broadcast message is a client side function. When you see the white broadcast message with the vector other than (0,0,0) it has properly been replicated from sever to client.
User avatar
Buff Skeleton
>:E
>:E
Posts: 4175
Joined: 15 Dec 2007, 00:46

Re: UScript: Chat, Questions, Discussion

Post by Buff Skeleton »

OK, fuck this, can't get prepivot to carry over no matter what I do, proxy or not - so what I tried to do next was just destroy the overlay effect online when leglessness kicks in. This would be an acceptable compromise, but I can't seem to do that because the pawn is running on the server and the effect is running on the client, totally disassociated, right? So I can't tell it to destroy itself because it's in a parallel universe and inaccessible, and I can't get the pawn to tell it to do that on the client because the pawn doesn't EXIST on the client. Fuck everything replication


I do have a proxy that spawns on the client and server initially, which is what generates the clientside overlay effect. I suppose in theory I could keep this proxy around, then use the proxy actor to change the prepivot of the effect when it gets destroyed and destroy it server-side when the Krall's legs get shot off. Maybe? Or would that not work either?
Image
User avatar
[UDHQ]Jackrabbit
Skaarj Warrior
Skaarj Warrior
Posts: 89
Joined: 02 Aug 2012, 07:38

Re: UScript: Chat, Questions, Discussion

Post by [UDHQ]Jackrabbit »

If when you destroy the effect on the client when leglessness occurs, but it still doesn't dissapear for whatever reason it might mean the effect exists both on the sever AND the client which would potentially screw up this whole process. I might try coding out a simple krall pawn tomorrow and see if I can't get prepivotthing to properly replicate.
User avatar
Buff Skeleton
>:E
>:E
Posts: 4175
Joined: 15 Dec 2007, 00:46

Re: UScript: Chat, Questions, Discussion

Post by Buff Skeleton »

It definitely only exists on the client, as I logged the effect to check it out and it only appears in the client log. The proxy actor that spawns it exists temporarily on both client and server, spawns the effect clientside, then destroys itself in both cases. Hope that helps, and let me know how your tests go :)
Image
User avatar
[UDHQ]Jackrabbit
Skaarj Warrior
Skaarj Warrior
Posts: 89
Joined: 02 Aug 2012, 07:38

Re: UScript: Chat, Questions, Discussion

Post by [UDHQ]Jackrabbit »

I put together a quick test mod:

https://www.dropbox.com/s/pdqxpmb743nth ... eltKrall.u

I assume with this mod you are doing something very similar to the ShieldBeltEffect as I decided to just use that as a base. I tested it online and it seemed to work just fine without any replication or proxy actors. Maybe you should simply just use a proxy actor to check whether or not your pawns are in dying state and just clean up any added effects that way.
User avatar
Buff Skeleton
>:E
>:E
Posts: 4175
Joined: 15 Dec 2007, 00:46

Re: UScript: Chat, Questions, Discussion

Post by Buff Skeleton »

Thanks for taking the time to give that a shot, Jackrabbit! Hmm, thing is, EXUKrall doesn't spawn EXULeglessKrall anymore - it handles leglessness within the same class, among some other variables. That's why I set the prepivot when the legs get shot off.

To further complicate matters, spawning overlay effects in PostBeginPlay was problematic before - since PostBeginPlay is called every time an actor becomes relevant on the client, this could result in multiple effects being spawned on a single pawn if it became relevant many times, and they would never get removed until the pawn died. As a result, UArch way back when set up a proxy system registered in Tick() after PostBeginPlay was called so it could only ever be spawned once.

So, we have an overlay proxy class which is generated client and server-side, and then that actor spawns the effect once and only once on the client.

At this point, I think a modified OverlayProxyClass specific for Krall to not destroy when it's done generating the clientside effect, then changing the prepivot once destroyed (and destroying it server-side when the Krall loses its legs) might be a viable alternative. Kinda lame yes, but in theory could work...
Image
User avatar
AlCapowned
Skaarj Elder
Skaarj Elder
Posts: 1197
Joined: 19 Dec 2009, 22:25

Re: UScript: Chat, Questions, Discussion

Post by AlCapowned »

I just ported all of my Resurgence stuff to UT. It went smoothly for the most part, but the raziks are giving me an interesting problem.

When in a single player gametype (either Oldskool's or UnrealShare.singleplayer), the game won't recognize the razik as having any animations, so it doesn't work well and fills the log with errors about missing animations. When hosting a listen server the razik works perfectly. It even works when playing an offline game of coop.

Three of my other guns have skeletal animations, but none of them have any problems. I'm really hoping this can be fixed. What the heck could be the difference between the single player and coop gametypes that cause this?
User avatar
Buff Skeleton
>:E
>:E
Posts: 4175
Joined: 15 Dec 2007, 00:46

Re: UScript: Chat, Questions, Discussion

Post by Buff Skeleton »

That's a real head-scratcher. Pastebin the code?
Image
Post Reply