Engine and time

Hey,

Wondering is anyone here has any insight:

I have been having a hard time with game engine and time…
When I extended the JavaScript Reference bot with some time delay functions I get this:

Tick 0 set move executes at start of Round 1
Tick 0 set move executes at start of Round 2 (Again)
Tick 1 set move executes at start of Round 3
Tick 2 set move executes at start of Round 4

This goes away when I remove my 85 MS second delay,

Im assuming that my commands are only written the next round, but I cannot really see why, If I add a 50 ms delay to the code, it adds a round delay, if i dont add any delay here, then rounds are real time,

Is this something only I am experiencing or a huge headache for everyone.

Im currently coding my own solution to just be aware that it will have this 1 round delay.
Im really wondering “Why”

So i can maybe fix it, It even breaks the reference bot as its always 1 round behind itself.
But if we have 100 MS to process our moves, I dont see why this is a problem,
And at the same time, if there should always be a 1 round delay in the sense that moves written this round only takes effect at the end of the next round,

Than that logic should be constant even when I dont have a MS delay in place.

Oddly enough everything works fine if I set my timer to 49 MS, 50 and it goes over,
I assessed the harness and confirm:
“TickRate”: 100, in game engine app settings.

This is how Im processing my timer as a test environment:

connection.on(“ReceiveGameState”, gameStateDto => {
var st = Date.now();
//Do bunch of random stuff
while(Date.now()-st<50){runs++;}
connection.invoke(“SendPlayerAction”, _playerAction);

Not trying to give too much out, these seem to be basic enough.

Just trying to reason: Why isnt my round completing when I change MS from 49 - 50…

Im also exploring other types of timeouts now in case its my own approach.

Just thought I will post for now, Running on 49 MS (half of a round’s allocation) isnt ideal, especially if I potentially need to drop it to 45 ms to accommodate actually running code in there. But wonder if anyone has any thoughts.

This is probably why I missed round 1, The rounds just didnt play with me.
I found that 49MS in reference works, so I can at least enter something this time.

I have some thoughts of how I can handle my round that will not result in losing 55 MS per turn, but wonder if im missing something basic.

**At least i can continue now.

Im going to look at a Async implimentation now, maybe i can do better if I just run my round processing and wait for gamestate in seperate instances.

That will likely solve all my issues anyways,