workertime / buildtime / time

workertime / buildtime / time

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

workertime / buildtime / time

Post by Caydr »

Can someone explain how Spring handles these?

In OTA, workertime was in 30 unit increments. So 80 was the same as 60. 140 was the same as 120, etc. Does spring still use this old system or has it been fixed so that 100 workertime is actually 100 workertime?

Also, I'm trying to figure out what the relationship between buildtime, workertime, and real-world time is.

For instance, I guessed that maybe 1000 units of buildtime on a unit being built by a unit with 100 workertime would take 10 seconds - divide 1000 by 100, you get 10, so 10 seconds. Ehh... not quite.

I did a bigger test for better accuracy: a factory with 100 workertime building a unit with 10000 workertime. 100 seconds? No... 106 seconds.

Also, is workertime linear or logarithmic? For instance... is 150 50% faster than 100, or is it... some other percentage....

Please explain.

~~~~

More tests:

100000 buildtime by 100 workertime takes 1067 seconds.

~~~~

100000 buildtime by 300 workertime takes 356 seconds, exactly one third of 1067, so I guess it's linear and also not in the 30-unit system. Still don't know what kind of weird scale it's operating on though...

~~~~

Answered my own question. Someone should probably add this to the wiki:

93.7207123 = exactly 1 second of construction with a unit that has 100 workertime

So... for instance, to make a unit that will take precisely 420 seconds to build (7 minutes) on a factory which has 450 workertime, you would give it 177132 buildtime
User avatar
Felix the Cat
Posts: 2383
Joined: 15 Jun 2005, 17:30

Post by Felix the Cat »

Sorry, we'd already figured this out a while ago over at Spring 1944... thought it was common modder knowledge so we didn't share it!
Tournesol
Posts: 7
Joined: 27 May 2006, 21:29

Post by Tournesol »

Spring have 30 frames in one second, but not when updating some parts of the units. The "slow update" where some of the economics are, runs at a 16 frame cycle. As a result it have 32 frames in one "second".

Here is a simple formula that do the translation:
"unit def speed" * 15 / 16 = real unit speed
or
100 * 15 / 16 = 93.75

This also means that a solar collector that give 20 energy only give 18.75 energy in one real second: 10 energy is added every 16 frames. (and... that isn't always true either, but that's another story). :(

Most likely other things like idle unit repair and constant repair have the same update speed (its some time since i looked at this).
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Post by Caydr »

I'm not an expert obviously, but I've done some testing and your formula does not appear to be accurate.

I can get a unit's buildtime down to the second using 93.7207123 as my multiplier. The difference between 93.72 and 93.75 is quite large when you consider how large the resulting number is going to be.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Post by SinbadEV »

<null statement>maybe you method of recording seconds is wrong :P... or they are losing/gaining some ticks here and there...</null statement>
Post Reply

Return to “Engine”