Author Topic: Minecraft's IC2-like Energy Net help.  (Read 2346 times)

Alright, I need some sort of electricity for my upcomming project. I looked in the fillcan and logic bricks to see how the bricks know when they're adjasent. I focused on the logic bricks because they're exactly what I need. Except I ran into a problem I can't seem to workaround. Energy flows and gets cut when the wires are destroyed. Ok, that should happen. Except that I can't find a single way of knowing how much power is being sent over the wire nor which is the powering brick. In logic bricks, there's no need to know which is the powering brick. All that's important is input/output. How could I find a way to know which is the powering brick on the wire connection?

You could add a new variable to the power bricks that state that they are in fact supplying power, as well as how much power. Then loop through your connected bricks to find all of the power bricks. You can also add a variable to the wires for the amount of power being pumped through, then update the wires depending on how much power the power bricks are supplying to the line.

How would the script know whether the powerblock belongs to the same circuit or not?  I'm guessing pumping down the power brick(')s(') object ID as well as the amount of energy units but I'm not sure if this is very efficient.

one of these mods is likely open-source, you could try and see how they do it there to get the idea of what the basic principle behind the system would be

ofc the technical execution will be p different.

As mentioned before, I looked in Melting Plastic's Brick_Logic. It's exactly what I need but with those little details I'm trying to work around.

Pick a brick in the circuit, loop through your circuit bricks that are connected to it, and find the brick that has the variable isPowerSource or w/e you make it.

Pick a brick in the circuit, loop through your circuit bricks that are connected to it, and find the brick that has the variable isPowerSource or w/e you make it.
this would use a potentially long and unnecessary loop where one isn't necessary, and it would also fail to account for systems in which there are multiple power sources

this would use a potentially long and unnecessary loop where one isn't necessary, and it would also fail to account for systems in which there are multiple power sources

The multiple power bricks it can account for, but it is a long unnecessary loop, however I don't have a better idea of how to do this.

You could create a Network script object, and keep track of the total power on there, then when a brick is added, if its a power brick just add to the total power, and when a brick is deleted, if its a power brick, subtract from the total power. When two networks collide, merge them. The hardest part is getting networks to split up, you'll have to loop through everything each time a brick is removed.

i'm confused, are you trying to create electrical circuits? why not view everything as a node-based graph (ignoring wires, except possibly as 'resistors' with a small resistance) and then loop through it and perform calculations like normal circuit simulators do? you know, with kirchoff's laws as matrices and such

i'm confused, are you trying to create electrical circuits? why not view everything as a node-based graph (ignoring wires, except possibly as 'resistors' with a small resistance) and then loop through it and perform calculations like normal circuit simulators do? you know, with kirchoff's laws as matrices and such
I'm pretty sure this would be the most efficient way to do it.