Hi there, I’ve been spending the last few days trying to understand and learn how the Distributed Networking system works. Due to the poor documentation I’ve grabbed and read the code posted here [url]DistributedNode]
and made some (minor) modifications to it (add an environment, use the panda actor included in Panda3d and now I’m trying to make them shoot each other).
This is rather experimental and with the only purpose of getting how does DistributedSystem works so I ain’t concerned with more advanced issues such as securtity (e.g don’t trust the client), etc.
So, each distributed panda has it’s own collision sphere to detect collisions between them, as done in page 4 of the mentioned thread. To simulate the bullets I make the panda shoot a Collision Ray into the direction he’s facing and see if it collides into another’s panda sphere. So far so good, the panda that makes the shoot detects succesfully if he hits another panda.
However, I would need to decrease the hitted panda’s health. I thought of doing something like:
def bulletHit(self, entry):
#This NP holds ths collision node of the impacted panda
intoNP = entry.getIntoNodePath()
# I thought this NP would point to the Distributed Actor class. It points to an actor instance instead
hitPandaNP = intoNP.getParent()
# So the following raises an error
hitPandaNP.b_setDamage(whatever)
The error states that the
Summing up, is there a way to reference a Distributed Object (a panda in this particular case) instance belonging to other client/player?
If this is indeed possible, the setDamage method should have the clsend keyword, as I am calling it from another client… is this assumption right?