.qc (dot qc) - the group for quake c coders of all denominations. If you make quake one mods and write code in quake c, join our group! I'll try to answer any quake c questions - please post your inquiry in the forums...

Forum Thread
  Posts  
10000000 jumps (Groups : qc : Forum : discuss() : 10000000 jumps) Locked
Thread Options
numbersix
numbersix quake-c coder++
Nov 28 2016 Anchor

Most QC coders know this one:

Host_Error: server runaway loop counter hit limit of 10000000 jumps

Put an infinite loop in quake-c and you get that.

I have been waiting for a day when I have code so complex it can break that limit without an infinite loop.

That day may have just arrived.

I'll follow this up when I have solid data.


So, solid data. How close can code with lots of loops come to the jump limit without an infinite loop?

First I verified that the jumpcount is indeed reset every so often - it is not a total the keeps increasing.
You really need an infinite loop to trip it. Or do you?

Some engine code in prvm_execprogram.h

// placed immediately after
case OP_IFNOT:
 if(!FLOAT_IS_TRUE_FOR_INT(OPA->_int))
 {

int ic, jc;
   jc = jumpcount / 10000;
   ic = ici / 10000;

   if (jc > ic)
   {
       ici = jumpcount;
       Con_Printf("*** jumpcounter: %i\n", ici);
   }

This will display a running tally of jumpcount every time it exceeds its previous value by 10000.

This is the highest count I've seen during certain ops:

*** jumpcounter: 5240000

Just to compare the limit so you can see it:

5,240,000
10,000,000

My intense loop code is halfway to the limit!

This is from a loop on 545 fields, with each getting another 24 loops on some of the code.

So 20 or so qc ops (they dont match qc source exactly) run 13080 times.
Plus the outer loop that goes 545 times. How many jumps? Hard to say.

I could throw in some cvar ops in that test code up there and find out. I might do this.

So, either the loop has a self breaking infinite loop (not likely) or it _is_ hitting 5 million plus jumps.

Bump the jump counter limit, or re-write my code?

Both I should think.


Edited by: numbersix

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.