Should house have innate wiring that we could plug a generator into?

Hacking out a wall and shoving an aborted mutation of a car into it to get power works, but it just feels wrong. If houses had some sort of innate wiring that a generator could be plugged into we could get real fridges up and running, basic lighting, and some time in the future maybe even heat and air.

how do you think it could be done?

What I think could work, is to use the construction menu to build a port to setup a generator item in, then it transfers power thru the walls. Or if we wanted to make it more difficult, walls could have a upgrade stage were we build wiring into them to wire up items like lights and fridges and washing machines.

3 Likes

Vehicles are loaded into the reality bubble in a kind of all-or-nothing thing, after a sufficient but small part of the vehicle is in the bubble.[1]
Houses are loaded into the reality bubble one tile at a time.
There is no good way to get an entire house, of unknown and arbitrary size, to load into the reality bubble at the same time, short of substantially rewriting large parts of CDDA.
Thus, there’s no way to guarantee that your lights at point A (inside the reality bubble) are connected to a generator or battery storage at points B and C, which may not be inside the reality bubble and if they’re not, they don’t exist.

This conundrum is the fundamental limitation on why people have to build vehicles to get lights and generators to work instead of just hooking a small generator to an existing house. It’s not because the developers are mean and want solar powered lighting to be a challenge, it’s that there are limitations to how CDDA is set up and house electrical systems are one set of them.

If you solve the problem of guaranteeing that the generator is always in the bubble at the same time as the appliances, then the exact interface to enable lights is a minor detail. If you don’t, working on the interface doesn’t get you anywhere.

[1] Very large vehicles can still have some weird behaviors, and I believe if you have a vehicle more than 122 tiles long than really weird things happen. Some of these issues aren’t really solvable, but they’re either rare corner cases or examples of people doing crazy stuff. But the idea that if you take over a mansion, you should be able to use the lights isn’t crazy, it’s just hard to implement.

1 Like

I’m not one of those people that thinks the devs are mean… well Kevin can be a grump some times but rustling use dipshits can do that to you :stuck_out_tongue_winking_eye: .

I see, so basically if you just skim the edge of your house and it only catches the fridge and not the generator it would basically mean the fridge didn’t work and food would rot quicker than the player would expect. Lighting wouldn’t matter because, well you aren’t in the house for it to matter if you are far enough away for the reality bubble to be an issue.

Houses are considered part of the terrain, is that why they load one tile at a time? Or is it a different thing al together?

I am very much not a map loading expert, but furniture and terrain are loaded one tile at time on the edge of the reality bubble. And houses are made from furniture and terrain.

1 Like

Thank you for the insights.

That’s a great example. We have this solved for vehicles, but it doesn’t work for other terrain.

1 Like

So the only solution would be to make houses load as an entire entity, but I imagine that has all sorts of issues, especially with loot spawns, mob spawns, terrain generation, etc.

A “house” is potentially a 6x6 factory or mansion or a 9x9 mall. Those things don’t fit in the reality bubble. That’s pretty much the issue.

If you could guarantee that houses were only going to be the size of an evac shelter or LMOE shelter, it might be possible, but people are going to get grandiose.

1 Like

Yea people do like to claim those big properties, but as far as i’ve seen not many utilize more than a room or two. mainly because of how crafting works. Not saying thats a bad thing or a good thing, just how it seems to be. But i can see how the problem would be exacerbated by a larger building.

The solution seems to be out of scope of the game at the moment, as I’m sure no one wants to rewrite buildings on such a grand scale.

Slightly off topic, but I did always wonder why I could never find copper wiring inside house walls. That’s the bread and butter of scrap!

2 Likes

You know, if I was going to tackle this (which I’m not, but I used to code a lot years ago) I think the way I’d solve this is to add a “powered” flag to the map tile, so even if you only had part of the house loaded, the system would know to make those lamps give off light, and the fridge cold and all that when it puts it in the reality bubble.
Cache a value for “gas available,” “power per gas,” “power storage” and “total power usage” for that tile, and you could tell when the batteries are drained, how much of the gas to delete when the generator pops into the reality bubble, etc. Add in “generator X,Y location(s)” and you can have the generator placed (and tracked) a couple map tiles over, say the north end of the mansion. You’d probably need a timestamp for the last time the game updated those values. (I imagine it’ll only update if you were within one of the big overmap tiles, and maybe just once or twice a day until you hit reality bubble range)
Solar would require a couple more variables for tiles that had solar power, to track number of panels and efficiency.

