fireclawthefox / panda3d-character-controller

8 stars 4 forks source link

FPS issuses #3

Closed BackpackerSlash closed 2 years ago

BackpackerSlash commented 2 years ago

First off: Great job! really fun to play with this.

on a side note: in your doc you mention you just have to put the folder player into the root to plug this controller in, but there is no folder "player". minor issue that should be fixed anyway.

to my issue now: Your test demo runs on 15fps max on my dinosaur of a pc. I am not familiar enough with panda to judge, if that should be. is it possible that your collision detection checks against visible genoms, instead of pandas behind the scene collision geometry? Since i dont know panda, i don´t even know how to check this. I cannot think of another reason to why it performs so poorly.

any suggestions?

fireclawthefox commented 2 years ago

Thanks for the hint and trying the char controller. The manual definitely needs to be updated with the new pip install method.

Regarding the performance, it most definitely will be the rather poor collision setup of the level. Just recently I've learned about a handy little feature that you can simply put in the demo.py script to enhance the collision detection performance dramatically. Just put the following line somewhere after the level has been loaded with loader.loadModel

self.level.subdivideCollisions(4)

In my test it pushed the FPS rate from 70 to something around 3-400.

If that doesn't give you enough of a performance boost it'd be nice if you could check with Panda3Ds pstats tool which parts take up the frametime and send a screenshot of it. To enable it do the following:

  1. In the demo.py find the line want-pstats #f and change the #f to #t (for True)
  2. run pstats from a terminal app.
  3. run the demo.py script

Now check in pstats which parts take up the most time (pause the demo 'P' to free the mouse). You can dig deeper by clicking on the individual parts in the diagrams.

BackpackerSlash commented 2 years ago

awesome! 60fps, runs smooth now. gonna play around with this some more.

I did try pstats before on this, but i wasnt able to read it properly. im used to just have a summery table that tells me how much % each task took, but in panda i just couldnt navigate it properly. and it also emptys out, when closing the game, which makes action analyses annoying as heck.

but consider this issue solved for now :+1: