/// <summary> /// Initializes a new instance of the <see cref="Game"/> class. /// </summary> /// <param name="application">The photon application instance the game belongs to.</param> /// <param name="gameId">The game id.</param> /// <param name="roomCache">The room cache the game belongs to.</param> /// <param name="pluginManager">plugin creator</param> /// <param name="pluginName">Plugin name which client expects to be loaded</param> /// <param name="environment">different environment parameters</param> /// <param name="executionFiber">Fiber which will execute all rooms actions</param> public Game( GameApplication application, string gameId, Hive.Caching.RoomCacheBase roomCache = null, IPluginManager pluginManager = null, string pluginName = "", Dictionary <string, object> environment = null, ExtendedPoolFiber executionFiber = null ) : base( gameId, roomCache, null, GameServerSettings.Default.MaxEmptyRoomTTL, pluginManager, pluginName, environment, GameServerSettings.Default.LastTouchSecondsDisconnect * 1000, GameServerSettings.Default.LastTouchCheckIntervalSeconds * 1000, DefaultHttpRequestQueueOptions, executionFiber ) { this.Application = application; if (this.Application.AppStatsPublisher != null) { this.Application.AppStatsPublisher.IncrementGameCount(); } this.HttpForwardedOperationsLimit = GameServerSettings.Default.HttpForwardLimit; }
public ApplicationStatsPublisher(GameApplication application, int publishIntervalMilliseconds) { this.application = application; this.publishIntervalMilliseconds = publishIntervalMilliseconds; this.fiber = new PoolFiber(); this.fiber.Start(); }
public OutgoingMasterServerPeer(MasterServerConnectionBase masterServerConnection) : base(masterServerConnection.Application) { this.masterServerConnection = masterServerConnection; this.application = masterServerConnection.Application; this.SetPrivateCustomTypeCache(this.application.GetS2SCustomTypeCache()); }
public ApplicationStatsPublisher(GameApplication application, int publishIntervalMilliseconds) { this.application = application; this.publishIntervalMilliseconds = publishIntervalMilliseconds; this.fiber = new PoolFiber(); this.fiber.Start(); }
protected MasterServerConnectionBase(GameApplication controller, string address, int port, int connectRetryIntervalSeconds) { this.Application = controller; this.Address = address; this.Port = port; this.connectRetryIntervalSeconds = connectRetryIntervalSeconds; }
public OutgoingMasterServerPeer(IRpcProtocol protocol, IPhotonPeer nativePeer, GameApplication application) : base(protocol, nativePeer) { this.application = application; log.InfoFormat("connection to master at {0}:{1} established (id={2}), serverId={3}", this.RemoteIP, this.RemotePort, this.ConnectionId, GameApplication.ServerId); this.RequestFiber.Enqueue(this.Register); }
public OutgoingMasterServerPeer(IRpcProtocol protocol, IPhotonPeer nativePeer, GameApplication application) : base(protocol, nativePeer) { this.application = application; log.InfoFormat("connection to master at {0}:{1} established (id={2}), serverId={3}", this.RemoteIP, this.RemotePort, this.ConnectionId, GameApplication.ServerId); this.RequestFiber.Enqueue(this.Register); }
protected MasterServerConnectionBase(GameApplication controller, string address, int port, int connectRetryIntervalSeconds) { this.Application = controller; this.Address = address; this.Port = port; this.connectRetryIntervalSeconds = connectRetryIntervalSeconds; }
public OutgoingMasterServerPeer(MasterServerConnectionBase masterServerConnection) : base(masterServerConnection.Application) { this.masterServerConnection = masterServerConnection; this.application = masterServerConnection.Application; this.SetPrivateCustomTypeCache(this.application.GetS2SCustomTypeCache()); }
/// <summary> /// Initializes a new instance of the <see cref="Game"/> class. /// </summary> /// <param name="application">The photon application instance the game belongs to.</param> /// <param name="gameId">The game id.</param> /// <param name="roomCache">The room cache the game belongs to.</param> /// <param name="pluginManager">plugin creator</param> /// <param name="pluginName">Plugin name which client expects to be loaded</param> /// <param name="environment">different environment parameters</param> /// <param name="executionFiber">Fiber which will execute all rooms actions</param> public Game( GameApplication application, string gameId, Hive.Caching.RoomCacheBase roomCache = null, IPluginManager pluginManager = null, string pluginName = "", Dictionary<string, object> environment = null, ExtendedPoolFiber executionFiber = null ) : base(gameId, roomCache, null, GameServerSettings.Default.MaxEmptyRoomTTL, pluginManager, pluginName, environment, GameServerSettings.Default.LastTouchSecondsDisconnect * 1000, GameServerSettings.Default.LastTouchCheckIntervalSeconds * 1000, DefaultHttpRequestQueueOptions, executionFiber) { this.Application = application; if (this.Application.AppStatsPublisher != null) { this.Application.AppStatsPublisher.IncrementGameCount(); } this.HttpForwardedOperationsLimit = GameServerSettings.Default.HttpForwardLimit; }
public LatencyPeer(GameApplication application, IRpcProtocol protocol, IPhotonPeer nativePeer) : base(protocol, nativePeer) { this.Application = application; if (log.IsDebugEnabled) { log.DebugFormat("Latency monitoring client connected, serverId={0}", this.Application.ServerId); } }
public GameClientPeer(InitRequest initRequest, GameApplication application) : base(initRequest.Protocol, initRequest.PhotonPeer) { this.application = application; this.PeerId = string.Empty; if (GameApplication.Instance.AppStatsPublisher != null) { GameApplication.Instance.AppStatsPublisher.IncrementPeerCount(); } }
public GameClientPeer(InitRequest initRequest, GameApplication application) : base(initRequest.Protocol, initRequest.PhotonPeer) { this.application = application; this.PeerId = string.Empty; if (GameApplication.Instance.AppStatsPublisher != null) { GameApplication.Instance.AppStatsPublisher.IncrementPeerCount(); } }
private readonly LogCountGuard connectionFailedGuard = new LogCountGuard(new TimeSpan(0, 1, 0));//once per minute #endregion #region .ctr protected MasterServerConnectionBase(GameApplication controller, string address, int port, int connectRetryIntervalSeconds) { this.Application = controller; this.Address = address; this.Port = port; this.connectRetryIntervalSeconds = connectRetryIntervalSeconds; if (log.IsDebugEnabled) { log.DebugFormat("ConnectionId={0}", this.ConnectionId); } }
public GameClientPeer(InitRequest initRequest, GameApplication application) : base(initRequest) { this.application = application; if (this.application.AppStatsPublisher != null) { this.application.AppStatsPublisher.IncrementPeerCount(); } this.HttpRpcCallsLimit = CommonSettings.Default.HttpRpcCallsLimit; }
public GameClientPeer(InitRequest initRequest, GameApplication application) : base(initRequest) { this.application = application; if (this.application.AppStatsPublisher != null) { this.application.AppStatsPublisher.IncrementPeerCount(); } this.HttpRpcCallsLimit = CommonSettings.Default.HttpRpcCallsLimit; }
public OutgoingMasterServerPeer(MasterServerConnectionBase masterServerConnection) : base(masterServerConnection.Application) { this.masterServerConnection = masterServerConnection; this.application = masterServerConnection.Application; this.SetPrivateCustomTypeCache(this.application.GetS2SCustomTypeCache()); if (CommonSettings.Default.UseLoadPrediction) { var configFile = GameServerSettings.Default.PredictionConfigFile; var applicationRootPath = masterServerConnection.Application.ApplicationRootPath; this.loadStatsCollector = new LoadStatsCollector(applicationRootPath, configFile, GameServerSettings.Default.PredictionFactor); } }
/// <summary> /// Initializes a new instance of the <see cref="Game"/> class. /// </summary> /// <param name="gameCreateOptions"></param> public Game(LBGameCreateOptions gameCreateOptions) : base(gameCreateOptions.GameCreateOptions) { this.Application = gameCreateOptions.Application; if (this.Application.AppStatsPublisher != null) { this.Application.AppStatsPublisher.IncrementGameCount(); } this.HttpForwardedOperationsLimit = GameServerSettings.Default.HttpForwardLimit; this.LastTouchLimitMilliseconds = GameServerSettings.Default.LastTouchSecondsDisconnect * 1000; this.EventCache.SlicesCountLimit = GameServerSettings.Default.EventCacheSlicesCountLimit; this.EventCache.CachedEventsCountLimit = GameServerSettings.Default.EventCacheEventsCountLimit; this.ActorEventCache.CachedEventsCountLimit = GameServerSettings.Default.ActorEventCacheEventsCountLimit; }
public LBGameCreateOptions(GameApplication application, string gameId, Hive.Caching.RoomCacheBase roomCache = null, IPluginManager pluginManager = null, Dictionary <string, object> environment = null, ExtendedPoolFiber executionFiber = null, IPluginLogMessagesCounter logMessagesCounter = null ) : this() { this.Application = application; this.GameCreateOptions = new GameCreateOptions(gameId, roomCache, pluginManager, GameServerSettings.Default.MaxEmptyRoomTTL) { HttpRequestQueueOptions = DefaultHttpRequestQueueOptions, Environment = environment, ExecutionFiber = executionFiber, LogMessagesCounter = logMessagesCounter }; }
public LatencyMonitor( GameApplication application, IRpcProtocol protocol, IPhotonPeer nativePeer, byte operationCode, int maxHistoryLength, int intervalMs, WorkloadController workloadController) : base(protocol, nativePeer) { this.Application = application; this.operationCode = operationCode; this.intervalMs = intervalMs; this.workloadController = workloadController; this.latencyHistory = new ValueHistory(maxHistoryLength); this.averageLatencyMs = 0; this.lastLatencyMs = 0; log.InfoFormat("{1} connection for latency monitoring established (id={0}), serverId={2}", this.ConnectionId, this.NetworkProtocol, this.Application.ServerId); if (!Stopwatch.IsHighResolution) { log.InfoFormat("No hires stopwatch!"); } this.pingTimer = this.RequestFiber.ScheduleOnInterval(this.Ping, 0, this.intervalMs); }
public TestGame(GameApplication application, string gameId, RoomCacheBase roomCache = null, IPluginManager pluginManager = null, string pluginName = "", Dictionary<string, object> environment = null) : base(application, gameId, roomCache, pluginManager, pluginName, environment) { }
public GameClientPeer(InitRequest initRequest, GameApplication application) : this(initRequest, application, false) { }
public ChatGamePeer(InitRequest initRequest, GameApplication application) : base(initRequest, application) { }
protected GameClientPeer(InitRequest initRequest, GameApplication application, bool derived) : base(initRequest) { this.application = application; if (this.application.AppStatsPublisher != null) { this.application.AppStatsPublisher.IncrementPeerCount(); } this.HttpRpcCallsLimit = CommonSettings.Default.WebRpcHttpCallsLimit; var token = initRequest.InitObject as string; AuthenticationToken authToken = null; if (!string.IsNullOrEmpty(token)) { ErrorCode errorCode; string errorMsg; authToken = AuthOnInitHandler.DoAuthUsingInitObject(token, this, initRequest, application.TokenCreator, out errorCode, out errorMsg); if (authToken == null) { this.RequestFiber.Enqueue(() => this.SendOperationResponse(new OperationResponse((byte)OperationCode.AuthOnce) { DebugMessage = errorMsg, ReturnCode = (short)errorCode }, new SendParameters())); this.ScheduleDisconnect(); } } else if (initRequest.DecryptedAuthToken != null) { authToken = (AuthenticationToken)initRequest.DecryptedAuthToken; this.binaryTokenUsed = true; } if (authToken != null) { this.authOnceUsed = true; this.AuthToken = authToken; if (!derived) { if (!ConnectionRequirementsChecker.Check(this, authToken.ApplicationId, authToken, this.authOnceUsed)) { log.Warn(secureConnectionLogGuard, $"Client used non secure connection type when it is required. appId:{authToken.ApplicationId}, Connection: {this.NetworkProtocol}. AuthOnce"); return; } this.SetupPeer(this.AuthToken); this.RequestFiber.Enqueue(() => { var responseObject = new AuthenticateResponse { QueuePosition = 0 }; this.SendOperationResponse(new OperationResponse((byte)OperationCode.AuthOnce, responseObject), new SendParameters()); }); } } }
public TestGameCache(GameApplication application) : base(application) { this.pluginManager = new TestPluginManager(); }
public GameCache(GameApplication application) { this.Application = application; this.pluginManager = new PluginManager(application.ApplicationRootPath); }
public MasterServerConnection(GameApplication controller, string address, int port, int connectRetryIntervalSeconds) : base(controller, address, port, connectRetryIntervalSeconds) { }
public GameCache(GameApplication application) { this.Application = application; this.pluginManager = new PluginManager(application.ApplicationRootPath); Photon.Hive.Configuration.PluginSettings.ConfigUpdated += () => OnPluginSettingsUpdated(); }
public GameCache(GameApplication application) { this.Application = application; this.pluginManager = new PluginManager(application.ApplicationRootPath); }
public MasterServerConnection(GameApplication controller, string address, int port, int connectRetryIntervalSeconds) : base(controller, address, port, connectRetryIntervalSeconds) { }
public GameClientPeer(InitRequest initRequest, GameApplication application) : base(initRequest, application) { }