p4535992 / conditional-visibility

a FoundryVTT module to hide tokens from some players, but not from others
MIT License
5 stars 8 forks source link

High token count #24

Closed NiclasLiebhauser closed 2 years ago

NiclasLiebhauser commented 2 years ago

Module Version: v0.5.19 Foundry Version v9 b255 DnD5e Version v1.5.7

Describe the bug If a client moves a token in a scene with Token Vision enabled and the option Token Vision Animation enabled the module seems creates massive lags when moving their token while the scene is populated by a large number of tokens. My test scene had 55 npc tokens in addition to the player token 20 of them were invisible.

To Reproduce Steps to reproduce the behavior:

  1. Create a new world
  2. Enable Conditional Visibility and dependent modules
  3. Create a scene with Token Vision enabled
  4. Create another user and log in as that user
  5. Make sure the Token Vision Animation option is enabled for that user
  6. Create a player actor for the player and add it to the scene
  7. Add more and more npc tokens to the scene
  8. Move the token on the client side

Expected behavior Clients should not have to wait longer than normal to move a token.

Screenshots image

Browser:

Additional context The fps don't show anything below 40 but the token becomes ever slower the more tokens the scene harbours. I attached my log file even though I don't expect it to provide anything specific. Especially because it seems to be a client-side performance issue.

conditional_visibility.log

p4535992 commented 2 years ago

Should be solved with 0.5.20, let me know

NiclasLiebhauser commented 2 years ago

Sorry to say this, but updating to v0.5.20 didn't increase performance noticeably. Also, I don't know if this is new or not, but disabling Token Vision Animation has a single lag frame, still only client-side, before the token arrives at its destination.

p4535992 commented 2 years ago

@NiclasLiebhauser I tried to perfect the checking algorithm as much as possible, but unfortunately if the number of visible tokens (if not hidden by the walls) starts to be "numerous" a slowdown is inevitable. However, I think I have made the waiting time of the lag tolerable, the last solution would be to ignore the problem because I do not expect an excessive number of tokens in the same room. In addition, if you wanted to speed up the algorithm for those tokens that MUST be visible, I added the "Force visible" parameter in the token configuration panel in practice if true for that token you bypass the checks speeding up the checks for the other tokens that you wants to analyze. Try out 0.5.23 and le me know it.

NiclasLiebhauser commented 2 years ago

@p4535992 Sound interesting. I could not really test that much, because my player account is getting an error every second user_lacks_permission.log. Should I open another issue for this?

But now I actually even feel some delay to the movement as the GM which was not the case in v0.5.19, in which I as a GM always had 100% smoothness.

p4535992 commented 2 years ago

_my player account is getting an error every second : yea i just partial fixed that on 0.5.25, now only a couple of errors is show , still need to understand how to solve that...

But now I actually even feel some delay to the movement as the GM not sure about this the new cheker should be more faster... i ù'll try to investigate on the old version 0.5.19

p4535992 commented 2 years ago

@NiclasLiebhauser I wanted to know if with all the bug fixes I made if the problem related to the number of tokens is "mitigated" enough or if still unmanageable.

NiclasLiebhauser commented 2 years ago

@p4535992 Testing in a clean environment seemed pretty good. So, yeah I think it is in a good state performance wise. I recently found the "high performance" setting for render. Maybe there is something going on with lower settings? Well, it works good on highest.