Hey there
I made some kind of health trigger which takes damage and trigger an event when the health = 0.
I also added the ability to spawn effects at the hit location When the trigger get damage.
Everything works perfekt in singleplayer but in multiplayer as client the projectile makes a hit sound and fly through the collision radius of the trigger this also happens with the normal triggers with tt_shoot.
The next problem is that the effects so dont spawn as client.
Is there a way to get a working network replication for such a thing?
For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com
Custom trigger with tt_shoot network replication
- Krull0r
- Global Moderator
- Posts: 543
- Joined: Sun Jul 01, 2007 4:07 pm
- Masterkent
- OldUnreal Member
- Posts: 1469
- Joined: Fri Apr 05, 2013 12:41 pm
Re: Custom trigger with tt_shoot network replication
Me not understands the meaning of this description and what the issue is.Everything works perfekt in singleplayer but in multiplayer as client the projectile makes a hit sound and fly through the collision radius of the trigger this also happens with the normal triggers with tt_shoot.
What's the RemoteRole of those effects?The next problem is that the effects so dont spawn as client.
- Krull0r
- Global Moderator
- Posts: 543
- Joined: Sun Jul 01, 2007 4:07 pm
Re: Custom trigger with tt_shoot network replication
I made a short demonstration video which shows the issue:
The first part shows the singleplayer where every works as it should.
In the second part it shows how it behaves as client. The projectile do hit the trigger and the projectile do play the hit sound but the projectile fly through the trigger. This also happens with the original trigger set to TT_shoot
My Effects use the SimulatedProxy
Here is my shitty code which only works with luck
https://www.oldunreal.com/cgi-bin/nopaste/?147
The first part shows the singleplayer where every works as it should.
In the second part it shows how it behaves as client. The projectile do hit the trigger and the projectile do play the hit sound but the projectile fly through the trigger. This also happens with the original trigger set to TT_shoot
My Effects use the SimulatedProxy
Here is my shitty code which only works with luck
https://www.oldunreal.com/cgi-bin/nopaste/?147
- Masterkent
- OldUnreal Member
- Posts: 1469
- Joined: Fri Apr 05, 2013 12:41 pm
Re: Custom trigger with tt_shoot network replication
bNetTemporary projectiles are handled independently by a server and clients. When such a projectile is destroyed server-side, clients do not receive any notification about this, so you may see a "non-existing" projectile as long as your client thinks that it should exist. A client may also destroy the client-side copy of a server-side bNetTemporary projectile before destruction of the server-side projectile. These are implications of a really stupid optimization that generally causes lots of glitches in network game.In the second part it shows how it behaves as client. The projectile do hit the trigger and the projectile do play the hit sound but the projectile fly through the trigger. This also happens with the original trigger set to TT_shoot
Additionally, bProjTarget is not replicated, so when the server modifies this variable, clients can't properly predict interaction of bNetTemporary projectiles with affected actors. Hence you need a custom trigger where bProjTarget would be set to True client-side (setting the default value of bProjTarget to True can suffice) in order to make client-side prediction not so bad.
That explains why your effects are not spawned on a dedicated server - you explicitly excluded such a possibility:
Code: Select all
if(Level.NetMode != NM_DedicatedServer)
{
if( SpawnFX1!=None )
Spawn(SpawnFX1,,,hitlocation);
if( SpawnFX2!=None )
Spawn(SpawnFX2,,,hitlocation);
if( SpawnFX3!=None )
Spawn(SpawnFX3,,,hitlocation);
}
Code: Select all
simulated function ProcessTouch (Actor Other, vector HitLocation)
{
If (Other!=Instigator && DispersionAmmo(Other)==None)
{
bExploded = ( Other.IsA('Pawn') && !Level.bHighDetailMode );
if ( Role == ROLE_Authority )
Other.TakeDamage( Damage, instigator, HitLocation, MomentumTransfer*Vector(Rotation), 'exploded');
Explode(HitLocation, vect(0,0,1));
}
}
Code: Select all
class EffectsSpawner expands Info;
var class SpawnFX1, SpawnFX2, SpawnFX3;
replication
{
reliable if (Role == ROLE_Authority)
SpawnFX1, SpawnFX2, SpawnFX3;
}
function Setup(class SpawnFX1, class SpawnFX2, class SpawnFX3)
{
self.SpawnFX1 = SpawnFX1;
self.SpawnFX2 = SpawnFX2;
self.SpawnFX3 = SpawnFX3;
}
simulated event PostNetBeginPlay()
{
SpawnEffects();
}
simulated function SpawnEffect(class EffectClass)
{
local Actor A;
if (EffectClass == none)
return;
A = Spawn(EffectClass,,, Location);
if (A != none)
A.RemoteRole = ROLE_None;
}
simulated function SpawnEffects()
{
SpawnEffect(SpawnFX1);
SpawnEffect(SpawnFX2);
SpawnEffect(SpawnFX3);
}
defaultproperties
{
bNetTemporary=True
bHidden=False
DrawType=DT_None
LifeSpan=1
RemoteRole=ROLE_SimulatedProxy
}
Code: Select all
EffectsSpawner = Spawn(class'EffectsSpawner',,, HitLocation);
if (EffectsSpawner != none)
{
EffectsSpawner.Setup(SpawnFX1, SpawnFX2, SpawnFX3);
if (Level.NetMode != NM_DedicatedServer)
EffectsSpawner.SpawnEffects();
}
Last edited by Masterkent on Tue Jul 31, 2018 12:07 pm, edited 1 time in total.
- Krull0r
- Global Moderator
- Posts: 543
- Joined: Sun Jul 01, 2007 4:07 pm
Re: Custom trigger with tt_shoot network replication
Hey Masterkent
Thanks for your help it works now and I found an other method to get it work right. I forgot about the other collision bools in actor.
I simply allowed the trigger to toggle all non constant collision bools with initially active.
The effects do spawn now and the trigger block projectiles as well in multiplayer as client.
Thanks for your help it works now and I found an other method to get it work right. I forgot about the other collision bools in actor.
I simply allowed the trigger to toggle all non constant collision bools with initially active.
The effects do spawn now and the trigger block projectiles as well in multiplayer as client.