Suggestion: Packetless Wiring

  • Here is the idea I had for a while. Different wiring model. Main advantage of this is that it uses by far less CPU time, virtually zero. Also, it is somewhat more realistic and easy to understand.


    All wires, connected to each other, form a single "circuit". Circuit works as a single entity, no calculations per wire is needed until some wire is added or removed to circuit.
    Circuit has following two parameters: resistance and capacity. Resistance is a sum of resistances of all wires in it. It is a number of EU that is consumed per cycle by circuit itself. Capacity is a minimum capacity of all wires in circuit. When more than this value of energy flow passes through, then weakest wire in it (one at random) burns out.


    All machines that generate or consume energy have at most one In and at most one Out. They have "Normal" and "Maximum" values of power that they can provide or consume. I'll call them NormGen and MaxGen for generators of power and NormLoad and MaxLoad for consumers of power.
    "Normal" is a "best scenario" power, between Norm and Max is OK, below Norm is undesired, more than Max is impossible.
    Most machines have equal Max and Norm. Power storages have NormGen and NormLoad at zero. Machines that are not working at the moment have everything at zero, naturally.
    Real energy provided and consumed is calculated this way.


    0. If SumMaxGen < Resistance then circuit just does not work. Same when there is noconsumers or no generators. Otherwise resistance is subtracted from power: SumMaxGen -= Resistance; SumNormGen -= Resistance
    Then one of four scenarios works:
    1. If SumMaxGen < SumNormLoad, then Flow = SumMaxGen. Each generator works at their maximum, while each consumer receives energy proportionally to their NormLoad
    2. Else if SumNormGen <= SumNormLoad <= SumMaxGen, then Flow = SumNormLoad. Each consumer works at normal power, and each generator provides their NormGen, and remaining power is taken proportionally to difference between MaxGen and NormGen
    3. Else if SumNormLoad < SumNormGen <= SumMaxLoad, then Flow = SumNormGen. Each generator works at normal, while consumers take their Normoad and the rest proportionallly to difference between MaxLoad and NormLoad
    4. Otherwise (that is, if SumMaxLoad < SumNormGen) each consumer works at max, while each generator provides energy proportionally to their NormGen, if they can, or their NormGen if they can't give less then NormGen. Flow is calculated accordingly.


    These calculations are made only when circuit or some machine connected to it changes it's parameters, like generator running out of fuel or processor running out of raw materials. If machines are designed so they don't switch on and off too often, then calculation could be done only each 5 seconds or so at most.


    Another side effect of this model is that machines work at more stable environment, so we can do less calculations for machines, using extrapolations. For example, if macerator have enough power and coal to work for 1 minute, then we can just forget about it for one minute, or until power flow changes, and then just convert coal to dust in bulk.


    That's it. I don't have to carry it in my head any more, so I can put other things in it :)

    • Official Post

    Here is the idea I had for a while. Different (?) wiring model. Main advantage of this is that it uses by far less CPU time, virtually zero. Also, it is somewhat more realistic and easy to understand.


    All wires, connected to each other, form a single "circuit". Circuit works as a single entity, no calculations per wire is needed until some wire is added or removed to circuit.

    That awkward moment, when this Circuitbased model is already mostly implemented like that.


    The Lag of these cables comes from the Graphicscard, not from the CPU, i found that out after playing around with Solarpanels (On top of the World), which were massively Lagging even if they werent connected to anything, that can accept Power.


    The only real change, you suggest, is that its no longer Packetbased.

  • Is there any comprehensive read about how wiring is done now? I was thinking it is still more or less same as in IC, with loss per distance.

    I apologize for not searching out my reference, but if I recall correctly, another large difference was that of "need". In IC, the EUs would be sent along any cable connected to an out. At one now-embarrassing time, I had a loop of cable around a room (some of which were luminators). Even before I closed the loop back to the MFE, there was current in that cable. Under IC2, if there is no need for the EUs somewhere, then no EUs flow.


    I believe it is analogous to Buildcraft vs Redpower. In BC, the items go and may fall out if the machine on the other end cannot hold them. Under Redpower, those items either will never enter the pipe or will flow back.


    What I can remember is that this may have been in some description from Al regarding the differences between the time IC was cancelled and IC2 came out, or the early days of IC2.

  • Nicely formatted and good grammar. That means a ton on the internet. Also, you clearly thought about this for a while, and I applaud you for that, too. However, I don't think this would help lag too much, and might be unnecessary. However, please keep making good suggestions and don't let this discourage you.

    Haikus are poems

    They don't always make sense

    Potato

  • In my opinion you make a good attempt, but...
    Current EU model is not ideal. You make suggestion worse, not better.
    For example if I want to transmit a lot of EU through some cable, I can attach some cables to this network somewhere aside to increase "capacity".


    Greg, I think solar lag was not graphical. Lag was caused by much quantity of EU packets, trying to find exit from EU network labyrinth even if there was no valid. I think it was large one layer tin net.

  • In my opinion you make a good attempt, but...
    Current EU model is not ideal. You make suggestion worse, not better.
    For example if I want to transmit a lot of EU through some cable, I can attach some cables to this network somewhere aside to increase "capacity".


    Capacity is not a sum, or maximum, it is a minimum one of all wires in circuit. So, use cases are more or less like in old model (or in real life) - high voltage, heavy duty wires for long distance, low voltage and "normal" wires for local circuits.


    I didn't really expect this model to be adopted by IC2, to be honest. Too much things to change and stuff. But this thing was stuck in my headspace for a long time, and there were no other way to get rid of it, but to write it down.