Cataclysm-dda: Powered Home Network

Created on 14 Dec 2017  路  21Comments  路  Source: CleverRaven/Cataclysm-DDA

This is a system to provide and manage power to appliances in houses. Appliances consists of furniture that has one of the following attributes.

  • bool: requests_power
  • bool: provides_power

To tie these appliances together, a special furniture is made, the "Home Network". The Home Network must be placed on a tile with the ROOF flag. When placed, it floodfills all connected ROOF tiles and marks those tiles as powered, with a reference to itself. It might make sense to limit it to no more than 256 ROOF tiles, for performance/balance/sanity reasons. This is meant to power a home, not whole mansions or factories.

The Home Network will periodically drain charge from all furniture that provides power, but can also be connected directly to a vehicle generator using jumper cables. The Home Network simply acts as a storage battery with some logic.

Appliances

  • Stovetop, works like a hot plate, but draws power from the Home Network.
  • Washer, will clean up to 8L clothes placed on the tile and draw some power from the home network along with some detergent. Power is drawn immediately and then the machine will be finished after 2 hours, working passively like kilns.
  • Fridge, just like the RV fridge, but much more volume. This needs some consideration on how power is handled when unloaded.
  • Vaporizer/Condenser, provides concentration recipes, like salt water to salt, sweet water to sugar or weak acid to strong acid.

The system is a wireless power system, but only as an abstraction over the fact that it's assumed that anything under the same roof as the Home Network is within range of a powered wall socket. The system is also less abusable than vehicles, since it has a limited area of influence and it takes much more work to expand a home than it does a vehicle.

The system tries to be a nice compromise between vehicles and jumper cables. The idea was inspired by #22326, but tries to avoid modifying the existing vehicle system to do something it wasn't designed for. It is flexible, since you can use any generator you've always been able to. It would also be possible to make an installable vehicle part that gives vehicles request_power functionality, so they charge while under the same roof.

As for the future, several ideas have come up about special machinery that isn't suitable for cars, but can still be installed in homes. Some parts would be scavenged, like finding a CNC Machine at a factory, transporting it home and installing it for faster metal working or even more exotic things like machines that produce reloaded ammunition or even kevlar plates.

I'm writing this post to get feedback on the system and get the details in place so I can start implementing it. I was told there have been some resistance to wireless power systems in the past, so I don't want start making this if it'll never be accepted.

<Suggestion / Discussion>

Most helpful comment

I don't see the problem with abstracting power transmission. It's already done with vehicles and works fine. In addition, tying it to roofing is a very sensible way to determine the bounds of house and implicitly require the player to wire it. The assumption is presumably that when the player makes a new roof/frame (s)he also installs wiring to allow the future installation of electrical devices.

The alternative to an abstracted system is to make the already tedious, time consuming, and inferior to vehicles construction system even more so. Why bother with the extreme tedium of manually wiring all your appliances when you can just such them on a vehicles instead and get an easier, cheaper, and more convenient experience? In fact, it's already possible to recreate this proposal in-game by using a vehicle as flooring. Just cover the inside in light frames and roofs. Not only is this substantially faster and easier than building a proper roof, it allow for so called 'wireless' power across the whole house, solar panels, roof top turreted, and so much more.

All 21 comments

Cables typing furniture items together is the preferred solution, as I've pointed out multiple times.

In particular I gave you a clear "no" to "wireless" power earlier TODAY, so I don't see how you think I'm going to suddenly about-face now.

There are ample alternatives to this kind of system that are just as user-friendly, but don't abstract the system to this degree, like when you construct or release a grab on a piece if powered furniture, the code checks for a power network in range of the furniture's location and a usable cabling item, and prompts the player to attach the furniture to the network.

I'm leaving this open for discussion, but your proposed solution is not ok for merge.

the more i think about this, the more i see wall sockets don't really work either.
unless you want to rewire an entire house.

_that_ would entail making new walls with an item similar to wired sheet metal as you'd need to emulate checking the wiring of the entire house and redo a lot of the setup, which is not something a survivor would realistically be able to do. that kinda thing isn't something even a certified electrician would take on easily. we're looking at Electronics 10+, easily.

when you construct or release a grab on a piece if powered furniture, the code checks for a power network in range of the furniture's location and a usable cabling item, and prompts the player to attach the furniture to the network

