Skip to content

Conversation

Tamrell
Copy link

@Tamrell Tamrell commented Sep 14, 2021

I am currently following the course "Evolutionary Computing" at the VU Amsterdam, using snakeviz (a python profiler) I noticed that even when using the suggested code:

headless = True
if headless:
    os.environ["SDL_VIDEODRIVER"] = "dummy"

the majority (90% + ) of the runtime is caused by the drawing/rendering on what seems to be a "dummy" screen/gpu.

I added in a flag (visualmode) for the environment class that disables purely the (non-functional) drawing components for a noticeable speed enhancement.

Hopefully this can still be accepted during this edition of the course so the other groups can also spend more time on analysis rather than running experiments :)

Regards,
Angelo

Copy link

@OlegBEZb OlegBEZb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love you, dude

pygame.draw.line(self.screen, (0, 0, 0), [40, 49],[140, 49], 2)

# enemy life bar
vbar = int(100 *( 1-(self.enemy.life/float(self.enemy.max_life)) ))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my also be moved under the condition

self.tilemap.draw(self.screen)

# player life bar
vbar = int(100 *( 1-(self.player.life/float(self.player.max_life)) ))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used anywhere else. may be moved under the condition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants