10

I would like to increase the tick rate of my kitten simulation. I've tried changing gamePage.rate = 10 in the console, which should double it (it starts at 5) but it doesn't seem to have any effect.

Is it possible to increase the tick rate?

  • 13
    You don't want your Kittens to get ticks. They might get Lyme disease! – aslum Oct 22 '14 at 4:02
  • gamePage.rate seems to be display of incoming resources only. So normally your wood tick is 10/sec , if you change gamePage.rate from 5 to 10, then it will display 20/sec. However you still only receive 10 a second. – Gauthier Jul 27 '15 at 20:56
8

You should not mess with the tick() or rate too much. The game is optimized to work more or less smooth on the 5 tick per second, and you are expected to have significant performance impact on 10 and more.

What you can do, however, is get some paragon points (even 100 or 200 would make noticeable difference) by the means of reset or console. Paragons multiply all your production rates which is basically the same as faster update rate.

3

I still welcome if someone else can get this done a more natural, idle-oriented way... But here's my solution so far.

This does involve some console vomit, with the following function:

var skip = function(min, sec) {

  // if we click skip while paused, we want to
  // remember that and re-set it
  var wasPaused = gamePage.wasPaused;

  // unpause the game so tick() operates properly
  gamePage.isPaused = false;

  // should replace 5 with gamePage.rate but it doesn't
  // seem to change anyway, so whatevs
  var tix = (min * 60 + sec) * 5;

  // run the loop tix number of times
  while(tix --> 0) {
    // perform the tick
    gamePage.tick();

    // i kept killing my kittens, so i put this in here
    // to protect me a little bit - it's just a general safeguard
    var food = gamePage.resPool.get('catnip');
    if(food.value / food.maxValue < 0.05) {
      gamePage.isPaused = true;
      alert('warning: food low - aborting early');
      return;
    }
  }

  // assuming we didn't return early because of
  // a famine, return the game's paused state to
  // whatever it was when we started
  gamePage.isPaused = wasPaused;
}

Open up your dev console (press F12) and paste this code in and hit enter. You need to do this every time you reload the game.

Then I make some bookmarks, like one named "5 sec" with the link javascript:skip(0,5) and "1 min" with the link javascript:skip(1,0).

Note if you skip too much you're going to miss your celestial events. But you can use it to 'idle' for a few minutes at a time and is very, very useful to me!

3

It is possible to increase the tick rate. I have not looked into the code much, and am not offering an answer involving changing the base game code for the game loop. However, I will provide some code which runs another loop along side it. The code can be placed within a bookmarklet or user script, and involves calling the gamePage.tick() function (aka. the function which increments the game) rapidly.

Run this code to set the tick rate to as high as possible:

setInterval(

    function () {

        //Increment the game:
        gamePage.tick();

    },
    //Run the loop every 0 milliseconds:
    0
);

Feel free to change the 0 to something else - it shouldn't run every 0 milliseconds, as most browsers have a minimum interval period (usually 10 milliseconds) which they default to if the value is set to below, but I cannot guaranty this.

A simple bookmarklet which implements the code (simply refresh to disable):

javascript:setInterval(function(){gamePage.tick()},0)

Note that bookmarklet code can also be simply pasted into the URL bar, and will run as normal.

If you really want to be able to disable the script without refreshing the page, then assign the interval to a variable, like so (feel free to change the name of the variable, it is inconsequential):

var tickTock = setInterval(

    function () {

        gamePage.tick();

    },
    0
);

And to disable, run the following code:

clearInterval(tickTock);

And finally, the bookmarklets for this - first the loop creation bookmarklet:

javascript:a=setInterval(function(){gamePage.tick()},0)

and then the loop removal bookmarklet:

javascript:clearInterval(a)
  • I combined your code to one line so the bookmark button both starts and stops the fast forward: javascript:if(typeof a == 'undefined' || go == 0){a=setInterval(function(){gamePage.tick()},0);go=1;}else{clearInterval(a);go=0;} – Nelson Nov 25 '15 at 2:19
1

The key game functions you want to run more often are game.updateModel and game.calendar.tick. Running game.tick will update the UI and have bad performance. Here is a hack to increase the game speed, which includes a handy Speed: button (click to increase, rightclick to decrease)

if (!window.speed) speed = 1;
if (!game.realUpdateModel) game.realUpdateModel = game.updateModel;
game.updateModel = () => {
    for (var i = 0; i < speed; i++) { 
        if (i !== 0) {
            game.calendar.tick();
        }
        game.realUpdateModel();
    }
}
setSpeed = spd => { 
    if (spd >= 1) { 
        speed = spd; 
        updateSpeedText();
    } 
}
speedUp = () => setSpeed(speed * 2);
slowDown = () => setSpeed(speed / 2);
$("#timeSetting").remove();
$('#gamePageContainer').append($('<div id="timeSetting" style="position: absolute; top: 50px; right: 10px;" onclick="event.preventDefault(); speedUp();" oncontextmenu="event.preventDefault(); slowDown();">'));
updateSpeedText = () => $("#timeSetting").html("Speed: " + speed + "x" + (speed > 30 ? " <br />(right click<br />to lower)" : ""));
updateSpeedText();

You could also increase game.rate or game.getRateUI to match so that the per second resource values will be correct, but the former will make your engineers slower (coded to be 10 minutes at any rate) and the latter will make your calendar the wrong speed while using temporal flux (due to a bug)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.