Players see each other

The players need to see each other in the game. How can I provide this?

I presume that you’re referring to a networked situation? If so, then, in short, I would imagine that for each other player you’d load a model that copies the appearance of that player, and that mimics said player’s actions as informed by network messages.

Game is offline. Players will act with multi-agent reinforcement learning. Player needs to see and know each other. the model has camera, but I don’t know how to perceive the vision.

How are you handling communication between players? By LAN? Or are they all simultaneously operating a single instance of the game, perhaps via multiple controllers plugged into one computer?

I’m not quite sure of what you mean by this–could you clarify please? Are you saying that you want each player to be able to see the scene as rendered for each other player?

In addition to the math with the size of the camera lens, you can use CallbackNode, which sends a callback when it is in the rendering stage.

from panda3d.core import CallbackNode, OccluderNode, Point3, BoundingBox
from direct.showbase.ShowBase import ShowBase

class Game(ShowBase):
    def __init__(self):

        cbnode = CallbackNode("Player")
        cbnp = render.attachNewNode(cbnode)

        mpanda = loader.loadModel("panda")
        mpanda.setPos(50, 50, -20)

        occluder = OccluderNode("occluder")
        occluder.setVertices(Point3(0, 0, 0), Point3(130, 0, 0), Point3(100, 100, 0), Point3(0, 100, 0))
        occluder_nodepath = render.attachNewNode(occluder)


        base.trackball.node().set_pos(-50, 300, -70)

    def init(self, cbdata):
        print (cbdata.getData().node().getName())

game = Game()

If you want to implement this:

  1. Create a basic player model.
  2. In your multiplayer connection, tell all the clients to send their data to the server, and the server to send it back.
  3. Based on the info the client has retrieved, load the models and manipulate it based on the info from the server.
  4. Do this every frame, or some time that seems suitable to you.