Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[New section] Add image caching #89

Open
NiklasEi opened this issue Sep 23, 2020 · 1 comment
Open

[New section] Add image caching #89

NiklasEi opened this issue Sep 23, 2020 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@NiklasEi
Copy link

First of all, thank you for the awesome book! I just started learning Rust and it was fun and helpful to build the game.

I had the issue that even after implementing batch rendering the FPS were somewhere between 40 and 50, but never 60. After finishing the book I continued playing around with the code trying to reach 60 FPS. I managed by introducing a cache for the images. Now the game reaches 60 FPS after a few seconds. Would this be an addition to the book you would be interested in?

I am not sure if my implementation is well done (really new to rust), but if you are interested:
The biggest change is https://github.com/NiklasEi/sokoban-rust/blob/master/src/systems/rendering_system.rs#L56-L63

@iolivia
Copy link
Owner

iolivia commented Sep 27, 2020

hey @NiklasEi, glad you enjoyed it!

yep loading the image every frame is certainly not ideal, this would be an awesome addition, I think we have an issue about this somewhere. the code looks pretty good to me, maybe you can submit a draft PR? I think you can make the change directly in the 3.4 chapter since it's pretty small, maybe just towards the end after the batch rendering changes.

@iolivia iolivia changed the title Further performace improvements for rendering (image caching) [New section] Add image caching Dec 23, 2024
@iolivia iolivia added the help wanted Extra attention is needed label Dec 23, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants