Panda3D
Public Member Functions | Public Attributes | Static Public Attributes

TimeManager Class Reference

Inheritance diagram for TimeManager:
DistributedObject

List of all members.

Public Member Functions

def __init__
def announceGenerate
def delete
def disable
def doUpdate
def generate
 DistributedObject methods ###.
def handleClockError
 Automatic clock error handling ###.
def serverTime
def startTask
 Task management methods ###.
def stopTask
def synchronize
 Synchronization methods ###.

Public Attributes

 attemptCount
 lastAttempt
 nextContext
 start
 talkResult
 thisContext

Static Public Attributes

tuple extraSkew = base.config.GetInt('time-manager-extra-skew', 0)
tuple maxAttempts = base.config.GetInt('time-manager-max-attempts', 5)
tuple maxUncertainty = base.config.GetFloat('time-manager-max-uncertainty', 1)
tuple minWait = base.config.GetFloat('time-manager-min-wait', 10)
tuple notify = DirectNotifyGlobal.directNotify.newCategory("TimeManager")
tuple reportFrameRateInterval = base.config.GetDouble('report-frame-rate-interval', 300.0)
tuple updateFreq = base.config.GetFloat('time-manager-freq', 1800)

Detailed Description

This DistributedObject lives on the AI and on the client side, and
serves to synchronize the time between them so they both agree, to
within a few hundred milliseconds at least, what time it is.

It uses a pull model where the client can request a
synchronization check from time to time.  It also employs a
round-trip measurement to minimize the effect of latency.

Constructor & Destructor Documentation

def __init__ (   self,
  cr 
)

Reimplemented from DistributedObject.


Member Function Documentation

def announceGenerate (   self)
Sends a message to the world after the object has been
generated and all of its required fields filled in.

Reimplemented from DistributedObject.

def delete (   self)
This method is called when the DistributedObject is permanently
removed from the world and deleted from the cache.

Reimplemented from DistributedObject.

def disable (   self)
This method is called when the DistributedObject is removed from
active duty and stored in a cache.

Reimplemented from DistributedObject.

def doUpdate (   self,
  task 
)
def generate (   self)

DistributedObject methods ###.

This method is called when the DistributedObject is reintroduced
to the world, either for the first time or from the cache.

Reimplemented from DistributedObject.

def handleClockError (   self)

Automatic clock error handling ###.

def serverTime (   self,
  context,
  timestamp 
)
serverTime(self, int8 context, int32 timestamp)

This message is sent from the AI to the client in response to
a previous requestServerTime.  It contains the time as
observed by the AI.

The client should use this, in conjunction with the time
measurement taken before calling requestServerTime (above), to
determine the clock delta between the AI and the client
machines.
def startTask (   self)

Task management methods ###.

def stopTask (   self)
def synchronize (   self,
  description 
)

Synchronization methods ###.

synchronize(self, string description)

Call this function from time to time to synchronize watches
with the server.  This initiates a round-trip transaction;
when the transaction completes, the time will be synced.

The description is the string that will be written to the log
file regarding the reason for this synchronization attempt.

The return value is true if the attempt is made, or false if
it is too soon since the last attempt.

Member Data Documentation

tuple extraSkew = base.config.GetInt('time-manager-extra-skew', 0) [static]
tuple maxAttempts = base.config.GetInt('time-manager-max-attempts', 5) [static]
tuple maxUncertainty = base.config.GetFloat('time-manager-max-uncertainty', 1) [static]
tuple minWait = base.config.GetFloat('time-manager-min-wait', 10) [static]
tuple notify = DirectNotifyGlobal.directNotify.newCategory("TimeManager") [static]

Reimplemented from DistributedObject.

tuple reportFrameRateInterval = base.config.GetDouble('report-frame-rate-interval', 300.0) [static]
tuple updateFreq = base.config.GetFloat('time-manager-freq', 1800) [static]
 All Classes Namespaces Functions Variables Properties