In these 2 hours i have lost all my sanity
But finally the factorio like supply/demand electricity mesh finally works 
First i thought of using recursion to spread the electricity through every single tower
But then i ran into a problem where towers interconnected so to fix that i passed a self parameter that didnt seem to help.
Then i decided to make towers only connect once (which was a disaster and brought its own set of bugs) and that to tremendously failed 
So finally i decided upon a global mesh chain architecture where all the nodes in a chain have similar looking list, and whenever an appliance is connected to it the chain just iterates through its connected devices, This in turn brings the time complexity down to O(n)
and makes everything a whole lot more efficient.
Finally this is done
Currently only the tesla charger works with this new logic, later i will add other electric appliances to this mesh network aswell and give them watt draw
Few things to keep in mind, Currently 1 generator makes 50kW and one vehicle charger consumes 40W, If the demand isnt satisfied every node in mesh rejects the connection until the demand IS satisfied
I know this might feel stupid for some people but this is only done as a feature so you dont overload the electronics in space 
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.