News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 9th Oct 2001, 06:33 PM   #1
SoSilencer
Harry Goz (1932 - 2003)
 
SoSilencer's Avatar
 
Join Date: Nov. 27th, 2000
Posts: 834
Server/Client Timers

I know what I need to do, but I'm not quite sure how to do it. I'll try to explain as best I can.

.5 second timer
{
do code only on server/host of game
replicate/update variables to clients
}

.1 second timer
{
do this code on all machines, using variables from server
}

That is it really. It's for my rockets. Every half second the server calculates the changes and tells the clients "fly here". Every .1 seconds the rockets figure out by themselves how to fly there (which should be the same on all clients since they are all using the same variables in the same calculations). I can't quite figure out how to tell the code that "this should be done every half second and only on the server" and "this should be done every tenth of a second on all machines". Anyone know how to do that?
__________________
German Guy: Is there an indicator to see where the blue flag is?
Mark Rein: Yeah it's a blue flag
SoSilencer is offline   Reply With Quote
Old 9th Oct 2001, 07:18 PM   #2
Bytekeeper
Last of the Brunnen G
 
Bytekeeper's Avatar
 
Join Date: Jul. 15th, 2001
Location: Germany
Posts: 64
make something like:

int count;

simulated event beginplay()
{
settimer( 0.1, true );
}

simulated event Timer()
{
count= ( count + 1 ) % 5;
if ( !count && role == role_authority )
{
// Called on server only
}
// Code which every machine should do
}
__________________
-
Dante

Defence Alliance coder
www.planetunreal.com/da/
Bytekeeper is offline   Reply With Quote
Old 9th Oct 2001, 10:33 PM   #3
SoSilencer
Harry Goz (1932 - 2003)
 
SoSilencer's Avatar
 
Join Date: Nov. 27th, 2000
Posts: 834
That's kinda what I'm doing now but it's not working right. It is all in a "function Timer()", does it need to be "simulated event Timer()" instead? What is the difference between those two?

I think one of my problems is that the rockets change physics mode. They start in PHYS_Falling when the rockets are ejected from the gun. About a half second later the rockets ignite and switch to PHYS_Projectile, only to run out of gas about 7 seconds later and switch back to PHYS_Faling. I can't seem to get the physics to replicate (or anything else for that matter) so the rockets just fall forward out of the gun and that's it.
__________________
German Guy: Is there an indicator to see where the blue flag is?
Mark Rein: Yeah it's a blue flag
SoSilencer is offline   Reply With Quote
Old 10th Oct 2001, 05:25 AM   #4
Bytekeeper
Last of the Brunnen G
 
Bytekeeper's Avatar
 
Join Date: Jul. 15th, 2001
Location: Germany
Posts: 64
Simulated means, that the function can be called on the client. For events etc. to be called clientside your actor has to be role_simulatedproxy, so check if it is too.
If you call a nonsimulated function clientside it will not be processed, so remember, every actor < ROLE_AutonomousProxy needs a simulated before the function call if you want it to be called clientside.
Hmm, the physics are only replicated once to the client, and that's when you spawn a new rocket.

You could set bSimFall= true, that would replicate Velocity, Accelerarion, bBounce and Physics to the client.
Or you let the client decide on it's own when to set the physics by replicating gas etc.
__________________
-
Dante

Defence Alliance coder
www.planetunreal.com/da/
Bytekeeper is offline   Reply With Quote
Old 11th Oct 2001, 02:12 PM   #5
ca
CHiMERiC Grandmaster
 
Join Date: Oct. 11th, 1999
Posts: 84
If you want a timer called client-side just make sure you call SetTimer from a simulated function, otherwise it won't work.
__________________
ca
ray@unrealscript.com
http://www.unrealscript.com/
ca is offline   Reply With Quote
Old 11th Oct 2001, 05:07 PM   #6
Bytekeeper
Last of the Brunnen G
 
Bytekeeper's Avatar
 
Join Date: Jul. 15th, 2001
Location: Germany
Posts: 64
And the Timer() function must be simulated for sure as well for this to work.
__________________
-
Dante

Defence Alliance coder
www.planetunreal.com/da/
Bytekeeper is offline   Reply With Quote
Reply

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 11:53 AM.


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