Read by Council Change logic of... logic

    Joined
    Jan 24, 2016
    Messages
    49
    Reaction score
    20
    While I was working on this atrocity

    I noticed a huge problem with logic: it lacks sequentivity (I am not sure what word should be used here). The problem is that it's impossible to reliably predict how a circuit will work during lag spikes.

    You see, sometimes logic gates send signal even if last signal wasn't sent. It's kinda hard to explain so let me show you instead.

    Here I simulate lag-free environment:

    I manually press a button to make fourth digit 3 and it works perfectly.

    It will never break even if you try hard enough. Why it works perfectly? Because manual input makes that system not time-critical.

    Now I try to activate that clock. It basically means a button will be pressed each second.
    Now it produces nonsense:


    Why does it happen? Because first part of the clock is pretty complex and big and despite it being not time-critical it makes the whole clock time-critical due to lack of sequencing. It never waits for signal to be proccessed, it just sends new signal. While it's fine for lag-free situations, it makes a complete mess when it's lagging and in extreme cases even DELAYing might fail.



    That basically makes complex logic circuits extremely unreliable and there is no way to counteract that.

    What I suggest is making sequentional logic by default. What does it mean?
    1. A queue of receivers forms when gate's state changes. The queue will consist of receivers in order as they were connected. So if button 1 was connected to flip-flop and button 2, the queue will be "flip-flop, button 2"
    2. Each signal will be sent to a receiver as stated in the queue. The receiver must send a virtual signal of receiving the signal to the sender.
    3. The gate will not continue if it didn't get the signal from receiver. Of course if the receiver does not exist anymore, it's ignored. Also it will be ignored if the link was broken while the sender waited for the answer.
    4. It will go on to the next gate when the queue is empty.

    By doing that, most of logic systems will be impervious to lagging.
     
    • Like
    Reactions: Lecic and jgames666

    jayman38

    Precentor-Primus, pro-tempore
    Joined
    Jul 13, 2014
    Messages
    2,518
    Reaction score
    787
    • Purchased!
    • Thinking Positive
    • Legacy Citizen 4
    Logic blocks are so neat, so it pains me to write this, but I think logic blocks should be replaced completely by lua-based programming in-game.

    Logic blocks can stay in-game for the masochistic among us, but for reliability, I think we need more of a ComputerCraft approach.
     
    Joined
    Jan 24, 2016
    Messages
    49
    Reaction score
    20
    They say they already planned LUA.
    Advanced LUA scripting is 100% planned, and the basic form of LUA is currently used for the NPC dialog system,but Advanced one will not come in the near future (unless the cat surprises us once again) and players will be able to create custom missions for other NPC-s and players to take part in.
    But until that moment I suggest this idea.
     
    Joined
    Feb 22, 2015
    Messages
    869
    Reaction score
    179
    • Purchased!
    • Legacy Citizen
    Iirc, the planned LUA system is for meta game/server side work. Proceduraly generate factions and missions. It will probably be accessed via external text editors, not in-game ship/station builders.
     

    NeonSturm

    StormMaker
    Joined
    Dec 31, 2013
    Messages
    5,110
    Reaction score
    617
    • Wired for Logic
    • Thinking Positive
    • Legacy Citizen 5
    Logic is pure inefficient compared to real life circuits.

    It's like going back to the 60ties and before.

    It is a neat concept, especially for debugging as everything is visual, but the sheer amount of blocks and needed changes just to display internals even when not being watched is bad.

    Get a pocket-dimension for logic with inputs/outputs connected to real blocks and it's fine.


    BTW: you could channel a clock through a and gate and activation block or bunch of flip-flops to get a not time critical clock in some cases.
     

    ToasterBorst

    Formerly known as Weishaupt
    Joined
    Sep 12, 2013
    Messages
    164
    Reaction score
    172
    • Legacy Citizen 2
    • Wired for Logic
    Would love to see this discussion explored further. Have always bit my lip and hoped any issues I experience with logic will be solved as development and optimizations continue.
     
    Joined
    Jul 24, 2013
    Messages
    1,326
    Reaction score
    2,096
    • Master Builder Gold
    • Councillor 2 Gold
    • Video Genius
    Logic blocks are so neat, so it pains me to write this, but I think logic blocks should be replaced completely by lua-based programming in-game.

    Logic blocks can stay in-game for the masochistic among us, but for reliability, I think we need more of a ComputerCraft approach.
    why jumping to removing logic?
    its perfect for rail systems. Not everyone will know ,or care to learn LUA.
    why not have both
     

    jayman38

    Precentor-Primus, pro-tempore
    Joined
    Jul 13, 2014
    Messages
    2,518
    Reaction score
    787
    • Purchased!
    • Thinking Positive
    • Legacy Citizen 4
    why jumping to removing logic?
    its perfect for rail systems. Not everyone will know ,or care to learn LUA.
    why not have both
    It's OK to have both. Especially for simple rails. As I said....

    ...Logic blocks can stay in-game...
    However, for some of the bigger, more logic-driven devices being made, such as 7-element digit displays and data storage, logic blocks are simply not the best. Neon said it better than I:

    Logic is pure inefficient compared to real life circuits.

    It's like going back to the 60ties and before.....
    And since the dev team has already expressed interest in using LUA in a more expanded way in StarMade, I just suggest expanding it a little bit more.
     
    Joined
    Feb 4, 2016
    Messages
    2
    Reaction score
    6
    Logic is pure inefficient compared to real life circuits.

    Get a pocket-dimension for logic with inputs/outputs connected to real blocks and it's fine.
    Exactly what came to my mind, a "logic box" block you can open like a factory or storage, and "inside" you can use the same logic blocks as "outside", so the whole implementation could stay as it is.

    Only problem I see is how to distinguish multiple Inputs/Outputs with the current "C"/"V" - user interface.
     
    Joined
    Jan 24, 2016
    Messages
    49
    Reaction score
    20
    BTW: you could channel a clock through a and gate and activation block or bunch of flip-flops to get a not time critical clock in some cases.
    Well, after solving a bunch of logic equaltions (God, I hate it so much) and building everything from scratch, I've managed to make a little neat circuit which works perfect.
     
    Joined
    Dec 14, 2014
    Messages
    745
    Reaction score
    158
    • Community Content - Bronze 1
    • Purchased!
    • Legacy Citizen 2
    While I was working on this atrocity

    I noticed a huge problem with logic: it lacks sequentivity (I am not sure what word should be used here). The problem is that it's impossible to reliably predict how a circuit will work during lag spikes.

    You see, sometimes logic gates send signal even if last signal wasn't sent. It's kinda hard to explain so let me show you instead.

    Here I simulate lag-free environment:

    I manually press a button to make fourth digit 3 and it works perfectly.

    It will never break even if you try hard enough. Why it works perfectly? Because manual input makes that system not time-critical.

    Now I try to activate that clock. It basically means a button will be pressed each second.
    Now it produces nonsense:


    Why does it happen? Because first part of the clock is pretty complex and big and despite it being not time-critical it makes the whole clock time-critical due to lack of sequencing. It never waits for signal to be proccessed, it just sends new signal. While it's fine for lag-free situations, it makes a complete mess when it's lagging and in extreme cases even DELAYing might fail.



    That basically makes complex logic circuits extremely unreliable and there is no way to counteract that.

    What I suggest is making sequentional logic by default. What does it mean?
    1. A queue of receivers forms when gate's state changes. The queue will consist of receivers in order as they were connected. So if button 1 was connected to flip-flop and button 2, the queue will be "flip-flop, button 2"
    2. Each signal will be sent to a receiver as stated in the queue. The receiver must send a virtual signal of receiving the signal to the sender.
    3. The gate will not continue if it didn't get the signal from receiver. Of course if the receiver does not exist anymore, it's ignored. Also it will be ignored if the link was broken while the sender waited for the answer.
    4. It will go on to the next gate when the queue is empty.

    By doing that, most of logic systems will be impervious to lagging.
    The easiest solution to fix this is the one I put up a good while ago and that is PLCs (Programable logic controllers). They are programmed using the same logic we currently are doing in blocks except they would be contained in a single block that is basically a computer with connections.

    That way no one needs to learn anything new because they already create logic circuits and it solves all the issues like this and many others.
     

    AtraUnam

    Maiden of crashes
    Joined
    Oct 15, 2013
    Messages
    1,121
    Reaction score
    869
    • Railman Gold
    • Competition Winner - Small Fleets
    • Wired for Logic Gold
    The easiest solution to fix this is the one I put up a good while ago and that is PLCs (Programable logic controllers). They are programmed using the same logic we currently are doing in blocks except they would be contained in a single block that is basically a computer with connections.

    That way no one needs to learn anything new because they already create logic circuits and it solves all the issues like this and many others.
    Apart from the fact that you can't distinguish between multiple outputs in such a system without resorting to using multiple of these blocks upon which they become suceptible to the exact same issues as current logic.
     

    lupoCani

    First Citizen
    Joined
    Jun 23, 2013
    Messages
    504
    Reaction score
    127
    • Purchased!
    • Legacy Citizen 10
    A minor point- The Lua home page specifically asks people not to spell it LUA, but Lua. It's a name, not an acronym.

    I agree it should be implemented in-game, though. If anything, because it would solve such a ridiculous amount of problems by allowing players to implement features themselves. Fleet controls, offline base guarding, infrastructure, even a Grand Exchange market, are all just automation waiting to happen. Allow players to do it themselves, and they will.
     
    Last edited:

    Blaza612

    The Dog of Dissapointment
    Joined
    Nov 16, 2013
    Messages
    787
    Reaction score
    209
    • Legacy Citizen 4
    I posted the idea of making logic blocks sequential, except nobody read it. Hopefully this thread will actually get the damn things put in. :p
     
    Joined
    Dec 14, 2014
    Messages
    745
    Reaction score
    158
    • Community Content - Bronze 1
    • Purchased!
    • Legacy Citizen 2
    Apart from the fact that you can't distinguish between multiple outputs in such a system without resorting to using multiple of these blocks upon which they become suceptible to the exact same issues as current logic.
    Wrong. It would be easy to do by assigning a meta data tag to each item then you just reference the meta data tag in the PLC.
    In short you give a lightswithch a tag name such as [lswitch 1] or you give an output to the lights as [lout] or whatever tag you want.
    Then your rung in ladder logic may look something like
    [ ] = normally open [/ ] =normally closed contact
    |------[lswitch 1]--------------------------------------------------------------------------------(lout)------------|
    If the switch is open the light is off if it the switch is closed the light is on.

    Maybe you want two switches controlling the light
    Parallel = either switch turns the light on.
    |-----[lswitch 1]--|-----------------------------------------------------------------------------(lout)--------------|
    |-----[lswitch 2]--|

    or maybe you want both to switch to be on for the output to be on
    |-----[lswitch 1]----[lswitch 2]---------------------------------------------------------------(lout)------------|
    You can even have switches that if one turns it on the other switches it off and vise versa.
    |-----[lswitch 1]----[/lswitch 2]---|-----------------------------------------------------------(lout)---------------|
    |-----[/lswitch 1]----[lswitch 2]---|
    Because you can put the entire logic system in it.
    I worked with this stuff 20+ years.

    But hey that is just the way I would do it. Its their game.