Skip to content
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

D3Bot uses too expensive calls every frame #57

Open
CWorm opened this issue Jun 19, 2020 · 2 comments
Open

D3Bot uses too expensive calls every frame #57

CWorm opened this issue Jun 19, 2020 · 2 comments

Comments

@CWorm
Copy link

CWorm commented Jun 19, 2020

Even on navmesh-optimized maps bots do too many calls each frame, causing the server's CPU to go down and overload, and AFAIK as well as the entire navmesh table is checked for proper nodes. Currently only one way to reduce the lag is either to optimize the navmesh (which is very limited at this point) or remove bots as at higher bot amounts the entire server starts lagging down.

Maybe reduce the number of calls required/do it per x frames, or cache the navmesh table to prevent going through 1000+ objects?

@Dadido3
Copy link
Owner

Dadido3 commented Jun 19, 2020

I know of the problem, it's mainly because the closest node needs to be found for bot/target localisation. And right now this is done by iterating over all nodes. This happens at the rate of 1/s, and i don't want to reduce it further.

Here are some things that can be improved:

  • Localisation should use some data structure that allows fast lookup. A simple solution would be a grid based cache where each cell contains a list of nodes that are nearby. It's just a bit tricky to determine the possible node candidates, but i may have a solution for that, i just need to test it.
  • Path calculation could be cached. In the endgame there are lots of bots that go from one spawn to a group of survivors, a cache would help a lot here (Cache needs to invalidated regularly, as path costs change over time. Also the path may depend on the type of zombie). I'll also look into this when i find some time.
  • Looking over the code i found that i forgot to disable some metadata calculation that is only needed for survivor bots. I'll probably do that soon as it's a small change and doesn't have any side effects.

Dadido3 added a commit that referenced this issue Jun 19, 2020
Dadido3 added a commit that referenced this issue Jun 23, 2020
- Use squared distance if possible

#57 #32
Dadido3 added a commit that referenced this issue Jun 23, 2020
@Dadido3
Copy link
Owner

Dadido3 commented Jun 23, 2020

I found some more stuff that could be optimized. It should run a bit smoother now, it's not perfect, but much better than before.

Dadido3 added a commit that referenced this issue Nov 29, 2020
Dadido3 added a commit that referenced this issue Sep 23, 2022
Dadido3 added a commit that referenced this issue Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants