private void Initialize()
        {
            Client = new NetClient(
                new NetPeerConfiguration(ClientConfiguration.ServerPeerName)
            {
                AcceptIncomingConnections = true,
                EnableUPnP         = true,
                AutoFlushSendQueue = true
            });
            Client.Start();
            Client.Connect(ClientConfiguration.ServerIp, ClientConfiguration.ServerPort);

            var serializerType = GetSerializer(ClientConfiguration.SerializationAdapterType);

            //var serializerType = ClientConfiguration.SerializationAdapterType.LoadType(true, false)?.FirstOrDefault();
            SerializationAdapter = Activator.CreateInstance(serializerType) as ISerializationAdapter;
            Input  = new NetIncomingMessageBusService <NetClient>(Client);
            Output = new NetOutgoingMessageBusService <NetClient>(Client, SerializationAdapter);
            NetworkCommandDataConverterService = new NetworkCommandDataConverterService(SerializationAdapter);
            NetIncomingMessageNetworkCommand   = new NetIncomingMessageNetworkCommandConnectionTranslator(new NetworkCommandTranslator(SerializationAdapter));
        }
        public WorldGame
        (
            GameServerConfiguration configuration
        )
        {
            Configuration = configuration;
            var leSerializationType = configuration.SerializationAdapterType.LoadType(true, false)[0];

            SerializationAdapter    = Activator.CreateInstance(leSerializationType) as ISerializationAdapter;
            GameSectorLayerServices = new Dictionary <string, IStateMachine <string, IGameSectorLayerService> >();
            SectorStateMachine      = new InMemoryStorageGameSectorLayerServiceFactory();
            AuthenticationService   = new ExampleLoginAndRegistrationService();
            CreateServer(
                Configuration.ServerPeerName,
                Configuration.ServerIp,
                Configuration.ServerPort);

            //translator
            var serverTranslator        = new NetworkCommandTranslator(SerializationAdapter);
            var serverMessageTranslator = new NetIncomingMessageNetworkCommandConnectionTranslator(serverTranslator);


            var cliPassthrough = new CLIPassthroughMechanic(AuthenticationService, Configuration.RunOperation);
            var writer         = new GameSectorLayerWriterMechanic
            {
                RedisHost = Configuration.RedisHost,
                RedisPort = Configuration.RedisPort
            };
            var rediCliPassthrough = new RedisCLIPassthroughMechanic(AuthenticationService)
            {
                RedisHost = Configuration.RedisHost,
                RedisPort = Configuration.RedisPort
            };

            SectorsOwnerMechanics = new List <ISingleUpdeatableMechanic <IGameSectorsOwner, IGameSectorsOwner> >
            {
                //routeTrespassingMarker,
                //playerShifter,
                cliPassthrough,
                rediCliPassthrough,
                writer
            };

            //create default starting sector
            //AddSectorStateMachine(Configuration.StartingSector);
            BuildSector(
                Configuration.StartingSector,
                Configuration.StartingSector,
                Configuration.StartingSector,
                Configuration.StartingSector,
                Configuration.StartingSector);


            var inGameSectorStateMachine = GameSectorLayerServices[Configuration.StartingSector];

            inGameSectorStateMachine.SharedContext = new GameSectorLayerService
            {
                Tag = Configuration.StartingSector
            };

            //inGameSectorStateMachine.SharedContext.CurrentStatus = GameSectorStatus.Running;
            inGameSectorStateMachine
            .GetService
            .Get(Configuration.BuildOperation)
            .Handle(inGameSectorStateMachine);



            //var sectorList = new List<string>();
            //for (int sectorIndex = 0; sectorIndex < 1; sectorIndex++)
            //{
            //    var sectorId = Guid.NewGuid().ToString();

            //    var sectorDown = Configuration.StartingSector;
            //    var sectorUp = Configuration.StartingSector;
            //    var sectorLeft = Configuration.StartingSector;
            //    var sectorRight = Configuration.StartingSector;

            //    if (sectorIndex - 4 > 0)
            //        sectorDown = sectorList[sectorIndex - 4];
            //    if (sectorIndex - 3 > 0)
            //        sectorUp = sectorList[sectorIndex - 3];
            //    if (sectorIndex - 2 > 0)
            //        sectorLeft = sectorList[sectorIndex - 2];
            //    if (sectorIndex - 1 > 0)
            //        sectorRight = sectorList[sectorIndex - 1];

            //    sectorList.Add(sectorId);
            //    BuildSector(sectorId, sectorUp, sectorLeft, sectorRight, sectorDown);
            //}



            //datalayer to gather data out of the game world
            var serverStateDataLayer = new ServerGameStateService <WorldGame>(
                AuthenticationService,
                AuthenticationService,
                this,
                SerializationAdapter);

            //hard coded logger here


            GameStateContext = new ServerNetworkGameStateContext <WorldGame>(
                ServerInput,
                ServerOutput,
                serverMessageTranslator,
                serverStateDataLayer,
                GetLogger());

            GameStateContext.Initialize();

            //Language script file
            LanguageScriptFileEvaluator languageScriptFileEvaluator = new LanguageScriptFileEvaluator(Configuration.StartupScript, Configuration.StartupFunction, Configuration.RunOperation);

            foreach (var sector in GameSectorLayerServices.Values)
            {
                languageScriptFileEvaluator.Evaluate(sector);
            }

            Console.WriteLine("runner starting..." + Configuration.StartupFunction);
            CreateGameTimeIfNotExists(null);
            Console.WriteLine(CurrentGameTime);
            foreach (var sector in GameSectorLayerServices.Values)
            {
                sector.SharedContext.CurrentGameTime = CurrentGameTime;
                sector.Run(Configuration.StartupFunction);
            }
        }