News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Thread Tools Display Modes
Old 27th Sep 2004, 05:37 AM   #1
Registered User
Join Date: Sep. 20th, 2004
Posts: 13
Question Client <-> server communication... again...

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?

lazy303 is offline   Reply With Quote
Old 27th Sep 2004, 06:26 AM   #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...
Mychaeel is offline   Reply With Quote
Old 27th Sep 2004, 05:49 PM   #3
Kamek's Avatar
Join Date: Sep. 26th, 2004
Posts: 10
Try something like this.

class NewInteraction extends Interaction;

var bool bReturnProperty;

	// Stuff the server needs to send to the client
	unreliable if (Role == ROLE_Authority && bNetDirty)

	// Stuff the client must send to the server
	unreliable if (Role < ROLE_Authority)

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
	// 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.
The function call will pass to the server for each PostRender, but since it's unreliable it will only be executed if bandwidth is available, and the server will return the value in bReturnProperty whenever bandwidth is available. Until the server replicates that bReturnProperty, PostRender just uses whatever value was there before.

Hope this helps some..
Kamek is offline   Reply With Quote

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 09:40 AM.

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

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