How long is one tick?

Started by Darker, March 09, 2014, 07:24:07 PM

Previous topic - Next topic

Darker

I wonder - how long does one tick take of real-time (provided there are no lags and the speed is normal).
How long does one tick take of game time?

If electric network element takes 1W/d from network, how much charge (W/d's) did he consume per tick?
Will 1000W/d charged battery last 1000days with 1W/d device?

Can I get total number of ticks from the game start to calculate time differences?
Please... Throw human readable errors on savefile parsing failure!!!
Rim world editor Editor on GIT

Architect

There is 60 ticks in a second stored as a float number. When using tick rare, the tick will only fire every 250 ticks, stored as an integer. That is, assuming I'm reading the code right. Check 'TickManager' for yourself if you wish to confirm, its a public class.
Check out BetterPower+ and all its derivatives by clicking the picture below.

It adds many new methods of power generation and uses for it, as well as other things such as incidents.


Darker

Actually, the GenTime is the key.
Answers are

1tick = 1/60 second (real time)
public static float TicksInSeconds(this int numTicks)
{
return (float)numTicks / 60f;
}

1game day = 20000 ticks (real time)
public static float TicksInDays(this int numTicks)
{
return (float)numTicks / 20000f;
}

That would mean that 1W/d means 0.00005W per tick.
Please... Throw human readable errors on savefile parsing failure!!!
Rim world editor Editor on GIT

Architect

I was still correct then? :P Just found it a different way, though I'll take a look at what GenTime has to offer too.
Check out BetterPower+ and all its derivatives by clicking the picture below.

It adds many new methods of power generation and uses for it, as well as other things such as incidents.


Tynan

Yes, you're both correct. A tick is 1/60th of a realtime second, to match 1 per frame at 60fps. There are 20000 in a day (which means RW days are only 5 and a half realtime minutes long).
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Architect

So, does fast ecology speed up the number of ticks per second then? Hence why there is slight frame rate lag when fast ecology and 3* speed is on.
Check out BetterPower+ and all its derivatives by clicking the picture below.

It adds many new methods of power generation and uses for it, as well as other things such as incidents.


Darker

I'm not sure about fast ecology - but it doesn't speed up ticks.

But I'm too curious how does it work - it seems to stop TickRare.
Please... Throw human readable errors on savefile parsing failure!!!
Rim world editor Editor on GIT

Tynan

Fast ecology was a weird single-use hack I put in to test how the plant ecology would develop over time. I actually can't remember just what it does, but I think it hacks a number of things to make plants grow/reproduce/die very fast.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Darker

Yeah, because plants have lot's if ifs for the fast ecology condition. I implemented these for Tiberium too, but in fact, rare ticks seem to stop so it's no use.
Please... Throw human readable errors on savefile parsing failure!!!
Rim world editor Editor on GIT

faltonico

#9
Quote from: Tynan on March 09, 2014, 08:47:11 PM
Yes, you're both correct. A tick is 1/60th of a realtime second, to match 1 per frame at 60fps. There are 20000 in a day (which means RW days are only 5 and a half realtime minutes long).
Is this up to date?
Edit: I'm asking because somebody updated the wiki to 60000 ticks in a day.

skullywag

March 9th 2014 ad youre asking if this is up to date? no its not. Code changes every alpha. The wiki is correct thus far.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

faltonico

Quote from: skullywag on December 29, 2016, 05:20:58 AM
March 9th 2014 ad youre asking if this is up to date? no its not. Code changes every alpha. The wiki is correct thus far.
I imagined xD
Thanks for clearing that up!