![]() |
|
|
#1 |
|
Registered User
Join Date: Sep. 20th, 2004
Posts: 13
|
I have an Interaction class (on the client) which in the PostRender function calls a function on the server. The server function is supposed to return a bool. The client allways gets a false even if I return true from the server.
I guess the client doesn't wait for the server to respond so it will allways be false. Am I right about that? Is there some good solution? /lazy |
|
|
|
|
|
#2 |
|
Join Date: Oct. 3rd, 2001
Location: Frankfurt/Main, Germany
Posts: 3,829
|
Replicated functions are called asynchronously and thus can never return anything. Just imagine what'd happen to the client's frame rate if the client had to wait for a server response on each frame...
|
|
|
|
|
|
#3 |
|
Try something like this.
Code:
class NewInteraction extends Interaction;
var bool bReturnProperty;
replication
{
// Stuff the server needs to send to the client
unreliable if (Role == ROLE_Authority && bNetDirty)
bReturnProperty;
// Stuff the client must send to the server
unreliable if (Role < ROLE_Authority)
CallServerFunction;
}
function bool ReturnABool()
{
// Stuff you needed to do server-side goes here.
return SomeBooleanValue;
}
function CallServerFunction()
{
// This calls the function on the server and stores the return value in
// bReturnProperty.
if (Role = ROLE_Authority)
bReturnProperty = ReturnABool();
}
simulated function PostRender(canvas Canvas)
{
if (Level.NetMode != NM_DedicatedServer)
{
// Your code goes here
CallServerFunction();
}
// Whenever the server gets done processing whatever it is you needed
// on the client, bReturnProperty will be set. For now, continue
// processing code as though bReturnProperty was set.
}
Hope this helps some.. |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|