コード例 #1
0
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))
コード例 #2
0
def main(address, port, bcount):
    '''Main Function!'''
    for _ in range(bcount):
        bot = Node(bot_execution,
                   dataframe=(address, port),
                   Types=[Snake, Apple])
    bot.start_async()
コード例 #3
0
ファイル: RLApp.py プロジェクト: creatorcen/colosseumrl
 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)
コード例 #4
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))
コード例 #5
0
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))
コード例 #6
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)')
    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()
コード例 #7
0
    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()
コード例 #8
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
コード例 #9
0
import sys
from sample_apps.gym_mp_lunarlander.envs.multiplayer_lunar_lander import Lander
from spacetime import Node


def lander(dataframe):
    my_lander = Lander()
    dataframe.add_one(Lander, my_lander)
    done = False
    while dataframe.sync() and not done:
        if not my_lander.ready:
            continue
        print(my_lander.player_id, my_lander.state, my_lander.reward,
              my_lander.done)
        my_lander.do_sample_action()
        done = my_lander.done


if __name__ == "__main__":
    port = int(sys.argv[1]) if len(sys.argv) > 1 else 8000
    Node(lander, dataframe=("0.0.0.0", port), Producer=[Lander]).start()
コード例 #10
0
def main(address, port):
    '''Main Function!'''
    vis_node = Node(
        visualize, dataframe=(address, port), Types=[Snake, Apple])
    vis_node.start()
コード例 #11
0
def main(port):
    server = Node(sr_server, server_port=port, Types=[Player, Ship, Asteroid])
    server.start()
コード例 #12
0
def main(address, port):
    '''Main Function!'''
    player_node = Node(player_execution,
                       dataframe=(address, port),
                       Types=[Snake, Apple])
    player_node.start()
コード例 #13
0
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 + '.*'))
コード例 #14
0
def main(port, pcount, bcount):
    ''' Main Function!'''
    # pserver
    physics_node = Node(game_physics, server_port=port, Types=[Snake, Apple])
    physics_node.start_async(pcount + bcount)

    for _ in range(bcount):
        bot = Node(bot_execution,
                   dataframe=("127.0.0.1", port),
                   Types=[Snake, Apple])
        bot.start_async()

    visualize_node = Node(visualize,
                          dataframe=("127.0.0.1", port),
                          Types=[Snake, Apple])
    visualize_node.start_async()
    physics_node.join()
コード例 #15
0
ファイル: mp_ll_server.py プロジェクト: Mondego/spacetime
def main(port):
    server = Node(lander_server, server_port=port, Types=[Lander])
    server.start()
コード例 #16
0
def main(port):
    server = Node(lander_server, server_port=port, Types=[Lander])
    server.start()