I have a random timeout issue in Hypersonic.
I have wall time and cpu time check both are at around 95ms right before the command is printed.
I just use the standard c++ cout stream from the exemple code.
Most of the time it’s fine but seldom i get a timeout in the middle of the game.
I have tried two ways to time the game,
1.) Right after the inputs,
I believe that was then given as the right way to time by a CG member in a thread that I read a while ago.
2.) Before the inputs,
This worked well in the accountant but give very large time variation and seem unusable in Hypersonic.
Note that as i print the time of process right before outputting the command and that there is not any process between the time print and the cout it means that I am on time according to chrono and clock.
Every time this happen, the cerr with the time shows up but the cout with the command doesn’t.
Code is basically like that:
int t=milliseconds(now() - timeStart);
clock_t endt=clock();
cerr<<“simcnt=”<<simCnt<<" time=" << dec << t << “ms” << " clock_t="<<((float)(endt-startt)/CLOCKS_PER_SEC)*1000<< endl;
cout <<cmd<<" "<<dbg<< endl;
*Dunno why the last line refuse to interpret the carriage return, instead it prints it literal br/ in <>
And I get an output like that:
time=95ms clock_t=95.079
Command should be there but nothing shows up.
Game information:
Timeout: the program did not provide 1 input lines in due time… FredericBautista will no longer be active in this game.
The cout appear to be delayed enough to cause a timeout on occasion.
It happen like maybe one in ten games or so.