Ping spikes/issues with AI

Hi,

I am making a PvE game where I want at least 50 NPCs running relatively smoothly at one time.

I have done lots of optimization, and it seems to work fine, but the client is spending a lot of power on moving the cosmetic character to its server-side position.

client

Now it seems to work fine on my end, but I am concerned that it could be causing high ping on lower-end devices or less optimal internet connections. Please correct me if this is not the source of the ping issue.

It seems to run relatively fine on my end, again. My ping maintains 30-100, with some occasional spikes that I haven’t been able to pinpoint yet, but I imagine it has something to do with the pathfinding calculating a bunch of times whenever I change the goal.

server

I managed to get the server running pretty well, so I don’t really think this is the source of the problem (?)

Here’s an image of the script profiler when in combat;

server


client

You can imagine combat is kind of where it begins to spike, but I haven’t really managed to replicate it on my end.

Server used to be in the 100s, and I’ve optimised it as much as I can think of. Again I’m not sure if the client usage really matters here, but regardless I would prefer it to be lower.

Any help is appreciated, thanks.

1 Like

From further testing, it appears that the pathfinding is the primary source of the lag. I’m not sure as to how this could be optimised further, though.

How often do you run your AIs? Running their logic too often can cause a lot of issues with optimization.

Could you also provide extra details about your AI as well? We can’t really tell what needs fixing.

I managed to somewhat solve the issue.

It was mostly a problem with pathfinding, so I added a wait to it, and decreased the enemy amount.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.