Panda3D
Loading...
Searching...
No Matches
TimeManager Class Reference
Inheritance diagram for TimeManager:
DistributedObject DistributedObjectBase DirectObject

Public Member Functions

 __init__ (self, cr)
 
 announceGenerate (self)
 
 delete (self)
 
 disable (self)
 
 doUpdate (self, task)
 
 generate (self)
 DistributedObject methods ###.
 
 handleClockError (self)
 Automatic clock error handling ###.
 
 serverTime (self, context, timestamp)
 
 startTask (self)
 Task management methods ###.
 
 stopTask (self)
 
 synchronize (self, description)
 Synchronization methods ###.
 
- Public Member Functions inherited from DistributedObject
 __init__ (self, cr)
 
 addInterest (self, zoneId, note="", event=None)
 
 b_setLocation (self, parentId, zoneId)
 
 d_setLocation (self, parentId, zoneId)
 
 deleteOrDelay (self)
 
 disableAndAnnounce (self)
 
 disableAnnounceAndDelete (self)
 
 doCallbackContext (self, context, args)
 
 doneBarrier (self, name=None)
 
 execCommand (self, string, mwMgrId, avId, zoneId)
 
 flushCachedData (self, name)
 
 generateInit (self)
 
 getAutoInterests (self)
 
 getBarrierData (self)
 
 getCacheable (self)
 
 getCachedData (self, name)
 
 getCallback (self, context)
 
 getCallbackArgs (self, context)
 
 getCallbackContext (self, callback, extraArgs=[])
 
 getCurrentContexts (self)
 
 getDelayDeleteCount (self)
 
 getDelayDeleteEvent (self)
 
 getDisableEvent (self)
 
 getDoId (self)
 
 getLocation (self)
 
 getNeverDisable (self)
 
 getParentObj (self)
 
 hasCachedData (self, name)
 
 isDisabled (self)
 
 isGenerated (self)
 
 isGridParent (self)
 
 isLocal (self)
 
 postGenerateMessage (self)
 
 removeInterest (self, handle, event=None)
 
 sendDeleteMsg (self)
 
 sendDisableMsg (self)
 
 sendUpdate (self, fieldName, args=[], sendToId=None)
 
 setBarrierData (self, data)
 
 setCacheable (self, bool)
 
 setCachedData (self, name, data)
 
 setLocation (self, parentId, zoneId)
 
 setNeverDisable (self, bool)
 
 status (self, indent=0)
 
 taskName (self, taskString)
 
 uniqueName (self, idString)
 
 updateAllRequiredFields (self, dclass, di)
 
 updateRequiredFields (self, dclass, di)
 
 updateRequiredOtherFields (self, dclass, di)
 
- Public Member Functions inherited from DistributedObjectBase
 __init__ (self, cr)
 
 handleChildArrive (self, childObj, zoneId)
 
 handleChildArriveZone (self, childObj, zoneId)
 
 handleChildLeave (self, childObj, zoneId)
 
 handleChildLeaveZone (self, childObj, zoneId)
 
 handleQueryObjectChildrenLocalDone (self, context)
 
 hasParentingRules (self)
 
- Public Member Functions inherited from DirectObject
 __init__ (self)
 
 accept (self, event, method, extraArgs=[])
 
 acceptOnce (self, event, method, extraArgs=[])
 
 addTask (self, *args, **kwargs)
 
 detectLeaks (self)
 
 doMethodLater (self, *args, **kwargs)
 
 getAllAccepting (self)
 
 ignore (self, event)
 
 ignoreAll (self)
 
 isAccepting (self, event)
 
 isIgnoring (self, event)
 
 removeAllTasks (self)
 
 removeTask (self, taskOrName)
 

Public Attributes

int attemptCount = 0
 
 doUpdate
 
 handleClockError
 
int lastAttempt = -self.minWait*2
 
int nextContext = 0
 
int start = 0
 
int talkResult = 0
 
int thisContext = -1
 
