I am trying to simulate jitter but noticed it was always being set to 0. After digging into the code I can see that jitter is divided by 1000 to convert it back into seconds, but because it's an int it gets set to 0.
int jitter = packet_simulator->jitter * 1000;
jitter = (jitter > 0) ? (rand() % (jitter * 2)) - jitter : 0;
NBN_PacketSimulatorEntry *entry = (NBN_PacketSimulatorEntry *)MemoryManager_Alloc(NBN_MEM_PACKET_SIMULATOR_ENTRY);
entry->delay = packet_simulator->ping + jitter / 1000; /* and converted back to seconds */
changing it to (double)jitter / 1000 fixes the issue for me. Am I misunderstanding how to use jitter?
I am trying to simulate jitter but noticed it was always being set to 0. After digging into the code I can see that jitter is divided by 1000 to convert it back into seconds, but because it's an int it gets set to 0.
changing it to
(double)jitter / 1000
fixes the issue for me. Am I misunderstanding how to use jitter?I'm setting it like this:
NBN_GameClient_SetJitter(0.5)