Game Development Community

Player::initPersistFields not exposed on client

by Ian Omroth Hardingham · in Torque Game Engine · 07/17/2008 (2:25 am) · 4 replies

Hey guys.

In my Player::initPersistFields I have a load of exposed members, but none of them are available on the client. Is there a switch I can throw to allow it? I'm bored of having to write set/get consoleMethods.

Ian

#1
07/17/2008 (3:13 am)
You need to pack your variables in packUpdate on the server, with a matching unpackUpdate for the client. Without that, the client will have no way of knowing the values of the variables.
#2
07/17/2008 (3:16 am)
Hey Peter.

That's not the problem - the values are fine on the client. But if I reference:

%serverObject.field

it works fine, but on the client:

%clientObject.field

is null. It's not a reference problem, %clientObject.method() works fine.

Ian
#3
07/17/2008 (3:57 am)
I'm a little confused, you say the values are fine on the client, but

%clientObject.field

is returning null? Sounds like you are not sending the values to the client, are you using packUpdate/unpackUpdate on the variables?
#4
07/17/2008 (4:10 am)
Hey Peter.

I've checked again, and I think this is a transmission problem, but not the kind I thought.

I've been trying to set field values on the client, and they haven't been being set. Your questioning led me to realise that that is of course because they're getting overwritten by the update from the server. I actually thought that they weren't exposed on the client at all.

Thanks again ;)

Ian