logo
Main

Forums

Downloads

Unreal-Netiquette

Donate for Oldunreal:
Donate

borderline

Links to our wiki:
Wiki

Walkthrough

Links

Tutorials

Unreal Reference

Usermaps

borderline

Contact us:
Submit News
Page Index Toggle Pages: [1] 2  Send TopicPrint
Hot Topic (More than 10 Replies) Getting stuff working online... (Read 5580 times)
SFJake
Full Member
***
Offline


Oldunreal member

Posts: 248
Joined: Aug 15th, 2010
Gender: Male
Getting stuff working online...
Mar 8th, 2013 at 3:55am
Print Post  
Right. Well, I've been going through my work online and things just don't quite always act as it did in single player. Not unexpected, but mostly I just have no clue what to do about it.

One thing I couldn't fix -> a projectile with a messy code to home in on someone. (thats nothing more than changing velocity and rotation every 0.1 sec via timer)

Well, it works just fine alone, but in multiplayer, the projectile just wanders off forever... but an invisible version (or the server's, whatever) follows and hits the player anyway.

So the player can appear to completely dodge it but actually doesn't.

For the sake of trying things, I made the actor spawn smoke (out of the same timer) -> and I can see the smoke out of thin air, so the projectile basically splits in two -> one that has the actual mesh and animation, and the other thats real, which I can see because of the newly spawned smoke.

I just don't understand why this happens.
  
Back to top
 
IP Logged
 
GreatEmerald
Oldunreal MasterPoster
*
Offline


The Great Emerald

Posts: 5361
Location: Vilnius, Lithuania
Joined: May 21st, 2007
Gender: Male
Re: Getting stuff working online...
Reply #1 - Mar 8th, 2013 at 5:34am
Print Post  
The reason for that is simple. Effects are client-side. Since it's just eye candy, servers don't care about it, they have more important things to process and sending information about the effect over the network would eat bandwidth. So the server just tells the client "the effect starts here, it's like that" and then forgets about it. If the projectile is linear, then clients have no problems simulating it - it will go one way every time, no need for further input from the server. But if it's homing, then we have a problem like that. The server still tells the client to handle the effect by itself. Since the movement of the projectile is important enough not to be offloaded to clients (otherwise they would start thinking that the projectile hit an enemy in front of them, while it in reality could have gone to the other side of the map), the server updates its location manually. And then when you spawn smoke, the server does the same effect offloading - but since it's spawned over time and is static, it works, clients just get the location the smoke should be in and then makes sure it doesn't move anywhere.

So the solution is to make the projectile effect replicated - have the server send updates about it to the client. Unreal already has a good example of that, look at the code for the Eightball projectile.
  
Back to top
WWW  
IP Logged
 
[]KAOS[]Casey
Developer Team
Betatester
Offline


nedm

Posts: 3189
Joined: Aug 7th, 2011
Gender: Male
Re: Getting stuff working online...
Reply #2 - Mar 8th, 2013 at 5:54am
Print Post  
GreatEmerald.RemoteRole= Role_Dumbproxy
  
Back to top
 
IP Logged
 
Player One.
New Member
*
Offline


Oldunreal member

Posts: 4
Joined: Mar 5th, 2013
Gender: Male
Re: Getting stuff working online...
Reply #3 - Mar 8th, 2013 at 5:59am
Print Post  
GreatEmerald wrote on Mar 8th, 2013 at 5:34am:
The reason for that is simple. Effects are client-side.


most effects are role_dumbproxy and the server sends them to the client on the first tick!!!!!!!!!!!! this is wrong!!!!!! Sad: Sad Sad Sad

GreatEmerald wrote on Mar 8th, 2013 at 5:34am:
Since it's just eye candy, servers don't care about it, they have more important things to process and sending information about the effect over the network would eat bandwidth.


which is what they ALREADY DO!!!! Sad Sad Sad Sad

GreatEmerald wrote on Mar 8th, 2013 at 5:34am:
So the server just tells the client "the effect starts here, it's like that" and then forgets about it.


not true only true if they are bNET INITIAL Sad Sad Sad


GreatEmerald wrote on Mar 8th, 2013 at 5:34am:
If the projectile is linear, then clients have no problems simulating it - it will go one way every time, no need for further input from the server.


being Linear has nothing to Do With It!!! It Is If the thing will Simulate on Both sides Without Desyncing and this Does Not Necessarily Require Linear Motion!!! Sad BAD JOB.

GreatEmerald wrote on Mar 8th, 2013 at 5:34am:
But if it's homing, then we have a problem like that. The server still tells the client to handle the effect by itself. Since the movement of the projectile is important enough not to be offloaded to clients (otherwise they would start thinking that the projectile hit an enemy in front of them, while it in reality could have gone to the other side of the map), the server updates its location manually.


that is a Lie some projectiles are simulated Proxy stop making up crap and talk about roles and the REAL STUFF instead of making up generalizations Sad Sad Sad

GreatEmerald wrote on Mar 8th, 2013 at 5:34am:
And then when you spawn smoke, the server does the same effect offloading - but since it's spawned over time and is static, it works, clients just get the location the smoke should be in and then makes sure it doesn't move anywhere.
static????????? bad usage of that word as that is a bool on most actors!!! btw clients ALSO GET THE TEXTURE OF EACH SMOKE PUFF IT IS NOT SIMULATED animation Sad Sad Sad : Sad(Sad:(Sad(:Sad(Sad:

GreatEmerald wrote on Mar 8th, 2013 at 5:34am:
So the solution is to make the projectile effect replicated - have the server send updates about it to the client. Unreal already has a good example of that, look at the code for the Eightball projectile.


what the crappity smack that has no relevance to the problem at all!!!

ge.ass.talk( out_of );
  
Back to top
 
IP Logged
 
SFJake
Full Member
***
Offline


Oldunreal member

Posts: 248
Joined: Aug 15th, 2010
Gender: Male
Re: Getting stuff working online...
Reply #4 - Mar 8th, 2013 at 6:18am
Print Post  
(to: GreatEmerald)

You mean SeekingRocket?

There's nothing (at all) special about it. Sets timer in state Flying, function BeginState, changes Velocity & SetRotation.

The only real differences seems meaningless (and I tried changing them anyway to fit more like SeekingRocket, in vain). Also tried ROLE_DumbProxy, but then the projectile just... stood there instead of going forward. Not moving at all.

EDIT: Also tried "replication" (reliable if (Role == ROLE_Authority), did not work.

Well, of course a real difference is that my projectile is based off DispersionAmmo, not rocket.

I could just try a rewrite, I had no clue what I was doing when I got that code (and I Mean  no clue at all) but now I do, still I see no reason for it not to work online compared to SeekingRocket.

Here's the code for a laugh. Watch your eyes. Beneath all the fluff I see the same thing as SeekingRocket.

Code
Select All
//=============================================================================
// DispersionAmmoH.
//=============================================================================
class DispersionAmmoH expands DispersionAmmo;

var() float  bHomingAmount; //Lower = homes in faster. Default is 500.
var() bool  bHomeAlways; //If FALSE, will only home when relatively facing the target. If TRUE, will keep seeking its target forever.
var() bool  bHomeAlwaysAfterLimit; //If should always home after limit.
var() float  bLifeSpanExplode; //After this many seconds, the projectile blows up. Default is 7.0.
var() bool  bHomingLimitActive; //Must be true for the homing limit to work.
var() int  bHomingLimit; //Limit how long (in bHomingTicks seconds) can the projectile keep homing.
var() float  bHomingAdditional; //Add this to the projectile's homing capabilities. Adding 1.0 only makes its homing nearly perfect.
var() bool  bSkillAffectHoming; //If TRUE, the monster's Skill Level has a significant impact on the homing.
var() bool bReorientateOnSpawn; //If TRUE, the projectile will look directly at the target when spawned.
var() bool bReorientateOnFirstHome; //If TRUE, the projectile will look directly at the target after bTimeBeforeReorientate.
var() int bTimeBeforeReorientate; //Time in bHomingTicks, that will delay the Reoritentate.
var() bool bAbsoluteHoming; //Used for debugging purposes for now. Leave FALSE.
var() float bHomingTicks; //Time in seconds before trying to home in again. Default is 0.1.
var() bool bTurnOffActualHoming; //If TRUE, the script will not reach the homing part. In other words, this will avoid the main homing procedure. Mainly for use with bReorientateOnFirstHome.

var() float  bHomingAfterLimit; //Serve as bHomingAdditional after the limit is breached.
var() float  bHomingAfterLimit10; //Serve as bHomingAdditional after the limit is breached.


var int  bSFHomingLimit;
var bool  bSFHomingLimitset;
var bool  bSFHomingUnlimited;
var vector OriginalDirection;
var int  bSFTestGoStraigth;
var bool  bSFTestBool;
var float bHomingAdditionalT;
var bool  bHomeAlwaysT;

auto state Flying
{
	function BeginState()
	{
		SetTimer(bHomingTicks,True);
		PlaySound(SpawnSound);
		if (bReorientateOnSpawn)
			{
			OriginalDirection = Vector(Rotation);
			Velocity = OriginalDirection * bHomingAmount;
			}
		else
			{
			Velocity = Vector(Rotation) * speed;
			}
		Acceleration = Velocity * 0.4;
	}

//Begin:
//	Sleep(bLifeSpanExplode);
//	Explode(Location, vect(0,0,0));
}

	function Timer()
	{
		local vector EnemyDir;
	local SpriteSmokePuff b;

		b = Spawn(class'SpriteSmokePuff');
		b.RemoteRole = ROLE_simulatedproxy;

		if ( bTimeBeforeReorientate > 0 )
			{
			bTimeBeforeReorientate--;
			}

		if ( bReorientateOnFirstHome && !bSFTestBool && bTimeBeforeReorientate <= 0 )
			{
			OriginalDirection = Vector(Rotation);
			Velocity = OriginalDirection * bHomingAmount;
			bSFTestBool=true;
			}

		if ( bTurnOffActualHoming )
			return;

//		if ( bSFTestGoStraigth <= 5 )
//			{
//			bSFTestGoStraigth++;
//			return;
//			}

		if ( !bHomingLimitActive )
			{
			bSFHomingLimit=10;
			bSFHomingLimitset=true;
			}

		if ( !bSFHomingLimitset)
			{
			bSFHomingLimit=bHomingLimit;
			bSFHomingLimitset=true;
			}

		if ( bSFHomingLimit <= 0 )
			{
			bHomeAlwaysT=bHomeAlwaysAfterLimit;
			bHomingAdditionalT=bHomingAfterLimit;
			}
		else if ( bSFHomingLimit <= 10 )
			{
			bHomeAlwaysT=bHomeAlwaysAfterLimit;
			bHomingAdditionalT=bHomingAfterLimit10;
			}
		else
			{
			bHomeAlwaysT=bHomeAlways;
			bHomingAdditionalT=bHomingAdditional;
			}

		if ( (Instigator != None) && (Instigator.Enemy != None) )
		{
			EnemyDir = Normal(Instigator.Enemy.Location - Location);


			if ( bAbsoluteHoming )
			{
				Velocity =  Normal(EnemyDir);
				SetRotation(Rotator(Velocity));
			}
			else
			{
				if ( bHomeAlwaysT )
				{
					if ( bSkillAffectHoming )
					{
						Velocity =  speed * Normal(EnemyDir * speed * (bHomingAdditionalT + 0.25 + instigator.skill * 0.1) + Velocity);
						SetRotation(Rotator(Velocity));
					}
					else
					{
						Velocity =  speed * Normal(EnemyDir * speed * (bHomingAdditionalT + 0.25 + 1 * 0.1) + Velocity);
						SetRotation(Rotator(Velocity));
					}
				}
				else if ( (EnemyDir Dot OriginalDirection) > 0 )
				{
					if ( bSkillAffectHoming )
					{
						Velocity =  speed * Normal(EnemyDir * speed * (bHomingAdditionalT + 0.25 + instigator.skill * 0.1) + Velocity);
						SetRotation(Rotator(Velocity));
					}
					else
					{
						Velocity =  speed * Normal(EnemyDir * speed * (bHomingAdditionalT + 0.25 + 1 * 0.1) + Velocity);
						SetRotation(Rotator(Velocity));
					}
				}
			}



		bSFHomingLimit--;
		}
	}
 

  
Back to top
 
IP Logged
 
GreatEmerald
Oldunreal MasterPoster
*
Offline


The Great Emerald

Posts: 5361
Location: Vilnius, Lithuania
Joined: May 21st, 2007
Gender: Male
Re: Getting stuff working online...
Reply #5 - Mar 8th, 2013 at 12:35pm
Print Post  
Player One. wrote on Mar 8th, 2013 at 5:59am:
that is a Lie some projectiles are simulated Proxy stop making up crap and talk about roles and the REAL STUFF instead of making up generalizations Sad Sad Sad


Oh noes, I'm simplifying the issue to make it easier to understand the concept. I truly must be a horrible person. Roll Eyes

Also, please stop breaking rules #1 and #4, thanks.

SFJake wrote on Mar 8th, 2013 at 6:18am:
You mean SeekingRocket?

There's nothing (at all) special about it. Sets timer in state Flying, function BeginState, changes Velocity & SetRotation.

The only real differences seems meaningless (and I tried changing them anyway to fit more like SeekingRocket, in vain). Also tried ROLE_DumbProxy, but then the projectile just... stood there instead of going forward. Not moving at all.

EDIT: Also tried "replication" (reliable if (Role == ROLE_Authority), did not work.

Well, of course a real difference is that my projectile is based off DispersionAmmo, not rocket.

I could just try a rewrite, I had no clue what I was doing when I got that code (and I Mean  no clue at all) but now I do, still I see no reason for it not to work online compared to SeekingRocket.

Here's the code for a laugh. Watch your eyes. Beneath all the fluff I see the same thing as SeekingRocket.


Interesting. But what about default properties? They play an important role here.

Also, try debugging. Have a log statement in the part where velocity is changed, and then after shooting a few of the projectiles look at the velocity value for both the client and the server. It could be that some functions are not executed on the client, causing such issues.
  
Back to top
WWW  
IP Logged
 
SFJake
Full Member
***
Offline


Oldunreal member

Posts: 248
Joined: Aug 15th, 2010
Gender: Male
Re: Getting stuff working online...
Reply #6 - Mar 8th, 2013 at 5:28pm
Print Post  
Well the default properties I changed are only for the new variables, everything else is the same as DispersionAmmo.

I did some log testing and the client gets none, basically. It doesn't enter the BeginState in Flying. (I'm assuming I would see them in Unreal.log)

Now I'm trying to set the projectile as ROLE_Authority and check the logs.

It goes through Timer but misses the big block (if (Instigator != None) && (Instigator.Enemy != None)). The server's goes through it just fine.

I don't understand why that one information is not carried over. Obviously either of those gets None client side. The projectile also does not start as it should client side even with Authority.

There's a lot of things that are not sent to the client. I'm clueless on how to change that fact.

EDIT: Could this be a server issue? I noticed SkaarjProjectiles don't change textures client side (which is from a 0.2 sec timer). Since these are the default ones thats rather... weird, I'd expect them to work.
« Last Edit: Mar 8th, 2013 at 8:54pm by SFJake »  
Back to top
 
IP Logged
 
GreatEmerald
Oldunreal MasterPoster
*
Offline


The Great Emerald

Posts: 5361
Location: Vilnius, Lithuania
Joined: May 21st, 2007
Gender: Male
Re: Getting stuff working online...
Reply #7 - Mar 8th, 2013 at 9:40pm
Print Post  
In default properties you could try setting bNetTemporary to False and try some different RemoteRoles. Though I don't expect that to change all that much.

Check whether it's the Instigator or the Instigator.Enemy that is None. I don't see why either should be None on the client, but having that information allows for further debugging.
  
Back to top
WWW  
IP Logged
 
SFJake
Full Member
***
Offline


Oldunreal member

Posts: 248
Joined: Aug 15th, 2010
Gender: Male
Re: Getting stuff working online...
Reply #8 - Mar 8th, 2013 at 9:55pm
Print Post  
ScriptLog: Instigator != None succeed
ScriptLog: Instigator.Enemy != None failed

Server get succeed on both. Removing the Instigator.Enemy check causes client-side crash (expected).
  
Back to top
 
IP Logged
 
Bleeder91[NL]
Betatester
Offline


Personal Text:

Posts: 1018
Location: Location, Location, Location.
Joined: Oct 4th, 2009
Gender: Male
Re: Getting stuff working online...
Reply #9 - Mar 9th, 2013 at 12:10am
Print Post  
Inside the proj:
Code (C++)
Select All
var Pawn Target;

Replication
{
	Reliable if(Role==ROLE_Authority)
		Target;
	Reliable if(Role<ROLE_Authority)
		SeekTarget;
}

simulated function SeekTarget(Pawn Other)
{ Target=Other; } 


I used a weapon that calls SeekTarget();. So I think you might be able to work with that.
  
Back to top
 
IP Logged
 
SFJake
Full Member
***
Offline


Oldunreal member

Posts: 248
Joined: Aug 15th, 2010
Gender: Male
Re: Getting stuff working online...
Reply #10 - Mar 9th, 2013 at 1:25am
Print Post  
I tried that and its not having any effect.
  
Back to top
 
IP Logged
 
Pcube
Ex Member


Re: Getting stuff working online...
Reply #11 - Mar 9th, 2013 at 4:01am
Print Post  
  
Back to top
 
IP Logged
 
SFJake
Full Member
***
Offline


Oldunreal member

Posts: 248
Joined: Aug 15th, 2010
Gender: Male
Re: Getting stuff working online...
Reply #12 - Mar 9th, 2013 at 5:16am
Print Post  
Oh god.

...

Maybe I eventually will read the whole thing. Its interesting. However if push comes to shove, I'd rather hack a gimmicky way to "fix" this than go through hell for something very few people in the world will play in multiplayer :#

I did learn from a quick runthrough already how to fix another projectile that stopped: simulated states (I had no clue, so simple).
  
Back to top
 
IP Logged
 
SFJake
Full Member
***
Offline


Oldunreal member

Posts: 248
Joined: Aug 15th, 2010
Gender: Male
Re: Getting stuff working online...
Reply #13 - Mar 9th, 2013 at 4:19pm
Print Post  
ARG.

I can't believe I missed that. So much wasted headbumping.

bNetTemporary. Defaults to True in all projectiles but a few like SeekingRocket, somehow I didn't take a note of that.

Set that up with ROLE_DumbProxy and everything works perfectly.

I'm sure someone along the line assumed I saw it in SeekingRocket but I did not. I did check its properties but I did not see that.

So thanks, I'm set. Well, as far as it "working" goes. I would -not- recommend this on a 20 player servers. <-<
  
Back to top
 
IP Logged
 
GreatEmerald
Oldunreal MasterPoster
*
Offline


The Great Emerald

Posts: 5361
Location: Vilnius, Lithuania
Joined: May 21st, 2007
Gender: Male
Re: Getting stuff working online...
Reply #14 - Mar 9th, 2013 at 6:35pm
Print Post  
SFJake wrote on Mar 9th, 2013 at 4:19pm:
ARG.

I can't believe I missed that. So much wasted headbumping.

bNetTemporary. Defaults to True in all projectiles but a few like SeekingRocket, somehow I didn't take a note of that.

Set that up with ROLE_DumbProxy and everything works perfectly.


GreatEmerald wrote on Mar 8th, 2013 at 9:40pm:
In default properties you could try setting bNetTemporary to False


Yeap...
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo