Electricity via Cables and Relays from Generator to Machine?

0 favourites
From the Asset Store
Forget about default textbox restrictions, you can create sprites atop of the textbox
  • Damn, your files are quite mindblowing how it all gets spread, it's flawless. Thank you so much R0j0. Only thing is, I'm not sure how to apply it exactly to having a generator that produces the power (I guess you did it with source Nodes) and machines that consume it, for this to work for me I can't be able to connect multiple generators to the same network, because then I can't track what generator is producing power for what machines and how much power they consume on a specific generator.

    I tried transforming the source nodes to act as a generator that can be turned on/off, but how can I pass around the the id of the power generator through the wires and nodes network?

    Because then at the last node of a network, which has a type that is a machine, I can find the source generator for the network by the generator id which was passed through the network to the last nodes which have the type of "machine". And then we save the machine_id and other value into the generator's container array and display to player which machines are connected to a generator and how much power they consume.

    Please tell me if I'm understanding something completely wrong...

    Could you maybe take a look at it in the file of yours i edited?

    easyupload.io/erascr

    p.s. thanks for making your plugins available publicly back in the day, used a few of them in c2 (:

  • I see you used the second example.

    To know what source the power is coming from you could add another parameter to the power function to be the generatorID.

    So when calling the power function from the source nodes it would be

    Power(node.uid, 0, node.generatorID)

    Or however you want to identify the generator.

    Then in the function you can set the Id of the nodes from param(2),

    And when you call the function again, also pass param(2).

    If that makes sense. You’d probably want to reset the id for all the nodes in the same place that powered is set to false.

    I’m alway from my pc till probably Monday, and I don’t really use c3, although looking at projects from my phone is cool.

    So in general you just need to know if something is connected to power and what that power source is? Does the number of linkages from the power source matter?

    You say each component uses power. Is it distributed evenly over everything that’s connected? Or does each component use the power it needs and pass the leftover power down the wire?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I was just having a little fun with the examples and I saw this number that got me curious as I thought it should be 6 instead of 8 or maybe I just understood wrong how it supposed to connect and the transmission of Power that it should come from each side.

    I will leave it here for you guys just in case its a bug and if it's not you can just ignore it and forgive me for the interruption )) knowing Rohjo I don't think it will be a bug as it always gives accurate examples and probably that's the way it should work.

    I used the Capx 3 >>>> "power_with_id_multi_source.capx"

  • Okay, following what you said the passing of gen_id and other data like if machine is on/off, how much power it consumes and updating that when we turn a machine on/off or changing it's power consumption value and sending that info back to generator now works. But, I feel this (what i was trying to do) is limiting the flexible system you made.

    "Or does each component use the power it needs and pass the leftover power down the wire?"

    Yes, each comp. uses the power it needs and passes left-over along the wire. What I've been trying to do would limit player experience and make electricity unintuitive.

    I guess what you're saying would make more sense and this might be a lot better;

    • A network can have many generators that can only be connected to batteries
    • A network can have many batteries that send out the power to components
    • Each component uses the power that IT NEEDS and passes left-over power back to be saved in batteries on network
    • If there isn't enough power being produced, all machines get turned off?

    *The sole purpose of nodes (relays) is just to extend the reach, I can't have kilometer long cables

    *Components have a manual switch that sets power_consumption to 0 (turns them off completely)

    *Same for Generators, have switch that sets power_production to 0 (turns them off completely)

    Would adapting something like this be possible in one of your systems or do you have any systems in mind that would be better or simpler?

    File with gen_id being passed around: https://easyupload.io/9m2os2

    A system with multiple batteries and generators example (basically what i'd need to accomplish):

  • tarek2

    Yeah, that looks like a bug.

    In Event 20 remove the action "node: set dist to dist+2", i forgot to remove that.

    dropbox.com/s/vto9mwobq9uoqsx/power_with_id_multi_source.capx

    HolidayExplanation

    The third example, with that bug fixed, works best for evenly spreading out the power.

    I modified the example to transfer where the power is coming from and tried showing power consumption:

    dropbox.com/s/562xjz7t3rmbrop/power_with_id_multi_source2.capx

    Passing the genId is kind of ambiguous. One will arbitrarily be the owner when there is a tie.

  • Thank you very much R0J0hound for actually adding that, really appreciate it. Read your file, but I'm not able to test it out right now and try to adapt it to my machine systems since my AC Unit died today... Quite ironic. Thank you again!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)