Panda3D
Public Member Functions | Public Attributes | Static Public Attributes

ClientRepository Class Reference

Inherits ClientRepositoryBase::ClientRepositoryBase.

List of all members.

Public Member Functions

def __init__
def allocateDoId
def createDistributedObject
def createReady
def deleteObject
def formatGenerate
def freeDoId
def getAvatarIdFromSender
def handleDatagram
def handleDelete
def handleDisable
def handleGenerate
def handleMessageType
def handleRequestGenerates
def handleSetDoIdrange
def handleUpdateField
def haveCreateAuthority
def isLocalId
def resendGenerate
def reserveDoId
def sendDeleteMsg
def sendDisconnect
def sendHeartbeat
def sendSetLocation
def sendUpdate
def sendUpdateToChannel
def setInterestZones
def setObjectZone
def stopTrackRequestDeletedDO
def storeObjectLocation

Public Attributes

 currentSenderId
 doIdAllocator
 doIdBase
 doIdLast
 interestZones
 lastHeartbeat
 ourChannel

Static Public Attributes

 doNotDeallocateChannel = True
int GameGlobalsId = 0
tuple notify = DirectNotifyGlobal.directNotify.newCategory("ClientRepository")

Detailed Description

This is the open-source ClientRepository as provided by CMU.  It
communicates with the ServerRepository in this same directory.

If you are looking for the VR Studio's implementation of the
client repository, look to OTPClientRepository (elsewhere).

Constructor & Destructor Documentation

def __init__ (   self,
  dcFileNames = None,
  dcSuffix = '',
  connectMethod = None,
  threadedNet = None 
)

Member Function Documentation

def allocateDoId (   self)
Returns a newly-allocated doId.  Call freeDoId() when the
object has been deleted. 
def createDistributedObject (   self,
  className = None,
  distObj = None,
  zoneId = 0,
  optionalFields = None,
  doId = None,
  reserveDoId = False 
)
To create a DistributedObject, you must pass in either the
name of the object's class, or an already-created instance of
the class (or both).  If you pass in just a class name (to the
className parameter), then a default instance of the object
will be created, with whatever parameters the default
constructor supplies.  Alternatively, if you wish to create
some initial values different from the default, you can create
the instance yourself and supply it to the distObj parameter,
then that instance will be used instead.  (It should be a
newly-created object, not one that has already been manifested
on the network or previously passed through
createDistributedObject.)  In either case, the new
DistributedObject is returned from this method.

This method will issue the appropriate network commands to
make this object appear on all of the other clients.

You should supply an initial zoneId in which to manifest the
object.  The fields marked "required" or "ram" will be
broadcast to all of the other clients; if you wish to
broadcast additional field values at this time as well, pass a
list of field names in the optionalFields parameters.

Normally, doId is None, to mean allocate a new doId for the
object.  If you wish to use a particular doId, pass it in
here.  If you also pass reserveDoId = True, this doId will be
reserved from the allocation pool using self.reserveDoId().
You are responsible for ensuring this doId falls within the
client's allowable doId range and has not already been
assigned to another object.  
def createReady (   self)
def deleteObject (   self,
  doId 
)
Removes the object from the client's view of the world.  This
should normally not be called directly except in the case of
error recovery, since the server will normally be responsible
for deleting and disabling objects as they go out of scope.

After this is called, future updates by server on this object
will be ignored (with a warning message).  The object will
become valid again the next time the server sends a generate
message for this doId.

This is not a distributed message and does not delete the
object on the server or on any other client.
def formatGenerate (   self,
  distObj,
  extraFields 
)
Returns a datagram formatted for sending the generate message for the indicated object. 
def freeDoId (   self,
  doId 
)
Returns a doId back into the free pool for re-use. 
def getAvatarIdFromSender (   self)
Returns the doIdBase of the client that originally sent
the current update message.  This is only defined when
processing an update message or a generate message. 
def handleDatagram (   self,
  di 
)
def handleDelete (   self,
  di 
)
def handleDisable (   self,
  di 
)
def handleGenerate (   self,
  di 
)
def handleMessageType (   self,
  msgType,
  di 
)
def handleRequestGenerates (   self,
  di 
)
def handleSetDoIdrange (   self,
  di 
)
def handleUpdateField (   self,
  di 
)
def haveCreateAuthority (   self)
Returns true if this client has been assigned a range of
doId's it may use to create objects, false otherwise. 
def isLocalId (   self,
  doId 
)
Returns true if this doId is one that we're the owner of,
false otherwise. 
def resendGenerate (   self,
  obj 
)
Sends the generate message again for an already-generated
object, presumably to inform any newly-arrived clients of this
object's current state. 
def reserveDoId (   self,
  doId 
)
Removes the indicate doId from the available pool, as if
it had been explicitly allocated.  You may pass it to
freeDoId() later if you wish. 
def sendDeleteMsg (   self,
  doId 
)
def sendDisconnect (   self)
def sendHeartbeat (   self)
def sendSetLocation (   self,
  doId,
  parentId,
  zoneId 
)
def sendUpdate (   self,
  distObj,
  fieldName,
  args 
)
Sends a normal update for a single field. 
def sendUpdateToChannel (   self,
  distObj,
  channelId,
  fieldName,
  args 
)
Sends a targeted update of a single field to a particular
client.  The top 32 bits of channelId is ignored; the lower 32
bits should be the client Id of the recipient (i.e. the
client's doIdbase).  The field update will be sent to the
indicated client only.  The field must be marked clsend or
p2p, and may not be marked broadcast. 
def setInterestZones (   self,
  interestZoneIds 
)
Changes the set of zones that this particular client is
interested in hearing about. 
def setObjectZone (   self,
  distObj,
  zoneId 
)
Moves the object into the indicated zone. 
def stopTrackRequestDeletedDO (   self,
  args 
)
def storeObjectLocation (   self,
  object,
  parentId,
  zoneId 
)

Member Data Documentation

doNotDeallocateChannel = True [static]
int GameGlobalsId = 0 [static]
tuple notify = DirectNotifyGlobal.directNotify.newCategory("ClientRepository") [static]
 All Classes Namespaces Functions Variables Properties