Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

My issue is that I\'ve been trying to implement a power/electrical system for a

ID: 659121 • Letter: M

Question

My issue is that I've been trying to implement a power/electrical system for a while now. I'm using Unreal Engine 4 with C++ but that's not really relevant.

I'm trying to implement some sort of system of generators, power storage, and power draining objects that all interact through one another through a system of wires or cables, similar to any of the many minecraft mods which add machines.

My thoughts were moving towards using a node system, where nodes looking for power can trace through the system and find a generator or storage cell. I couldn't find a single tutorial or example anywhere online. Anyone have any input?

Thanks!

Explanation / Answer

After experimenting for a while I have a solution. I've split the network of machines into many EnergyNet objects, which represents something like a cluster of wires. Each EnergyNet represents a system of energy suppliers, consumers, and storagers, which are a combination of both.

Every update tick, the energy net measures the amount of energy produces and distributes it to the consumers. Any remaining energy is then stored in the storagers or disposed.

By using multiple EnergyNets, I can create many complex systems with far distanced between them. If two EnergyNets were to intersect, I could easily merge their components the for a single EnergyNet!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote