NPC's in LoadBalancing

Options
eyewitness4560
edited June 2013 in Photon Server
Hi guys,

Using LoadBalancing we created a test/demo application for a base of our game. After ocnnecting to a server the users are added to a room, which will be their playfield.
They can fight with eachother among the logged in players, which we implemented successfully, but we'd like to add NPC-s to the mix.
What do you guys think is the best way to go about this?
In some form or another it should be derived from the peer class, but if we do that, won't that cause problems later with counting towards CCU's?
Or is there a wildly obvious way to do this that we've overlooked? :)

PS.: We'd prefer not to use the MMO demo's files and solutions, because we're doing a simple 2D game, and don't need a coherent shared world, much more like small solarsystems, like how EVE online is doing it. (one room one solarsystem)

Please be gentle, it's our first attempt at anything like this ;)

Comments

  • Tobias
    Options
    You are posting this in the "Server" forum, so I'll assume you are fine with changing the server's logic. This makes it a lot easier to do, as the server can keep the state.

    You could add a logic for any NPC into the Room class. The Peers are there for actual users with connections to the server, so I wouldn't use them in this case.
    NPCs could directly run in a loop in the server, raise events to all (or specific clients), etc. As example: If their "move" event look like the ones sent by clients, it doesn't matter if they come from a peer or an NPC.
    You could run NPCs by scheduling messages in the room (like every 100ms or so). Then they run in the same loop/thread like user's interactions.

    I hope that helps, despite being high-level.
  • Okay, thanks for the tips, we'll keep trying :)
    Could you aslo please clarify which reference DLL's contain the event and operation implementations that we'd need for the NPC class? (we didn't need it per se, because the Peer class alredy had it implemented)

    Thanks,

    Andrew
  • The base classes are in PhotonSocketServer.dll (although those are not "open source" - sorry!) - mainly in the Photon.SocketServer.Rpc namespace (Photon.SocketServer.Rpc.Operation + Photon.SocketServer.Rpc.DataContract).

    I suggest that you browse the loadbalancing (or even better, the Lite application - because that's a bit easier to understand) to see how Photon makes use of events + operations on the server side.

    This short help topic might be interesting as well:
    http://doc.exitgames.com/photon-server/ ... -tutorials
  • Thanks a lot, we'll keep trying :)