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): ShowBase.__init__(self) cbnode = CallbackNode("Player") cbnode.setBounds(BoundingBox()) cbnode.setCullCallback(self.init) cbnp = render.attachNewNode(cbnode) cbnp.showBounds() mpanda = loader.loadModel("panda") mpanda.reparentTo(cbnp) 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) occluder_nodepath.show() render.setOccluder(occluder_nodepath) base.trackball.node().set_pos(-50, 300, -70) base.trackball.node().set_p(45) def init(self, cbdata): print (cbdata.getData().node().getName()) cbdata.upcall() game = Game() game.run()
If you want to implement this:
- Create a basic player model.
- In your multiplayer connection, tell all the clients to send their data to the server, and the server to send it back.
- Based on the info the client has retrieved, load the models and manipulate it based on the info from the server.
- Do this every frame, or some time that seems suitable to you.