- Public Attributes inherited from DistributedObject
 activeState = ESNew
 
 autoInterests = autoInterests
 
 cacheable = ESGenerated:
 
 dclass = None
 
 destroyDoStackTrace
 
int DistributedObject_deleted = 1
 
int DistributedObject_initialized = 1
 
- Public Attributes inherited from DistributedObjectBase
 cr = cr
 
 doId
 
int parentId = None
 
 zoneId = None
 

Static Public Attributes

 extraSkew = ConfigVariableInt('time-manager-extra-skew', 0).getValue()
 
 maxAttempts = ConfigVariableInt('time-manager-max-attempts', 5).getValue()
 
 maxUncertainty = ConfigVariableDouble('time-manager-max-uncertainty', 1).getValue()
 
 minWait = ConfigVariableDouble('time-manager-min-wait', 10).getValue()
 
 reportFrameRateInterval = ConfigVariableDouble('report-frame-rate-interval', 300.0).getValue()
 
 updateFreq = ConfigVariableDouble('time-manager-freq', 1800).getValue()
 
- Static Public Attributes inherited from DistributedObject
int neverDisable = 0
 
- Static Public Attributes inherited from DistributedObjectBase
 notify = directNotify.newCategory("DistributedObjectBase")
 
- Static Public Attributes inherited from DirectObject
 accept_once = acceptOnce
 
 add_task = addTask
 
 detect_leaks = detectLeaks
 
 do_method_later = doMethodLater
 
 get_all_accepting = getAllAccepting
 
 ignore_all = ignoreAll
 
 is_accepting = isAccepting
 
 is_ignoring = isIgnoring
 
 remove_all_tasks = removeAllTasks
 
 remove_task = removeTask
 

Additional Inherited Members

- Protected Member Functions inherited from DistributedObject
 _deactivateDO (self)
 
 _destroyDO (self)
 
 _retrieveCachedData (self)
 
- Protected Member Functions inherited from DirectObject
 _addTask (self, task)
 
 _clearTask (self, task)
 
- Protected Attributes inherited from DistributedObject
 _cachedData = self.cr.doDataCache.popCachedData(self.doId)
 
int _delayDeleted = 0
 
bool _delayDeleteForceAllow = False
 
dict _token2delayDeleteName = {}
 
- Protected Attributes inherited from DirectObject
dict _taskList = {}
 

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

◆ __init__()

__init__ ( self,
cr )

Member Function Documentation

◆ announceGenerate()

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.

◆ delete()

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

Reimplemented from DistributedObject.

◆ disable()

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

Reimplemented from DistributedObject.

◆ doUpdate()

doUpdate ( self,
task )

◆ generate()

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.

◆ handleClockError()

handleClockError ( self)

Automatic clock error handling ###.

◆ serverTime()

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.

◆ startTask()

startTask ( self)

Task management methods ###.

◆ stopTask()

stopTask ( self)

◆ synchronize()

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

◆ attemptCount

int attemptCount = 0

◆ doUpdate

doUpdate

◆ extraSkew

extraSkew = ConfigVariableInt('time-manager-extra-skew', 0).getValue()
static

◆ handleClockError

handleClockError

◆ lastAttempt

int lastAttempt = -self.minWait*2

◆ maxAttempts

maxAttempts = ConfigVariableInt('time-manager-max-attempts', 5).getValue()
static

◆ maxUncertainty

maxUncertainty = ConfigVariableDouble('time-manager-max-uncertainty', 1).getValue()
static

◆ minWait

minWait = ConfigVariableDouble('time-manager-min-wait', 10).getValue()
static

◆ nextContext

int nextContext = 0

◆ reportFrameRateInterval

reportFrameRateInterval = ConfigVariableDouble('report-frame-rate-interval', 300.0).getValue()
static

◆ start

int start = 0

◆ talkResult

int talkResult = 0

◆ thisContext

int thisContext = -1

◆ updateFreq

updateFreq = ConfigVariableDouble('time-manager-freq', 1800).getValue()
static