perf: Optimization + chunk system - #228
Conversation
Sprites are now rendered in chunks to reduce the amount of calls to pygame.Surface.blit Entity collision does also work in chunks now, so Entities only check for collision with nearby colliders --- This is still work in progress, some small issues are not yet fixed: - the Player does not yet collide with the barn entrance on the cow herding minigame - the use of emotes currently crashes the game - the rendering chunk manager is centred on the Player instead of the Camera, which results in the map not being fully loaded during times when the Camera is not centred on the Player (i.e. cutscenes and close to the map border) - the Player currently collides with dead NPCs
|
@michelfinley, looks like a lot of great work going on here! You might check with @tank-king too, he was doing some work toward optimizing the blur effect when you where the glasses and possibly something else I can't remember. Super nice to see you have the FPS like 4x on my PC at least but when you put on those glasses it still drops to an abysmal 35fps or so which will become unplayable online with pygbag. That might already be on your agenda here, just figured I'd throw it out there just in case! |
|
Very good! I have the draft of my performance boost fix, I can post it here if you want, or I can make a new PR once this draft is completed. |
|
@DangerousVanilla can you approve this for merging? |
|
@tank-king Thanks! Whatever you prefer, you are welcome to add it here if you'd like :D |
|
@DangerousVanilla Thanks a lot! Nice that the games performance increased even more on your side than it did on mine, it makes me really optimistic that it eventually runs on pygbag with good avg fps :D |
|
@sloukit, it doesn't look like this PR ever got completed. There are some visual issues like black screen on startup and some odd texture stretching during the intro that will need fixed before testing can continue |
Summary
This PR optimizes several code sections to improve performace.
Overall, this increases average FPS by about 2-2.5x on both desktop and pygbag
Checklist
Labels
type: enhancement,game-playtesting