all that would need would be a new cable type - say an extension cord, which would just be a jumper_cable with a bigger charge - then deconstructing part of the furniture or grabbing it would disconnect that cord.

Well, so as long as the player doesn't have to manually check and connect each cable such as through an autodetect, I think the effect would be fine. The overhead of having to check each and every cable once you have more than a few appliances gets fairly mind-boggling.

In particular I gave you a clear "no" to "wireless" power earlier TODAY, [...]

No you didn't.

There are ample alternatives to this kind of system [...]

What are the differences between my suggestion and yours, if we simply include an extension cord in the recipe for appliances?

[...], which is not something a survivor would realistically be able to do.

The game already lets you build a house from the ground up alone. Including a bit of wiring along with it doesn't seem outside the intended capabilities of a survivor.

I literally said, "wireless power, no". You might want to check chat histories before contradicting people.

What are the differences between my suggestion and yours, if we simply include an extension cord in the recipe for appliances?

How long of an extension cord? Do all appliances require a maximum sized extension cord now, or does it magically extend as needed? Regardless of that, your system is redundant with existing code, doesn't interoperate with vehicles (or requires integrating the two power transmission systems together), and doesn't allow spanning power transmission outside the reality bubble. Its unclear how your proposal will interact with a mixture of multiple power sources and sinks, and power sources that are also power sinks.

I literally said, "wireless power, no". You might want to check chat histories before contradicting people.

And if you look right before and right after that message, we were talking about vehicles at the time, so it was in the context of vehicles, not a separate clear "no" to "wireless". But my apologies for misunderstanding that.

How is it redundant and why doesn't it interoperate? As far as I can see there's nothing to prevent this from using existing power apis, assuming they exist. This is just a feature that makes powering homes less of a hassle.

that kinda thing isn't something even a certified electrician would take on easily. we're looking at Electronics 10+, easily.

???? My father and I replaced all the wiring in an 80 year old house over the course of a month. Electricity is dangerous, not complicated. Walls are(mostly) hollow with soft insulation in them, so running new cables really isn't that hard.

By design, the electrical systems in most homes are designed to be relatively easy to alter with some proper equipment, wirenuts, etc. The realism of powering up existing home systems is there, if nothing else.

