Oddity with crafting speed

Started by thryllth, April 09, 2019, 01:19:37 AM

Previous topic - Next topic

thryllth

So I noticed something odd when doing up a large number of items for a caravan request.  It seemed that they were taking a long time to make and after a number of days my pawn had only completed 4 of the required 23 for the caravan.  This led me to time how much real and game time it took to craft each item at different game speeds and I noticed that for some reason the work speed on the item was not in sync with the passing of in game time.  With the game speed at 1x it took ~1 (10 work in 9.4 seconds real time) second per work with the game speed at 3x it took around .7 (10 work in 6.9 seconds real time) second per work.  Timing against the in game clock it took under 2 hours to complete 1 item at 1x speed and took over 2 hours to complete 1 item.  I suspect this is not intended behavior.  My game is heavily modded and I was wondering if anyone had an idea where to look to try and either further confirm this or figure out what is causing it in the first place.

Canute

You should at first try out the same crafting at vanila gameplay.
Just disable all mods beside hugslib, use hugslib quickstart feature to create a new test colony. Use dev tools to build quick a small base, drop resources and let them craft some.

When you don't notice a difference, it is prolly a vanilla thing and you can't do much.

Roolo

Quote from: thryllth on April 09, 2019, 01:19:37 AM
So I noticed something odd when doing up a large number of items for a caravan request.  It seemed that they were taking a long time to make and after a number of days my pawn had only completed 4 of the required 23 for the caravan.  This led me to time how much real and game time it took to craft each item at different game speeds and I noticed that for some reason the work speed on the item was not in sync with the passing of in game time.  With the game speed at 1x it took ~1 (10 work in 9.4 seconds real time) second per work with the game speed at 3x it took around .7 (10 work in 6.9 seconds real time) second per work.  Timing against the in game clock it took under 2 hours to complete 1 item at 1x speed and took over 2 hours to complete 1 item.  I suspect this is not intended behavior.  My game is heavily modded and I was wondering if anyone had an idea where to look to try and either further confirm this or figure out what is causing it in the first place.

Timing against real-time only makes sense when you have a very stable FPS, for instance 60FPS all the time, as only in that case x3 speed is really 3x as fast. Timing against in-game time does make sense, though then you have times rounded by 1 hour. Did you do bigger trials to take into account this big rounding error?

I'd be really surprised if the speed at which you run would impact the crafting time, since everything in-game is calculated based on ticks, and changing the speed doesn't chance the total number of ticks per game-time (it only lets the game execute more ticks per real-time).

Limdood

A better calculation would be to time a really long project against IN-GAME time...ie. how many hours in-game time a parka or an assault rifle takes to manufacture.

Be sure to use the same pawn, as even pawns with identical skill levels can have vastly different crafting speeds due to injuries or traits.

Canute

And don't forget to use same mats, some resources got a hugh impact on work speed.
Like a wood table you can construct pretty fast, while any stone table take alot more time.

thryllth

So after further testing I have noticed two things, first that the issue does not appear to be specific to that pawn as I have seen the same behavior with other pawns and other crafting types (making kibble and construction jobs).  Secondly I was able to confirm that it is taking longer in game when at higher time rates to perform the same tasks by setting up two rows of 1x8 flooring and having the same pawn build both (resources were already delivered, both tests were done underground in 0% light) at 1x speed it took ~16 seconds, and at 3x speed there was minimal difference (the difference was under .1 second) while in game time was harder to measure assuming stable fps as I did not notice any significant hitches it took around a third of an hour for the 1x test and close to half an hour for the 3x test.  I have not tested this against vanilla as frankly restarting the game can take 30 to 40 minutes and I am rather reluctant to spend 1-2 hours waiting for Rimworld to start unless I am unable to find an alternate reason.

Roolo

#6
Quoteas I did not notice any significant hitches it took around a third of an hour for the 1x test and close to half an hour for the 3x test
Not having any hitches certainly doesn't show that at 1x speed you're getting the same framerate as at 3x speed. I'll explain a bit more about frame rate to clarify why measuring real time makes no sense at all.

At normal speed, the graphics are updates 60 times per seconds. The number of graphic updates per seconds (in other words frames per second - FPS) is exactly your framerate. The game also updates the game state 60 times per seconds. Game state updates are called "ticks", and at normal speed there are 60 ticks per second. If you increase the game speed, you effectively increase the number of ticks per frame. So if everything goes well, increasing the game speed to 3x, will result in 60 frames per second, and 3*60=180 ticks per second.

However, most computers aren't able to handle this amount of ticks, especially during late game when there are a lot of updates that need to take place and with a lot of mods. It can certainly be possible that you get 60 FPS at x1 speed (and 60 ticks per second), but only 30 FPS at x3 speed (and 90 ticks per second). In this case, running at x3 speed, in practice only lets your game run 1.5x as fast.

So everything in game is updated using ticks (including the in-game time, one hour in-game is equal to 2500 ticks), and a bill takes a certain amount of ticks. This number of ticks is calculated by the pawn's skill and health, the material, the bill itself, room temperature, and some other factors. If, taking into account all these factors a bill would take 5000 ticks, it would take exactly 2 hours in-game.

Because of all this, measuring real time effectively only measures how many ticks per second you're getting, which only tells how well your computer is capable of running the game at higher speeds and certainly won't measure how fast the bill will be completed in-game, since real time has no relation with in-game time. Since jobs always take a fixed amount of ticks (if no conditions change that affect the work speed), and ticks are never skipped, we can be certain jobs always take the same amount of in-game time.

You're of course free to measure if this is true, but like I explained, measuring this would only make sense with in-game time and with long enough experiments.

Quoteit took around a third of an hour for the 1x test and close to half an hour for the 3x test.

This is a way too short time interval to do any valid comparisons. I recommend, like Canute did, to do experiments with very long tasks, that take at least 10 in-game hours to complete. But again, such experiments won't yield any surprising results.

zizard

Another option is to use a mod that shows minutes as well as hours