-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Made visual rendering steps optional for major runtime enhancements #13
base: master
Are you sure you want to change the base?
Conversation
fixed indentation, reset speed to "normal" as in the original
There was a problem hiding this 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, 40],[140, 40], 2) | ||
pygame.draw.line(self.screen, (0, 0, 0), [40, 45],[140, 45], 5) | ||
pygame.draw.line(self.screen, (150,24,25), [40, 45],[140 - vbar, 45], 5) | ||
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)) )) |
There was a problem hiding this comment.
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) | ||
|
||
if self.visualmode == "yes": | ||
self.tilemap.draw(self.screen) | ||
|
||
# player life bar | ||
vbar = int(100 *( 1-(self.player.life/float(self.player.max_life)) )) |
There was a problem hiding this comment.
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
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:
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