public Server(GlobalHost globalHost, ActionSyncronizer sync, int serverSpawnDensity) { Host = globalHost.NewHost(Server.hostName, Game.Convert(AssignProcessor), BasicInfo.GenerateHandshake(NodeRole.SERVER), Aggregator.shortInactivityWait); base.serverHost = Address; this.serverSpawnDensity = serverSpawnDensity; }
public PlayerValidator(PlayerInfo info, GlobalHost globalHost, OverlayEndpoint serverHost, PlayerData playerData) { this.info = info; this.serverHost = serverHost; this.playerData = playerData; Host = globalHost.NewHost(info.validatorHost.hostname, Game.Convert(AssignProcessor), BasicInfo.GenerateHandshake(NodeRole.PLAYER_VALIDATOR, info), Aggregator.longInactivityWait); SetConnectionHook(ProcessNewConnection); }
public PlayerAgent(PlayerInfo info, GlobalHost globalHost, OverlayEndpoint serverHost, Client myClient) { this.Info = info; this.serverHost = serverHost; this.myClient = myClient; this.Data = null; Host = globalHost.NewHost(info.playerHost.hostname, Game.Convert(AssignProcessor), BasicInfo.GenerateHandshake(NodeRole.PLAYER_AGENT, info), Aggregator.longInactivityWait); ConnectAsync(info.validatorHost, (di) => ProcessPlayerValidatorDisconnect(di, info)); Log.Console("Player Agent {0}", info.GetShortInfo()); }
//public Action<World> onNewWorldHook = (a) => { }; //public Action<World> onDeleteWorldHook = (a) => { }; //public Action<PlayerInfo> onNewMyPlayerHook = (a) => { }; //public Action<World, PlayerInfo, Point, ActionValidity> onMoveHook = (a, b, c, d) => { }; //public Action<World, PlayerInfo, bool> onPlayerLeaveHook = (a, b, c) => { }; //Func<WorldInitializer, World> generateWorld; public Client(GlobalHost globalHost, Aggregator all, Func <WorldInitializer, World> generateWorld) { this.all = all; //this.generateWorld = generateWorld; Host = globalHost.NewHost(Client.hostName, Game.Convert(AssignProcessor), BasicInfo.GenerateHandshake(NodeRole.CLIENT), Aggregator.longInactivityWait); SetConnectionHook(ProcessNewConnection); Action <WorldInfo> subscribe = wi => MessageWorld(wi, MessageType.SUBSCRIBE); Action <WorldInfo> unsubscribe = wi => MessageWorld(wi, MessageType.UNSUBSCRIBE); TrackedWorldData data = new TrackedWorldData() { generateWorld = generateWorld, recordWorldInfo = null, subscribe = subscribe, unsubscribe = unsubscribe }; worlds = new WorldDatabase(data); connectedPlayers = new PlayerDatabase(p => worlds.At(p).Track(), p => worlds.At(p).Untrack(), inf => worlds.At(inf.position).SetWorldInfo(inf)); }