NewsUnrealEdFilesModsFragBULiandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 12th Aug 2011, 01:46 AM   #21
EvilT-ModZ
Un-Gravitify
 
EvilT-ModZ's Avatar
 
Join Date: Aug. 3rd, 2011
Location: Russia
Posts: 36
Quote:
Originally Posted by EQ² View Post
Afraid not, it looks like they took that function out in the Postal2 build of UE2 (it's not uncommon for licensees to remove functions they don't need and I don't think multiplayer was thought about. Basically you can't use the method above by the looks of it.

So, you can't make it simulatedproxy and you can't do efficient replication on the actor so you'll have to attach the helper actor server-side and do your replication in there. The down side is that because you can't use PostNetReceive you'll have to tick the helper actor all the time and check the value of your replication flag every tick. It sucks and but I can't see there's much alternative really.
Ok, thank you for helping a lot, so, i'll try it anyway
EvilT-ModZ is offline   Reply With Quote
Old 12th Aug 2011, 05:45 AM   #22
EvilT-ModZ
Un-Gravitify
 
EvilT-ModZ's Avatar
 
Join Date: Aug. 3rd, 2011
Location: Russia
Posts: 36
I made helping actor, now bone rotation working on client, but vector and rotations doesn't read from kactor, because on client bones rotates to zero vector:

http://s013.radikal.ru/i325/1108/5c/b5f09f697bfa.jpg

Code:
class BoneRotatingActor extends Actor;

var EvilCatModern Chassis;
const TIRE_FRONT_RIGHT = 'TIRE';
const TIRE_FRONT_LEFT = 'TIRE03';
const TIRE_REAR_RIGHT = 'TIRE02';
const TIRE_REAR_LEFT	= 'TIRE04';

simulated event Tick(float DeltaTime)
{
	local rotator Tire1RotT, Tire2RotT, Tire3RotT, Tire4RotT, ChassisRot;
	local vector Dir;
	ChassisRot = Chassis.Rotation;
	Dir = vector(ChassisRot);

	Tire1RotT = Chassis.SteerTireRight.Rotation; // tires are invisible kactors
	Tire2RotT = Chassis.SteerTireLeft.Rotation;
	Tire3RotT = Chassis.EngTireRight.Rotation;
	Tire4RotT = Chassis.EngTireLeft.Rotation;

	Chassis.SetBoneDirection( TIRE_FRONT_RIGHT , Tire1RotT , Dir , 1 );
	Chassis.SetBoneDirection( TIRE_FRONT_LEFT , Tire2RotT , Dir , 1 );
	Chassis.SetBoneDirection( TIRE_REAR_RIGHT , Tire3RotT , Dir , 1 );
	Chassis.SetBoneDirection( TIRE_REAR_LEFT , Tire4RotT , Dir , 1 );
}

defaultproperties
{
	 RemoteRole=ROLE_None
}
Code:
class EvilCatModern extends KarmaCarVehicle;

var BoneRotatingActor HelperActor;

simulated event PreBeginPlay()
{
	Super.PreBeginPlay();

	// Only need the helper on client, listen server and SP
	if (Level.NetMode != NM_DedicatedServer)
	{
		HelperActor = Spawn( class'BoneRotatingActor' );
		HelperActor.Chassis = self;
	}
}

simulated function Destroyed()
{
	Super.Destroyed();
	if(HelperActor != None)
		HelperActor.Destroy();
}

defaultproperties
{
	 RemoteRole=ROLE_DumbProxy
}

Last edited by EvilT-ModZ; 12th Aug 2011 at 05:47 AM.
EvilT-ModZ is offline   Reply With Quote
Old 12th Aug 2011, 08:33 AM   #23
EQ²
Code Monkey
 
EQ²'s Avatar
 
Join Date: Oct. 30th, 2004
Location: Near Birmingham, UK
Posts: 243
Sorry I guess it's not very clear. The values you need aren't replicated on the KActor itself so you can either replicate them yourself on that Actor, or in your helper, it really doesn't make a huge difference. I've modified your code to show how this could be achieved, I've marked the changes in red so you can see what's changed.

One thing to note is that since we're now replicating the helper actor (remoterole is now simulatedproxy on the helper itself) you don't need to (in fact shouldn't) spawn it on the client, just on the server.

Code:
class BoneRotatingActor extends Actor;

const TIRE_FRONT_RIGHT = 'TIRE';
const TIRE_FRONT_LEFT = 'TIRE03';
const TIRE_REAR_RIGHT = 'TIRE02';
const TIRE_REAR_LEFT = 'TIRE04';

var EvilCatModern Chassis;
// These variables calculated server-side then sent to client
var rotator Tire1RotT, Tire2RotT, Tire3RotT, Tire4RotT;
var vector Dir;

replication
{
    // Send calculated variables to client
    unreliable if (Role == ROLE_Authority)
        Chassis, Dir, Tire1RotT, Tire2RotT, Tire3RotT, Tire4RotT;
}

simulated event Tick(float DeltaTime)
{
    local rotator ChassisRot;

    // Check whether chassis is valid, otherwise will get
    // "Accessed None" before replication is completed
    if (Chassis == None) return;

    // Only update this stuff server-side
    if (Role == ROLE_Authority)
    {
        ChassisRot = Chassis.Rotation;
        Dir = vector(ChassisRot);

        Tire1RotT = Chassis.SteerTireRight.Rotation; // tires are invisible kactors
        Tire2RotT = Chassis.SteerTireLeft.Rotation;
        Tire3RotT = Chassis.EngTireRight.Rotation;
        Tire4RotT = Chassis.EngTireLeft.Rotation;
    }

    Chassis.SetBoneDirection( TIRE_FRONT_RIGHT , Tire1RotT , Dir , 1 );
    Chassis.SetBoneDirection( TIRE_FRONT_LEFT , Tire2RotT , Dir , 1 );
    Chassis.SetBoneDirection( TIRE_REAR_RIGHT , Tire3RotT , Dir , 1 );
    Chassis.SetBoneDirection( TIRE_REAR_LEFT , Tire4RotT , Dir , 1 );
}

defaultproperties
{
     RemoteRole=ROLE_SimulatedProxy
}
Code:
class EvilCatModern extends KarmaCarVehicle;

var BoneRotatingActor HelperActor;

simulated event PreBeginPlay()
{
    Super.PreBeginPlay();

    // Only spawn the helper server-side, it will be
    // replicated to the client
    if (Role == ROLE_Authority)
    {
        HelperActor = Spawn( class'BoneRotatingActor' );
        HelperActor.Chassis = self;
    }
}

simulated function Destroyed()
{
    Super.Destroyed();

    if (HelperActor != None)
    {
        HelperActor.Destroy();
        HelperActor = None;
    }
}

defaultproperties
{
    RemoteRole=ROLE_DumbProxy
}
Hope this helps.
__________________

Before you criticise someone, walk a mile in their shoes; that way, when you criticise them you are a mile away and have their shoes.
EQ² is offline   Reply With Quote
Old 12th Aug 2011, 09:59 AM   #24
EvilT-ModZ
Un-Gravitify
 
EvilT-ModZ's Avatar
 
Join Date: Aug. 3rd, 2011
Location: Russia
Posts: 36
Quote:
Originally Posted by EQ² View Post
Sorry I guess it's not very clear. The values you need aren't replicated on the KActor itself so you can either replicate them yourself on that Actor, or in your helper, it really doesn't make a huge difference. I've modified your code to show how this could be achieved, I've marked the changes in red so you can see what's changed.

One thing to note is that since we're now replicating the helper actor (remoterole is now simulatedproxy on the helper itself) you don't need to (in fact shouldn't) spawn it on the client, just on the server.

Code:
class BoneRotatingActor extends Actor;

const TIRE_FRONT_RIGHT = 'TIRE';
const TIRE_FRONT_LEFT = 'TIRE03';
const TIRE_REAR_RIGHT = 'TIRE02';
const TIRE_REAR_LEFT = 'TIRE04';

var EvilCatModern Chassis;
// These variables calculated server-side then sent to client
var rotator Tire1RotT, Tire2RotT, Tire3RotT, Tire4RotT;
var vector Dir;

replication
{
    // Send calculated variables to client
    unreliable if (Role == ROLE_Authority)
        Chassis, Dir, Tire1RotT, Tire2RotT, Tire3RotT, Tire4RotT;
}

simulated event Tick(float DeltaTime)
{
    local rotator ChassisRot;

    // Check whether chassis is valid, otherwise will get
    // "Accessed None" before replication is completed
    if (Chassis == None) return;

    // Only update this stuff server-side
    if (Role == ROLE_Authority)
    {
        ChassisRot = Chassis.Rotation;
        Dir = vector(ChassisRot);

        Tire1RotT = Chassis.SteerTireRight.Rotation; // tires are invisible kactors
        Tire2RotT = Chassis.SteerTireLeft.Rotation;
        Tire3RotT = Chassis.EngTireRight.Rotation;
        Tire4RotT = Chassis.EngTireLeft.Rotation;
    }

    Chassis.SetBoneDirection( TIRE_FRONT_RIGHT , Tire1RotT , Dir , 1 );
    Chassis.SetBoneDirection( TIRE_FRONT_LEFT , Tire2RotT , Dir , 1 );
    Chassis.SetBoneDirection( TIRE_REAR_RIGHT , Tire3RotT , Dir , 1 );
    Chassis.SetBoneDirection( TIRE_REAR_LEFT , Tire4RotT , Dir , 1 );
}

defaultproperties
{
     RemoteRole=ROLE_SimulatedProxy
}
Code:
class EvilCatModern extends KarmaCarVehicle;

var BoneRotatingActor HelperActor;

simulated event PreBeginPlay()
{
    Super.PreBeginPlay();

    // Only spawn the helper server-side, it will be
    // replicated to the client
    if (Role == ROLE_Authority)
    {
        HelperActor = Spawn( class'BoneRotatingActor' );
        HelperActor.Chassis = self;
    }
}

simulated function Destroyed()
{
    Super.Destroyed();

    if (HelperActor != None)
    {
        HelperActor.Destroy();
        HelperActor = None;
    }
}

defaultproperties
{
    RemoteRole=ROLE_DumbProxy
}
Hope this helps.
Thank you a lot again
Now bones rotates well
EvilT-ModZ is offline   Reply With Quote
Reply

Tags
bone, boning, postal 2, rotating

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 02:16 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer