multiplayer.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:roboschool 作者: openai 项目源码 文件源码
def multiplayer(self, env, game_server_guid, player_n):
        """
        That's the function you call between gym.make() and first env.reset(), to connect to multiplayer server.

        game_server_guid -- is an id that server and client use to identify themselves to belong to the same session.
        player_n -- integer, up to scene.players_count.

        You see here env._reset() gets overwritten, that means if you call env.reset(), it will not create
        single player scene on your side (as it usually do), but rather it will communicate to server, reset environment
        there. Same with step() and render().
        """
        self.shmem_client_init(game_server_guid, player_n)
        env._step   = self.shmem_client_step  # replace real function with fake, that communicates with environment on server
        env._reset  = self.shmem_client_reset
        env._render = self.shmem_client_rgb_array
        self.shmem_client_send_env_id()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号