O'Reilly logo

Unity Multiplayer Games by Alan Stagner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a game logic class

When writing game servers, it's very common that you need some central class for processing game logic. What we have right now doesn't allow for that, so we're going to modify our ack server to add a central class for processing game logic.

Our game class will accomplish the same thing that our ack server already does (sends acknowledgements in response to operation requests). It will also be able to keep track of a list of peers connected to the server, and when the server shuts down it will automatically disconnect any peers that are currently connected.

using Photon.SocketServer; using PhotonHostRuntimeInterfaces; using System.Collections.Generic; public class PhotonAckGame { public static PhotonAckGame Instance; public ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required