示例#1
0
 def app(*args, **kwargs):
     client = Node(client_app,
                   dataframe=(self.host, self.port),
                   Types=[Player, observation_class, ServerState],
                   threading=True)
     client.start(self, main_func, observation_class, dimension_names,
                  self.host, self.auth_key, *args, **kwargs)
示例#2
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--host',
        type=str,
        default='127.0.0.1',
        help='The hostname of the remote dataframe (default: 127.0.0.1)')
    parser.add_argument(
        '--port',
        type=int,
        default=8000,
        help='The port of the remote dataframe (default: 8000)')
    parser.add_argument(
        '--player',
        type=str,
        default='datamodel.Player',
        help='The class of your player (default: datamodel.Player)')
    args = parser.parse_args()

    my_print("%s %s %s" % (args.host, args.port, args.player))

    player_client = Node(bot_driver,
                         dataframe=(args.host, args.port),
                         Types=[Player, Asteroid, Ship])
    player_client.start(get_class(args.player))
def get_cache_server(config, restart):
    init_node = Node(init,
                     Types=[Register],
                     dataframe=(config.host, config.port),
                     threading=True)
    return init_node.start(config.user_agent, restart
                           or not os.path.exists(config.save_file))
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--host',
        type=str,
        default='127.0.0.1',
        help='The hostname of the remote dataframe (default: 127.0.0.1)')
    parser.add_argument(
        '--port',
        type=int,
        default=8000,
        help='The port of the remote dataframe (default: 8000)')
    args = parser.parse_args()

    my_print("%s %s" % (args.host, args.port))

    player_client = Node(visualize,
                         dataframe=(args.host, args.port),
                         Types=[Asteroid, Ship])
    player_client.start()
def get_cache_server(config, restart):
    print("get cache server runs")
    init_node = Node(init,
                     Types=[Register],
                     dataframe=(config.host, config.port))
    print("node created")
    print("restart: ", restart)
    print("config user agent: ", config.user_agent)
    print("config.save_file: ", config.save_file)
    print("os.path.exists: ", os.path.exists(config.save_file))
    print("restart or not os.path.exists(config.save_file):", restart
          or not os.path.exists(config.save_file))
    return init_node.start(config.user_agent, restart
                           or not os.path.exists(config.save_file))
    def run(self) -> None:
        port = self.match_server_args['port']
        observation_type = Observation(self.env_class.observation_names())

        # App blocks until the server has ended
        app = Node(server_app, server_port=port, Types=[Player, ServerState])
        rankings = app.start(self.env_class, observation_type,
                             self.match_server_args, self.whitelist,
                             self.ready)
        del app

        # Update player information
        if isinstance(rankings, dict):
            self.database.update_ranking(rankings)

        for user in self.player_list:
            self.database.logoff(user)

        # Cleanup
        self.ports_to_use_queue.put(port)
        self.match_limit.release()
示例#7
0
                        help="Config string that will be passed into the environment constructor.")
    parser.add_argument("--port", "-p", type=int, default=7777,
                        help="Server Port.")
    parser.add_argument("--tick-rate", "-t", type=int, default=60,
                        help="The max tick rate that the server will run on.")
    parser.add_argument("--realtime", "-r", action="store_true",
                        help="With this flag on, the server will not wait for all of the clients to respond.")
    parser.add_argument("--observations-only", '-f', action='store_true',
                        help="With this flag on, the server will not push the true state of the game to the clients "
                             "along with observations")

    args = parser.parse_args()
    log_params(args)

    # env_class: Type[BaseEnvironment] = get_class(args.environment_class)
    try:
        env_class: Type[BaseEnvironment] = get_environment(args.environment)
    except KeyError:
        raise ValueError("The \'environment\' argument must must be chosen from the following list: {}".format(
            ENVIRONMENT_CLASSES.keys()
        ))

    observation_type: Type[_Observation] = Observation(env_class.observation_names())

    while True:
        app = Node(server_app,
                   server_port=args.port,
                   Types=[Player, ServerState])
        app.start(env_class, observation_type, vars(args))
        del app
示例#8
0
def main(address, port):
    '''Main Function!'''
    vis_node = Node(
        visualize, dataframe=(address, port), Types=[Snake, Apple])
    vis_node.start()
示例#9
0
def main(port):
    server = Node(sr_server, server_port=port, Types=[Player, Ship, Asteroid])
    server.start()
def main(address, port):
    '''Main Function!'''
    player_node = Node(player_execution,
                       dataframe=(address, port),
                       Types=[Snake, Apple])
    player_node.start()
def get_cache_server(config, restart):
    init_node = Node(init,
                     Types=[Register],
                     dataframe=(config.host, config.port))
    return init_node.start(config.user_agent, restart
                           or not glob.glob(config.save_file + '.*'))
示例#12
0
def main(port):
    server = Node(lander_server, server_port=port, Types=[Lander])
    server.start()
示例#13
0
def main(port):
    server = Node(lander_server, server_port=port, Types=[Lander])
    server.start()