I have a workable idea on a power system I just need a primer on the way the engine functions so I can add it in. Right now I am planning only for a VERY VERY bare bones system. But one that can easily be expanded on later on.
Each building is powered by the plant closest to it. If that plant is on, then that building has power, if not, it doesn’t. Simple.
This means if a city is split between plants one house can be powered up, and next door the power off. This happens real life too!
Power plants can go offline after X+/-Y hours. Some can be restarted later on with a sufficient Computers/Electronics check. Powered buildings will have working lights, and refrigerators. Other appliances can come later on. At first, maybe only refrigerators. The lighting code is likely complex.
The initial plant will just be a solar power plant, since those are easy to place, and require little upkeep. It will likely have zombies inside.
Implementation:
Basically. We generate power plants and then calculate the nearest plant to each building. We need to record this in both the building and the station (list in station, pointer in building). In the station so if the power goes off, we turn off all appliances in all connected buildings. In the building so we can check if the power exists when toggling power on appliances.
They will need to be turned back on once and while if they go offline. Most will be off at the start, others will go off within 2-4 days. Restarting will toggle it back on for another 4-12 days. I assume a high computer (8) or electronics (6) skill will be needed to restart the plant.
I assume only 2-4 plants will be generated on initial map gen. These will be placed similar to apartments, towers, or hospitals. But forced to generate (since they are a required structure).
This would be best stored as map data, but would be more backwards compatible if it was only calculated when loading.
If a new plant is generated, recalculate the closest buildings. Initially I will only power building map tiles.
Stuff that will not be added initially:
Player created buildings won’t receive power (which makes sense really). But this system will provide something of a backbone if someone wants to later add player created power (for their base/etc).
Power usage/strain. This makes sense for player power, not for the national grid. Adding it would complicate plant generation.
Repairing/Damaging stations, for now they won’t be broken. Just offline.
Power Lines/Substations. I have an idea for substations (plants that generate no power, but receive it), but power lines would really complicate the system.
I have heard this before, until you start, go away!
Right, right, I understand this point of view. This system however isn’t very complex. I also have 14-15 years programming experience under my belt. The hardest part will be figuring out how the engine is put together and overcoming any issues that pop up because of it’s design.
Thoughts, and so forth.