Hello,
I am trying to do a factory sim game like Satisfactory. My problem is I dont know how to make the power network, I tried to make a scene with a couple a variable in it but I dont think it is the way to do it. I just looking how I can make a Power Network and distribute power to my building. Any help will be appreciate!
Those games generally use a simulation grid.
The simplest way to get that working, assuming you want Factorio style “power distribution is within range,” is to make an actor that’s a “power node,” which has a sensor sphere of some radius, and any other “power node” overlapping that sphere, counts as “connected.”
Your power sources will then run a simple graph traversal along all the “connected” nodes, to figure out the spanning tree of all connected power nodes.
A power consumer will then have its own overlapping sphere, and draw power from whatever node/network overlaps it.
In Satisfactory, however, they make it simpler, because the connectivity is explicit. The “power nodes” are connected only if there’s an explicit wire between them. Each “power node” has a “connector” (the input on the buildings, and the top of the power poles) that can take some limited number of wires, and the power network is explicitly the connectivity of the power wires between nodes.
If you haven’t read up on “spanning trees” and “breadth first graph traversal,” I recommend picking up a good book on the subject. Knuth’s classic data structure books are always a good starting point.