switched off things breaking down

Started by matthiaskrgr, May 28, 2016, 06:04:35 AM

Previous topic - Next topic

matthiaskrgr

I had a couple of heaters which were switched off because it was summer. They still broke down and had to be repaired. :/


Tynan

Hmmm.

So maybe, they should only break down when "running". But I'd have to make a universal way to tell when that is...
Tynan Sylvester - @TynanSylvester - Tynan's Blog

milon

If "switched off" means actually toggled off, then I think the answer is Turned Off = Can't Break.  If they were just in low-power mode because the temperature was high enough, then I think it's okay for them to break (but maybe make it less likely?).

I think what I'm saying is you could use some kind of power-related Ticker with frequency or stepping related to how much power is drawn.  No power = no ticks = can't break.  High power draw = heavier use = more likely to break.  Assuming having a variable-rate Ticker isn't absolutely insane.  ;)

Tynan

I just mean there's actually no central piece of code that says if something is on or off.

Conceptually, it can be off due to having no power. Or due to being turned off. Or due to having no fuel or for whatever other reason.

E.g. should a tailor table be able to break while nobody is using it?

It's a harder problem than seems obvious.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

1000101

I can see the dilemma Tynan is in, CCL's low power comp has to do a large amount of strange checks to determine if a building is "in use" and what "in use" means for any given building.  eg, a TV being used is very different from a work table being used which again is very different from a door or nutrient paste dispenser.

That being said, CCL's CompPowerLowIdleDraw does do these checks however, CCL has the advantage of being told what type of "usage" checks a building needs.  Trying to determine this completely programmatically would require even more checks which could potentially degrade game performance.  CCL does try to minimize the frequency of these checks based on the "mode" of the building but, as I already pointed out, it is being told the usage mode.

CompPowerLowIdleDraw.cs
CompProperties_LowIdleDraw.cs
LowIdleDrawMode.cs
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

matthiaskrgr

Quote from: Tynan on June 03, 2016, 04:45:04 PM
Hmmm.

So maybe, they should only break down when "running". But I'd have to make a universal way to tell when that is...

Good point, I didn't think that through thoroughly.

For right now I think it would be nice to have electrical things not break down if they are
a) switched off
or
b) have no power

In the future one could implement a "runtime break down".
If a table breaks down while being used, it degrades the quality of the manufactured item or dissolves it into its material (just like cancelling WIP-clothes) and the colonist has to restart working on it.

Drahkon

Had wandered off, but thought of a possible fix and swung back, though it would require a change to how the event happens at all.
The current 'breakdown' event could only apply to powered on 'always active' devices such as lights, heaters, generators, turrets.
For items that are really only expected to break during colonist use such as workbenches they could instead have a 'chance on use' to break, normally quite small but increased by being damaged, pawn skill could even factor in slightly.  Perhaps an event could be made of that as well. 'A plume of an unknown chemical clouds the area, all equipment will break down more easily until it has passed.'

Shouldn't hit performance that had this way I think.

Fluffy (l2032)

@Drahkon
that just moves the problem from the breakdown event to a new event.

The main thing is that there's no low-level 'in use' property on Things/Buildings. In layman's terms; there's no unified way to see if a building is currently in use - the way to do this is currently different for a number of different scenarios.

It would be nice if there was a public(!) virtual property on Things/Buildings to do this, where the base considers the relevant vanilla powered/fueled comps, etc.

Drahkon

#8
Not quite, since by calling it at the end of the pawn's job interacting with the building, it ONLY occurs when the building is in use, thus no need to make a check.

Just suggesting that instead of trying to initiate a breakdown, then try to see if the building is in use, when a building is used, do a breakdown check. Any building that isn't 'used' by a pawn can be assumed to be 'on' any time it is powered.

Though depending on the structure, may spread the problem out, requiring calls from multiple locations.

Edited for clarification. Also: a public prop for in use would still be quite useful no matter how this is handled.

b0rsuk

1. It sort of possible for a machine to break while nobody's using it. Rust, dust gathering, mice chewing on a cable. You typically discover it's broken when you try to switch it back on.

2. In case of some machines it's ambiguous. If we define "used" as "power enabled", then a tailoring table can be used while not used.

3. In many bases, turrets would stop breaking altogether. If you have all turrets behind a switch, you only turn them on during a raid. What to do in such situation ? Give turrets boosted breaking rate ? That will punish players who worked hard to provide all turrets with power 24/7. Keep the current rate ? Turrets will barely break.
More generally, various machines differ in the average time they spend working, and might need individual tweaking of breakdown rates. That's a lot of work - and I realize the same argument can be used to shoot down "machines only consume power when used" idea I advocated elsewhere.

4. I don't know the internals of Rimworld, but if frequency of checks is a performance problem you can make those checks only when Storyteller rolls a breakdown event. Then verify if the device is powered on or operated by a colonist. If it isn't, roll a different event.
So performance shouldn't be a problem.

skullywag

Well the issue is this "event" is not controlled by the storyteller, its a somewhat simulated thing that will occur if a thing has a comp. I personally think this is something the storyteller should control, the effects of a thing breaking down at a key point can cause all sorts of drama, therefore seems to fit perfectly in with the storytellers arsenal of things to create the story. As a side effect it removes this issue altogether, well once youve written the validator for what things can be set to brokendown. :p
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Drahkon

Eh, I was just approaching the problem from 'making it work' view.

From the perspective of 'how would I do it that makes sense'..

I'd got with a storyteller event, event triggers, it picks some number of items to break based on total breakables, those items are flagged. If the item is powered and an 'always on' item, it breaks then, if it's a workbench, powered off, or something else along those lines it 'breaks' when powered back up/used by a pawn, or whatever is applicable.

Tynan

Okay, I've applied a limit where it won't break down things that could be powered but aren't. This includes switched-off things.
Tynan Sylvester - @TynanSylvester - Tynan's Blog