Sending updates from the server?

Options
oxyscythe
edited May 2013 in Photon Server
Hi,

Just trying to understanding the correct use of Events, Operations, Requests and Responses a bit more so I thought I'd post my conundrum here.

I've got a simulation that runs on the server over a bunch of game objects updating their positions. These objects are then visualised on the clients. But they are owned by the server really. Even though the clients can mess around with the simulation by simple interactions with these objects the simulation is really owned by the server.

So, the server simulation side of things is all hooked up and I am now at the point where I need to start updating clients with information about these objects so I can visualise them.

Looking at the documentation I find a lot of resources on client to client messaging,through clients firing operation requests to the server (http://doc.exitgames.com/photon-server/Adding_Operations/#cat-tutorials), but how do I start a message from the server in order to actually update clients about the state of the simulation? Even Events which seem to be the closest to what I need (http://doc.exitgames.com/photon-server/HelloWorldPart2/#oehw2) look like they still need to start at the client first requesting the event to trigger?

Is this even the right way to be thinking about this? Should I maybe actually design it so that client objects 'proactively' request 'update information' from the server through an operation request? Is this why the framework seems so bent on communication always starting on the client end?

As you can tell a combination of Photon and general networking noobness is causing me a fair amount of confusion :)

Comments

  • [Deleted User]
    Options
    Sorry that it took so long for an answer.

    Basically, "Operations" are requests that are sent by the client. In most cases, the server sends an operation response to the same client.

    You can think of an "event" as a message that is sent to one or multiple clients. It can be triggered by an operation (e.g.: if a client sends a "JoinGame" request, a "Join" event is sent to the other clients in that game to notify them that a new client has joined.).

    An event can also be triggered by some server code. You can add a timer (or use the RequestFiber.Schedule() or RequestFiber.ScheduleOnInterval() methods of the PeerBase class) that regularly sends events to your clients.

    Raising events from server-side code is perfectly fine and there is no need to "poll" information from the clients. :)