News UnrealEd Files Mods FragBU Liandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Mods > WoD Mod Pod > Ask a Coder

Reply
 
Thread Tools Display Modes
Old 9th Oct 2001, 06:32 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 29th Dec 2001, 08:46 AM   #2
Wormbo
 
Wormbo's Avatar
 
Join Date: Jun. 4th, 2001
Location: Germany
Posts: 5,781
Use an int variable as a counter:
Code:
class ... extends ...;
...
var int Counter;
...

simulated function PostBeginPlay()
{
  ...
  SetTimer(0.1, True);
  ...
}

simulated function Timer()
{
  if ( Counter % 5 == 0 && Role == ROLE_Authority )
    DoServerStuff();
  
  DoAllMachinesStuff();
  Counter = ++Counter % 5; // increase counter
}
[edit] You had to wait long enough! [/edit]
Wormbo 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 10:57 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