SmartPower - ihsoft/TimberbornMods GitHub Wiki
На русском языке эта странциа пока не доступна, но будет.
This mod modifies some power generating and consuming buildings to optimize power usage. It also adds some UI sugar to the existing components.
Features overview:
- Ironteeth Engines load automatically go up and down to minimize the wood consumption while providing enough power supply.
- Engines will charge batteries in a specified range from 10%/35% up to 65%/90% of the charge. The exact setting can be defined per engine.
- Irontheeth charging station consumes power only when charging a bot. In the idle state it's not taking power.
- All powered attractions work and consume power only if there is at least one attendee. Unoccupied attractions don't take power.
- All powered manufactures go into power saving mode if they cannot make product. In the power saving mode the consumption is only 10% of the nominal building power.
- [UI] Mechanical nodes (thafts, generators, etc) show extra information about batteries status.
In the vanilla game, the engines stop only if the is no power demand in the network. If there is at least one consumer, then all the engines will be working, regardless to the real power demand. SmartPower
improves this logic. Now, all unnecessary engines will stop burning wood and producing power. However, they will not turn off, i.e. they will still be requiring a worker. In case of demand goes up, some of the stopped engines will start to cover the increase. If the demand raises at a big spike, then it's possible to get a shortage for a second or two. This can be resolved by adding batteries. Even one battery will be able to cover such spikes.
Checkout this video to see how it works (old demo, no new control features).
There is a trick, though. The smart logic creates an edge case: if all the consumers in the network are idle and don't create a demand, then all engines will stop. In this case, the game will assume the network is not powered, and all the connected buildings will be assumed to be unpowered too. And if the building is unpowered, then it will never be attended by a worker and never will start consuming power. Thus, the engines will never start. Dead end? No!
There are two ways to solve this problem:
- Add a battery to the network. As long as the battery has even a small charge, the network will be assumed powered. And when any demand appears, the engines will start and cover it. As well as they will charge the battery.
- In the early game, when making battery is too expensive, some of the engines can be set into mode "always on". It's enough to have just one such engine per network, but you can set multiple to optimize power generation in your specific case.
To make the power balancing logic more efficient, the engines now charge batteries in a more sophisticated way. Instead of doing it constantly, they charge the batteries until the total charge reaches the maximum threshold. After this point, the engines stop and let the batteries to cover the demand. When the total charge drops below minimum threshold, the engines start and begin charging the batteries again. This charge/discharge process repeats endlessly. It ensures that the wood is spent the most efficient way and nothing is burnt for nothing.
The minimum/maximum charge levels can be setup on per engine basis. The default settings: minimum level 65% and maximum level 90%. This setting is good when only the engines power the network as they keep the batteries at the high charged level (90% max). However, if there are other sources of power in the network (like water wheels), then it makes sense to lower the charging range to capture more of the "free" power. E.g. with the setting 10%/35%, the engines will ensure that the batteries will never go below 10%, but at the same time will not waste wood charging it too high. Once the batteries are charged to 35%, the engines will stop and let the other sources to fill the rest 65% of the capacity.
In the vanilla game, the chargers always take 50hp of power, even if they are not used. It significantly impacts the ability to plan bots network. With SmartPower
, the charges will only be taking power when they are actually charging a bot. Thus, it's now possible to build the chargers "just in case". Regardless to how many of them were built, they will take as much power as needed to charge the bots and not more.
In the vanilla game, the attractions are consuming power 24h a day once connected to the network. However, they are actually used only a part of the day. Usually, it's the end of the day after the work shift is over. With SmartPower
, the attractions only work if there is at least one attendee.
This logic applies to all attractions, both the stock game ones (mud bath, carousel) and the ones created in mods (like Ferris Wheel).
In the vanilla game, if a building needs power to make products, then it always consumes it at the highest level. The are only few cases when such building doesn't take power: no worker assigned and worker is off the working hours. However, there are many more cases when the building is actually does nothing, but the power is still consumed. SmartPower
covers this gap. If the building cannot make product, then it's brought to the power saving mode. In this mode it consumes only 10% of the nominal power. E.g. if Smelter cannot make metal blocks, then it consumes only 20hp instead of the full 200hp.
The following cases are currently recognized and turn the building into the power saving mode:
- No workers at workplace. Triggers when an assigned worker has left the building during the working hours for any need. E.g. the worker may be delivering the required ingredients or moving out the product.
- Missing ingerdients. Triggers if there is not enough ingredients to start the production.
- Fuel has ran out. Triggers if the recipe requires fuel, and there is not enough fuel in the reserve.
- Too much products. Triggers when there is no more space in the inventory for the products.
The building in the saving mode gets a special icon in the right panel, and a badge that describes the condition will be added below the power consumption stat.
The vanilla game doesn't let checking the total capacity and charge of the batteries in the network. SmartPower
adds extra information to the network status section that shows the total capacity/charge of the batteries, as well as the current in/out flow and the expected life/charge time.