1 Like

Still doesn’t work.
How do you know gas available, power storage, and total power usage for a tile? If it’s just for that tile, then you have can have a device that think it’s drawing minimally on the generator 7 tiles away outside of the reality bubble, but there’s a huge floodlight 6 tiles away also outside of the bubble, and that floodlight would drain the battery in 6 turns.

If each tile has to know the power draw/consumption and fuel supply of every tile in the circuit, you’ve managed to bloat the map, bloat each tile’s storage in memory, and then you have to go update every tile in the circuit when any of them changes. Even the vehicle code isn’t that crazy.

There’s no great way to handle it. Vehicles kind of work because vehicles are loaded into the map as one entity if they’re loaded at all. I’m not sure loading an entire 4 overmap tile, 5 Z-level enlarged brick firehouse into the map as soon as a corner of it is within the reality bubble is feasible.

1 Like

If I understand it correctly, the main problem is that game does not know how large area it has to load around a tile that has some electric appliance installed on it?

1 Like

It doesn’t know how large an area, and even if you could tell it, it may not be possible on some machines to load all those areas.

ie: I’m establishing Metown, the post-apocalyptic community that’s fun to be at. Metown currently consists of the following overmap tiles:

FF...PP
FF...PP
.......
...<...
.......
SS...Hh
SS...hh

Standing at my command center at <, I can have the edges of my fire station, police station, secondary school, and hotel in the reality bubble. All of them are multi-level, with various lights, generators, and appliances. So now instead of 121x121 reality bubble, I’ve got a 200x200 reality bubble and since I’m playing this on my tablet, I just out-of-memoried.

It’s not an unsolvable problem, it’s just really hard and would require a lot of change.

1 Like

I think that majority of people would be happy with something much more modest that that… :smiley:

1 Like

I know, and I agree. The problem is you have to at least handle the crazy scenarios gracefully.

1 Like

What if the player told the game what area needs to be loaded and all appliances inside of such area would be parts of one circuit. Appliances outside of such area would be either part of different area or outside of any area, thus disconnected and irrelevant.

I think you might guess where I am going with this. I hope that I do not sound like a hammer that see every problem as a nail… yet :wink:

1 Like

Cache it when the tile is generated, or unloaded if the player built it. I don’t think the amount of calculation you’d have to do would be any worse for an overmap chunk worth of power flow than for standing next to a forest fire. We’re talking like six numbers per overmap tile, tops, usually less, and the calculations are dirt simple and could be done only when the player gets a connected, powered map tile into the reality bubble. Or like once a day.

But you don’t need any of that, what I was suggesting means you only have to track 7x7 overmap tiles for all of that, and it’s actually better than that because instead of tracking all 49 tiles, only 16 of them have any calculations to be done, and that’s just three of them for the relevant tiles: “subtract gas/calculate solar; add the result to batteries; drain power usage from batteries.”

It does occur to me that refrigerators would be a sticky point. I mean if a survivor repairs a power station and walks on into the town for the first time, it doesn’t make any difference that the lights came on 15 minutes ago after being out for 2 years, but you’d have to communicate that to the rot code when it handles the stuff in fridges, so it doesn’t assume it’s been refrigerated the whole time.
I suppose you could store timestamps for when a power source changed its state, but that still complicates things. And could maaaybe cause problems if a player repeatedly starts and stops the power over and over without walking the reality bubble around to push that data out to the connected tiles so it could be flushed.

Ah, I missed that you wanted to calculate the power numbers per overmap tile. That might possibly work.

Overmap data that needs to be tracked but isn’t:

  • Active fire bitmask
  • Power generation and consumption
  • Light sources
  • Fortification / barrier status

It’s a bunch of stuff, but having all that would extend the game in a lot of ways. The fire bitmask would mean that fires burned outside of the reality bubble. Power generation/consumption would make non-vehicle power possibly viable. Light sources would mean you could have a floodlight outside the reality bubble illuminate the reality bubble. Fortification / barrier status would prevent hordes from appearing where they shouldn’t.

2 Likes

if done it could collaborate with the out-of-bubble base defenses idea, which would mean more things being calculated… would be so cool to see though.

1 Like