I kind of feel like I should point out, for the sake of complicating everything, that wireless power transmission _is a thing_ ( https://en.wikipedia.org/wiki/Wireless_power_transfer ) that actually exists, and would probably be a more mature technology by the 2040s, and would likely be used for wirelessly charging small handheld devices powered by what are probably comparable to Lithium-Ion batteries, such as smart phones and flashlights and the like, but that's tangential to the topic at hand.

Obviously, you would not be powering a washing machine which draws mains AC wirelessly. Even if you could you would be generating enough EMF or other kinds of weird radiation to be dangerous. (OTOH, that raises the amusing possibility of wiring up a homemade short-range microwave weapon to use for cooking zeds, but I digress.)

Domestic and industrial power transmission would still probably be accomplished by means of copper wiring; this wiring is typically found in the walls and under the floors of buildings, though in industrial settings it is sometimes overhead. Whilst outlets are not ubiquitous, they are reasonably plentiful.

The real question I think is, how would this be modeled? As a grid of wires running through the floorboards and walls? This would complicate mapping considerably, I think, as each wall and floor type would also need a "... with wire" version (that would probably not be obvious to the player unless it were damaged or the player had a wire finder,) and also a "with socket" version. (Yes, there are electrical floor sockets: https://www.screwfix.com/c/electrical-lighting/floor-sockets-boxes/cat1470002 )

Adding to that is, of course, the question of power strength and cabling. You do not try to power anything heavy, like say, a space heater or a high-draw appliance (such as a stove, refrigerator or washing machine,) with a cheap, lightweight extension cord, not unless electrical fires are on your list of things to see (shortly) before you die. Heavy-gauge extension cords _do_ exist, but they're still not something you'd want to power a big appliance like a range with; which brings up another problem, in that large household appliances are wired for 220 whilst most are wired for 110, which results in the use of three-wire split phase systems to provide such behemoths with power.

At some point though, the question is, as with all things, where to draw the line between realism, and requiring the player to actually _be_ a certified electrician in order to make sense of (and use of) the system in-game. Frankly it begs the question of why have character skills at all if the player is going to be required to have and make use of extensive personal knowledge. Some high degree of abstraction is, I think, required.

Without rewriting the entire map system to accommodate not only terrain and furnishings but infrastructure like wiring and plumbing - which, to be clear, I think would be the superior solution, but a massive PitA - the best way to do it for the immediate goal of allowing a powered player-base would probably be to dupe the manmade terrain types and add a "... with wiring" and "... with wiring and socket." The reason to use the terrain layer for this is that basically everything the player is going to want to power is a furnishing, and they cannot occupy the same slot; thus it would be weird if your floor electrical socket could not occupy the same slot as the fridge it supposedly powers.

Powered furnishings would mostly have a power cord long enough to draw power from an adjacent socket, and would plug in automatically when you moved them into range. Most such sockets only have two outlets or even one, but it depends on just how annoyingly complicated you want to make things for the player. After all, salvaging some more sockets should be pretty much as simple as heading next door with a crowbar and some wire cutters.

Then there's the question of extension cords and, say, powered hand tools - anything from a corded hair trimmer like a barber would use, to corded drills, etc. This is where you're rapidly getting into things that the engine does not appear to handle well; would you then make a "... with extension cord," "... with extension cord and wiring" and "... with extension cord and socket" version of all the terrain types? I think, in this kind of situation, there's basically two things you're worried about: power strips, and long-corded devices.

Devices with long cords could, as with furnishings, work as long as they're within X radius of a socket that has power, whilst power strips would probably be a simple construction you can put up that need to be within X range of a socket and function as a socket - but only for things that are not big appliances, and it is a really, really dumb idea to use them to power things like heaters and air conditioners and stuff. Extension cords... I don't even know how you'd model them without just rewriting everything to permit more than terrain and furnishings upon a single tile. Part of the major problem I see is that such cords would need to be obvious at a glance, and they just wouldn't be; unless you make them a furnishing, which would get silly. (You cannot put a chair over an extension cord?) I tested jumper cables just now to see how they worked, and holy crap it took me forever just to find that single tile with the jumper cables on so I could remove them from my vehicle.

Longer-term, you would want the outdoor manmade terrains - IE, sidewalks, streets, etc - to have "... with mains wiring" differentiation, I think; that way, you could just determine if a map tile has mains connection to its adjacent tiles, and go from there. That might form part of a framework for larger-term power grids exceeding the reality bubble.

I'd like to point out that vehicles currently do have wireless power (and transmission). I think it would make sense that whatever is decided for houses works the same way in vehicles, for consistency's sake - either houses are wireless as well (maybe with a radius around the power source?) or the cars need wires going from the batteries to the headlights and engines.

I think it would be generally safe to assume that homes have wires in them. The challenge should be to hook up some form of power input to the house's AC, and then walls could just be treated as being powered if there contiguous with wherever power is coming in.

I don't see the problem with abstracting power transmission. It's already done with vehicles and works fine. In addition, tying it to roofing is a very sensible way to determine the bounds of house and implicitly require the player to wire it. The assumption is presumably that when the player makes a new roof/frame (s)he also installs wiring to allow the future installation of electrical devices.

The alternative to an abstracted system is to make the already tedious, time consuming, and inferior to vehicles construction system even more so. Why bother with the extreme tedium of manually wiring all your appliances when you can just such them on a vehicles instead and get an easier, cheaper, and more convenient experience? In fact, it's already possible to recreate this proposal in-game by using a vehicle as flooring. Just cover the inside in light frames and roofs. Not only is this substantially faster and easier than building a proper roof, it allow for so called 'wireless' power across the whole house, solar panels, roof top turreted, and so much more.

I really like the idea of a central home tile. you could walk up to the tile, and it would prompt you with things like "connect nearby stove", "connect nearby solar panel", "connect nearby generator", and more, if they are in range, or under the roof tiles that make up the house you're in. After selecting to connect one of these appliances, it could prompt for a specified amount of wiring to connect them to power. Then the home network tile could simply keep a list of all these appliances for out-of-the-reality-bubble purposes. It seems as though it could be very closely related to the vehicle controls tile on a vehicle.

Yet another option is to use the same vehicle-creation window for an entire house, where you could wire every tile separately as you see fit. (This specifically addresses the problem with wireless power) Wireless power used to power all the appliances inside a house is very far fetched due to the distances and whatnot.

We still don't know if Cataclysm wants to be realistic, or in the future, or not realistic because zombies exist, and much more. If everyone had a clear goal for the game in mind, then I believe this would resolve many of the issues here.

I would like to see any comment on what direction we can do while still being acceptable to the devs so we can start on the actual coding for a PR.

I already gave you a direction:

Cables typing furniture items together is the preferred solution, as I've pointed out multiple times.

There are ample alternatives to this kind of system that are just as user-friendly, but don't abstract the system to this degree, like when you construct or release a grab on a piece if powered furniture, the code checks for a power network in range of the furniture's location and a usable cabling item, and prompts the player to attach the furniture to the network.

Yes, and that direction leads to construction roofing being objectively worse than a vehicle tile in yet another way. Adding a vehicle like menu where we install wiring and adding the same requirement to vehicles is the best compromise I've seen so far.

Doing everything with cables isn't even that realistic, as others have explained above. Using extension cords for everything is much inferior to putting wiring in walls/floors as pretty much every modern home does. The biggest question I see is whether that wiring should abstracted.

that direction leads to construction roofing being objectively worse than a vehicle tile

This is a meaningless distinction, this isn't a competition between vehicles and static buildings.

Adding a vehicle like menu

This is a terrible idea, the vehicle menu is incredibly complex and hard to work with, the LAST thing we want is another copy if it.

The use case in question is making powered appliances the player can interact with, and re-using vehicle cables is literally a few dozen lines of code, as opposed to however many hundreds of lines of code this approach requires, along with inheriting nonsensical restrictions such as range limits and requiring a roof tile in order to transmit power.

How does this approach handle building a base in a cave? How about a tent? How about a workshop in a barn?

This is a meaningless distinction, this isn't a competition between vehicles and static buildings.

It kind of _is_, Kevin; if making a "vehicle" that doesn't move and is simply intended to provide shelter and power to workshop pieces is a clearly superior choice to building a structure, or (more likely) modifying an existing structure, _that is what players will do,_ even if doing so is nonsensical lore-wise.

This is why we have silly things like the home-base solution I used in my playthrough, where my powered tools were all individual "vehicles" consisting of an ultralight frame, 4" casters, a swappable storage battery, and whatever big powered component I needed them to be (IE, vehicular welding rig, vehicular forge, etc.) and even sillier things like a "vehicle" which bisects the actual wall of a building, so that the external part of the "vehicle" can carry the solar panels whilst the interior parts hold the tools and such.

So whatever system winds up being used to power your home, it has to be less of a pain in the ass than making a "vehicle" do the job, or people will ignore the "building" subsystems in favor of the "vehicle" subsystem.

It would be nice to have a system where we could make a house into a "vehicle" with wiring capabilities and functions for appliances, but with the small amount of devices a home needs I would really just prefer to connect everything in my house with some sort of tiled version of the jumper cable system that is already in place. Cables could first be "laid" on the ground by connecting the starting end to an appliance and either activating the wire to drop the leftover end on the ground or connecting it to the ending device.

If you wanted to power multiple devices you could have attachable splitters which could be modded to the end of a wire (like a battery storage modification) allowing usage of power between devices. But trying to what I see in the vehicle system with houses seems a very daunting task to code, and would likely get messy when it comes to processing times when converting the house from a simple set of tiles to a "vehicle". Of course with a cable system you likely would want to consider series and parallel circuits being a possibility, but trying to create wired houses using the vehicle system is just unnecessary. I would use a jumper cable system over the vehicle one since its already implemented for vehicles and a very similar system could be put in place for standing appliances.

A "central organization" menu is a huge part of why vehicles are more popular to interact with than to fiddle with each and every possible angle of a house. When you can simply have the materials, and hit R to instantly fix up the car, whereas dragging around 2x4s to board up each window, its easy to see how the deathmobile playstyle raidly becomes the only viable one.

Nothing about the issues I've raised with this have been adressed. The status quo remains, if you want to implement standalone appliances, do so by:

  1. Adding an appliance flag for vehicles that disables the vehicle interaction menu.
  2. Create new "vehicles" that have this flag, along with necessary th coronal components.
  3. Add above appliances to the construction menu.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

RogueYun picture RogueYun  路  3Comments

ituluwituluwzev picture ituluwituluwzev  路  3Comments

BorkBorkGoesTheCode picture BorkBorkGoesTheCode  路  3Comments

pisskop picture pisskop  路  3Comments

2birdie picture 2birdie  路  3Comments