From 0fb1ce699a1ce5f42206e1f4f4374aeea9f61408 Mon Sep 17 00:00:00 2001 From: xixin Date: Wed, 8 Nov 2023 13:29:57 -0800 Subject: [PATCH] fix the rendering bug --- pettingzoo/mpe/_mpe_utils/simple_env.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pettingzoo/mpe/_mpe_utils/simple_env.py b/pettingzoo/mpe/_mpe_utils/simple_env.py index e607d18f6..99cf13dd1 100644 --- a/pettingzoo/mpe/_mpe_utils/simple_env.py +++ b/pettingzoo/mpe/_mpe_utils/simple_env.py @@ -265,6 +265,7 @@ def step(self, action): def enable_render(self, mode="human"): if not self.renderOn and mode == "human": self.screen = pygame.display.set_mode(self.screen.get_size()) + self.clock = pygame.time.Clock() self.renderOn = True def render(self): @@ -282,6 +283,7 @@ def render(self): return np.transpose(observation, axes=(1, 0, 2)) elif self.render_mode == "human": pygame.display.flip() + self.clock.tick(self.metadata["render_fps"]) return def draw(self):