Skip to content

Commit

Permalink
Add Gymnasium performance improvement to Lunar Lander (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudo-rnd-thoughts authored Mar 14, 2024
1 parent 26e7107 commit e3e05f3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions mo_gymnasium/envs/lunar_lander/lunar_lander.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@ def step(self, action):
self.lander.position[0] + ox - tip[0] * 17 / SCALE,
self.lander.position[1] + oy + tip[1] * SIDE_ENGINE_HEIGHT / SCALE,
)
p = self._create_particle(0.7, impulse_pos[0], impulse_pos[1], s_power)
p.ApplyLinearImpulse(
(ox * SIDE_ENGINE_POWER * s_power, oy * SIDE_ENGINE_POWER * s_power),
impulse_pos,
True,
)
if self.render_mode is not None:
# particles are just a decoration, so don't add them when not rendering
p = self._create_particle(0.7, impulse_pos[0], impulse_pos[1], s_power)
p.ApplyLinearImpulse(
(ox * SIDE_ENGINE_POWER * s_power, oy * SIDE_ENGINE_POWER * s_power),
impulse_pos,
True,
)
self.lander.ApplyLinearImpulse(
(-ox * SIDE_ENGINE_POWER * s_power, -oy * SIDE_ENGINE_POWER * s_power),
impulse_pos,
Expand Down

0 comments on commit e3e05f3

Please sign in to comment.