Extremely high network receive values (1000 KB/s) and high ping (5000+) from pathfinder replication

In my game, I and other players in the same server have been experiencing very high levels of ping, spiking all the way into the thousands. I also see a massive amount of data being sent per second through the Performance Stats whenever a customer is served. When a customer is served, my pathfinder algorithm runs on the server to generate a path. It’s worth noting this is a custom A* pathfinder, however, it has been optimised and runs quite efficiently, taking around 0.014 seconds on average to generate a path.

My NPCs are generated on the server, but I move them on the client. I do this by encoding the path nodes table into JSON and I insert a StringValue into the NPC on the server. This is then seen by the client and the client decodes the JSON and loops over the nodes table, moving the character. As you can see, when this happens, network receive increases greatly and so does the ping. At its worst, over 25,000 KB/s were being sent, however, usually it goes to around 1000 KB/s.

When the pathfinder script was disabled, and I instead set the NPCs to simply teleport to their destination, this issue went away.

As you can see in this image, ping spiked to 42,217 and total data KB/s reached around 1000KB/s.

Any ideas?


I don’t have much of a clue as to why this happens, how big is the table that you’re encoding/decoding?

1 Like

I’m guessing the table is simply too big in size. Can you show what exactly is being encoded into JSON/how? We might be able to suggest some optimizations.

1 Like

This is an example table which gets encoded into JSON. This was a 10 node path, each node having three position values for X,Y,Z.

As a string it is 581 characters.

1 Like

Did the ping spikes start happening recently? Also, why are you encoding it to JSON? I feel like it could end up taking more space than just an array of Vector3s.

1 Like

Afaiw transferring data from server to client by encoding it first is much more performant than just sending the table, that’s what I do too

1 Like

Well, to be honest, I never knew about them happening because most of the time I test my game in Studio and it’s fine. But, since recently I started to test my game with other players in BETA, and also stress testing it, players were reporting ping spikes, which was when I realised what was happening. So I am going to say no, I believe they have been happening for a while, I just haven’t realised.

I am putting it into JSON because that is the only way I can put it into one single value which can be read by a client. Otherwise I would have to use 30 vector3values for that same path.


Have you previously attempted to just send the array of waypoints through the event?

I am not using events. I am using ValueBases to send this data. So no.

Well then have you considered using events and parsing it through that way? Not the most efficient by far but at least see if that’s why this is happening

Well try it and lmk, roblox is weird so anything could happen

I feel like this is a performance issue instead of a networking issue, where the server freezes, the packets build up, and then it unfreezes and a ton of packets get sent to everybody. Have you tried checking for high script memory/CPU usage from the dev console?


I’m not sure why this happens, you can probably try any alternatives? I’m kinda new to the Dev platform so that’s all I can comment (A fan of AlvinBlox btw lol)

I do have to agree with you, this has been a suspicion of mine also - because the ridiculous amounts of 80k indicates more towards a packet buildup in the queue rather than network lag

Even with remote events, ping and network recv. is still very high

Then you should try and do what Judgy_Oreo suggested and see if the server freezes at some point

1 Like

I’m having the same issue with server kb/s, it just has extreme spikes that makes the whole server freezes for a bit then it goes down.

I haven’t found a solution yet, I have tried consulting the micro-profiler, but with no result.

1 Like

Why not send an array of each position?

  Vector3.new(-1003.85, 0.65, 326.75),
  Vector3.new(-1007.85, 0.65, 326.80),

Obviously these are approximations, but why send a whole encoded json when the client could just loop through these?

Oh, my question here would be why a ValueBase? I don’t understand your game’s internals but in this case a remote seems a lot better than a valuebase.

You even read our conversation? We went through this already

Already have, I’m thinking of why this could happen aswell. I also asked why he’s using value bases.