HolidayExplanation's Recent Forum Activity

    • Try changing the option Fullscreen quality, Downscaling quality in project settings, also try putting framerate mode to unlimited.
    • There is also performance tips, try checking if you're doing something performance intensive: https://www.construct.net/en/construct-2/manuals/construct-2/overview/performance-tips
    • It might be a bad loop you have, try running the project with debug layout instead of the normal way and every time, before you run it, disable some code or remove some sprites to see how much they affect your performance (comparing cpu usage) and you'll pin point the problems out soon enough.

    You can go through that, but it's a bit hard finding your issue without seeing your project file, so if you could upload it here it would help to find the problem

  • You do not have permission to view this post

  • 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):

  • A cosmonaut character that I'm soon about to implement into my C3 project.

  • 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 (:

  • What you are describing sounds swell, but trying to implement it gives other problems that I cannot find a way to solve;

    • Removing a cable works
    • Connecting the objects numerically initially works

    If two cables are disconnected from the line and you connect one back or turn on the generator -> it will set active all that have a bigger ID than the one reconnected, even though there's one cable missing in the line. If e.g. cable of ID 2, 5, 9, 11 are disconnected and I connect 9 back, I can't just give power to all cables with ID > 9 and frankly I haven't found a way around it, am probably too stupid.

    If one relay has 2 cables each going in a different direction, they both have the id of let's say 4 (because they are being created from relay number 3), if I disconnect the cable line left, the cable line on the right will also get disconnected even though it's on a different line and no cables are missing.

    As said, your system may work, I don't know if it does, I tried my best implementing what you said, but without any success, because while doing so a lot of other issues turn up that I can't manage to solve. Thanks for your time.

  • Sorry, this should work, you can do the same kind of logic for going up/down

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To avoid this I recommend you set up a Github for storing multiple versions and in Construct settings an automatic Google Drive backup every couple minutes, so that if it does happen you can revert to an older file easily and then just add back the code from the new versions. Also if you are using Google Drive to save your file online, right clicking it you have a "Manage Versions" option, there you can download an earlier version of your project that still works...

  • Actually, after trying to implement the second part (removing cables) this morning, it just can't work. If your global loop of setting all cables hasPower=true when connected to running Generator, then setting hasPower=false to all cables after it to hasPower=false too, does nothing as you can expect (it can work with 1 cable being disconnected, but with 2 it doesn't work, and when reconnecting when more than 2 have been disconnected causes trouble and even when turning on machines since it would give power again to all cables).

    I again had to try and do it with functions but it's just way too complicated, at least for me, if you know how to actually make a system that works, then id appreciate you doing it in a file, otherwise I'll be giving up on this since I can't take spending an hour again and have already spent too much time trying to make something work that I know I can't, it seems impossible to do...

  • Again you use the data that you made yourself, you have a route of numbered nodes. If you disconnect a cable then you set to inactive all cables that are in the same route (same gen ID) and have a higher number in the path.

    That's so simple that it's ingenious. I finally got it all working with your method.. Can't thank you @lions_ and @Radiowaves enough for all your elaborate contributions =] When I release my game on Steam I'll find a way to send you guys a key, the least I could do. This "electricity question with cables" gets posted quite a lot on the net without any apply-able answers, will finish my file, clean it up and upload it in my post as a solution for others to use. Thanks again (:

  • I would set variable/boolean "hasPower" for each Cable, Relay and Generator.

    Generator would have power set 1 by default.

    If Cable overlaps Generator & Generator hasPower==1, set Cable hasPower 1.

    If Cable overlaps Relay & Cable hasPower==1 & Relay hasPower==0, set Relay hasPower 1.

    If Cable overlaps Relay & Cable hasPower==0 & Relay hasPower==1, set Cable hasPower 1.

    Things get problematic when you want to add shorts:

    If Cable overlaps Relay & Cable hasPower==1 & Relay hasPower==1, run function "ElectricShort".

    This would be set immeadetly when unpowered Cable is overlapping with powered Relay. To tackle this, power cable could be split in two + & - side and check for those instead.

    If you do not want to run this all the time, put it into function and set it for each Cable.

    But in this case the function has to run from cable starting from generator first!

    Haven't tested it, but this is how I would start making it.

    Yeah, that's pretty much the problem, if I knew how to make a cable have +/- I would've had it working with my system 2 months ago, how I have it each cable has 2 relays and each relay has 2 cables, i tried tackling the +/- with cable_num being incremented like you can see in the diagram, each in the line has a greater cable_num by one... But it doesn't work, couldn't find a different way for detecting that yet

HolidayExplanation's avatar

HolidayExplanation

Member since 27 Sep, 2015

Twitter
HolidayExplanation has 1 followers

Connect with HolidayExplanation

Blogs