Rail Door Keypad Lock Logic (Provided)

    Edymnion

    Carebear Extraordinaire!
    Joined
    Mar 18, 2015
    Messages
    2,709
    Reaction score
    1,512
    • Purchased!
    • Thinking Positive Gold
    • Legacy Citizen 5
    I'm building the new spawn station for our server, and the admin requested that I ensure that new players have to read the rules before they can enter the universe. So, I came up with a rail based door that requires the player to punch in a correct sequence on a keypad to open it, and put the combination in the rules list.

    Thought I'd share that logic with everyone. This setup is designed to work for a three button keypad, where the combination is 2-1-3.
    Door Lock Logic.jpg

    Now I didn't put in a whole lot of error checking, so this could technically be brute forced if you were fast enough, but for the purposes of being an effective combination lock, it works quite nicely.

    Quick rundown on what it's doing.

    First digit verification, you hit the 2 button and it goes to a flipflop that stores the "correct button pressed" state. Off to the side are 5 daisy chained delay blocks, with the last feeding back into the flipflop. This gives the player 2.5 seconds to correctly input the next digit before the delays reset it.

    Second digit verification, assuming the flip flop from the first digit is active, link that flip flop into an AND along with the second correct digit. Repeat the delay blocks on this second stage state save so that it will also reset.

    Third digit verifiction, same as second stage, AND the correct digit with the previous level's saved state, and feed it into a third saved state. At this point the user has correctly entered the code, feed the output of the third flipflop into your rail door activation toggle logic. For my door based on it's size, I put 20 delays on this stage to give the door enough time to open and for the user to walk through it before it closes again.

    And thats it. The lock resets if the player doesn't enter the correct digit every 2.5 seconds and they have to start over. It is easily expandable to being as many digits in length as you want, you simply have to add another flipflop to save the state.

    You now have a locked door that cannot be opened by anyone, even a faction member, that doesn't know the passcode. Great for spawn stations, but also great for private storage areas on faction bases, or for putting additional protection on large faction ships that you don't want a faction member running off with when you aren't looking.
     
    Last edited:
    • Like
    Reactions: iceman6491
    Joined
    Aug 8, 2013
    Messages
    403
    Reaction score
    45
    • Legacy Citizen
    • Purchased!
    • Legacy Citizen 2
    I say have at least 5-6 buttons for one of these, otherwise people will just guess their way in.

    Otherwise, it's pretty cool!
     

    NeonSturm

    StormMaker
    Joined
    Dec 31, 2013
    Messages
    5,110
    Reaction score
    617
    • Wired for Logic
    • Thinking Positive
    • Legacy Citizen 5
    What happens if you just press every button within 1 second?
    Door opens! :p:D
    Either all buttons within 1/2 second, or going through the row 3x within 5 seconds.​

    Better do this:
    Button 1,2,3 --> OR 1,2,3 <--> Activation Block 1,2,3
    you can only enable activation block, not disable it via simple button pushes.​

    For combo "2-1-3" do something like:
    If 1 is active without 2, reset the Activation blocks to off.
    If 3 is active without 2+1, reset the Activation blocks to off.​

    Easier to understand, more reliable and perhaps less logic blocks.
     
    Joined
    Jun 27, 2013
    Messages
    252
    Reaction score
    67
    • Purchased!
    • Community Content - Bronze 1
    • Legacy Citizen 2
    What happens if you just press every button within 1 second?
    Door opens! :p:D
    Either all buttons within 1/2 second, or going through the row 3x within 5 seconds.​

    Better do this:
    Button 1,2,3 --> OR 1,2,3 <--> Activation Block 1,2,3
    you can only enable activation block, not disable it via simple button pushes.​
    For combo "2-1-3" do something like:
    If 1 is active without 2, reset the Activation blocks to off.
    If 3 is active without 2+1, reset the Activation blocks to off.​

    Easier to understand, more reliable and perhaps less logic blocks.
    But using this and trial and error you could guess the code surely? Or are the activation blocks you talk of hidden from the players view?
     

    Edymnion

    Carebear Extraordinaire!
    Joined
    Mar 18, 2015
    Messages
    2,709
    Reaction score
    1,512
    • Purchased!
    • Thinking Positive Gold
    • Legacy Citizen 5
    Well like I said, if someone really wants to brute force it they can. Ends up being a lot more logic to try and have it reset with a wrong button press, but you could simply enhance it to a full 10 digit pad and use only a single delay for a half second window.

    This was built for a spawn station door lock, wasn't exactly meant to be utterly pick proof. You can easily expand it to more digits and/or cut down the grace period to make it harder to brute force without really adding much in the way of logic complexity.
    But using this and trial and error you could guess the code surely? Or are the activation blocks you talk of hidden from the players view?
    Only thing visible to the player are the buttons. You get no feedback at all as to if you pressed the right button or not until you've input the entire string.

    You could just sit there and mash all the buttons over and over again to basically smash the lock with this setup if you really wanted to.

    My goal was something easy to implement that got the job done.
     
    Last edited:
    Joined
    Aug 8, 2013
    Messages
    403
    Reaction score
    45
    • Legacy Citizen
    • Purchased!
    • Legacy Citizen 2
    but having it be able to be bruteforced completely defeat the purpose of having a locked spawn? Ragnarok uses an external button on their spawn station which gets the job done nicely.
     

    Edymnion

    Carebear Extraordinaire!
    Joined
    Mar 18, 2015
    Messages
    2,709
    Reaction score
    1,512
    • Purchased!
    • Thinking Positive Gold
    • Legacy Citizen 5
    but having it be able to be bruteforced completely defeat the purpose of having a locked spawn? Ragnarok uses an external button on their spawn station which gets the job done nicely.
    Well an external button means somebody has to stop what they're doing and go let people out, and thats just a pain in the ass to everybody else thats on.

    For a spawn lock, it's only real purpose is to get people to go read the rules. A display next to the keypad even points them back to the rules as being the place to find the key. This iteration of the lock is mainly there to make them stop for a minute, and be something that they can't just randomly plink at buttons to get to open. Sure, if you know it can be brute forced you can get out of it, but someone that just walks up and tries pressing all the buttons a time or two and doesn't get any response is less likely to suddenly decide that jamming all of the buttons over and over and over again until it breaks is going to be easier than just turning around and reading the stuff on the wall behind him.

    Again, if you want actual security, you can always just expand the number of buttons and drastically cut down the entry time to the point that its very, very unlikely anyone would be able to press all of the buttons before the reset occurred.
    [DOUBLEPOST=1432229279,1432228680][/DOUBLEPOST]If you really wanted to add more logic to get a complete reset whenever someone hit a wrong button, I'd recommend:

    Starting on the second digit, OR together all of the wrong digits. Take the output of the OR and AND it together with the previous flip-flop, then pipe the output back into the previous flip-flop to switch it back to the off position. Then you'll have to stop the reset pulse from flipping the flip-flop back, so pipe the flipflop and the last DELAY into an AND block, then the AND block back into the flipflop so that the reset pulse can only reach the flipflop if its currently in the On status.

    So you'll need more blocks, more space to lay it out, and a more confusing linking, but you'd get a lock that can't be brute forced open.
    [DOUBLEPOST=1432232726][/DOUBLEPOST]Okay, I believe this is the logic that would reset the lock after an incorrect entry, as you can see its quite a bit more complicated.

    Door code here was changed to 1-2-3 just to make it easier to draw out.
    Unpickable Lock.jpg

    First digit is same as above, don't bother start checking logics until they actually hit the right first digit.

    Second digit is as above, but if they press a 2 OR 3, AND the first digit was valid, then reset the state on the first digit save to Incorrect/Off, which will also block the reset pulse from reaching the flipflop.

    Third digit is basically the same, if the third digit is correct, unlock the door. If it is incorrect, reset the second save state.

    Technically I could make this even more complicated by having the second and third digit incorrect entry check the status of the previous digit states and then turn them back off for a full hard reset instead of waiting on the timer resets, but its already getting complicated enough to trace through as is.
     
    Joined
    Aug 14, 2013
    Messages
    2,811
    Reaction score
    960
    • Councillor 3 Gold
    • Wired for Logic
    • Top Forum Contributor
    I really need to do the tutorial for the expandable keypad I built, you can add as many digits as you want and as many inputs.
     
    • Like
    Reactions: PizzaPress

    Edymnion

    Carebear Extraordinaire!
    Joined
    Mar 18, 2015
    Messages
    2,709
    Reaction score
    1,512
    • Purchased!
    • Thinking Positive Gold
    • Legacy Citizen 5
    Wait, I think I got part of the reset logic wrong in that last picture...

    Its not really important logically, just I think I connected the wrong buttons into the digit resets, and I don't wan to redo the entire picture from scratch just to fix it.

    But basic idea is correct.
     

    NeonSturm

    StormMaker
    Joined
    Dec 31, 2013
    Messages
    5,110
    Reaction score
    617
    • Wired for Logic
    • Thinking Positive
    • Legacy Citizen 5
    Thought I'd share that logic with everyone. This setup is designed to work for a three button keypad, where the combination is 2-1-3.
    ...Door code here was changed to 1-2-3 just to make it easier to draw out.
    ...
    OMG
    Good, that you changed it to 1-2-3 (you can switch it easily by linking buttons placed in another order).

    But you still use 3 sub-circuits with delay blocks.
    Sub-circuits which
    • don't interact with the whole except through a Raising-Edge Flip-Flop.

    • are meant to remember whether a button was pressed in the last N seconds.
      • but forget to remember when a button was pressed twice.
    • -luckily for you- now have an AND to prevent the delay to reset the Flipper to a permanent-ON-state
      • please update the OP!
    but which also
    • can switch a button offline whole N/2-seconds after you pressed the button,
      • and where N= memory time AND wait time until you can try again.


    If you press a button 3x, it breaks the system (ONLY for the Opening-Posts picture in my first quote):
    Legend:
    F : Frames (each a 1/2 second)
    Button : smashed at T=1, T=2, T=3 (1 seconds between button smashes)
    Delay : 5x (for 2.5 seconds)
    Remaining : (# steps remaining till an On-state completes the loop → Flip-Flop states change when remaining=0)
    Time-Table:
    F : On/Off → Remaining F++ (by on, then switch 1→0 or 0→0)
    _____
    0 : 0
    1 : 1 → 5
    2 : 0 → 4
    3 : 1 → 3, 5
    4 : 1 → 2, 4
    5 : 1 → 1, 3
    6 : 0 → 2
    7 : 0 → 1
    8 : 1
    9 : 1
    _____
    0=initial, 9=afterwards​

    ––––––––––––––––––––––––––––––––––––––-

    Just do
    Button (any order) → Forward (in sorted interface) → AND → OR ←2way→ Activation Module

    Reset Button (anywhere) → Reset (in sorted interface) → All Activation Modules above

    AND (from above) has a second input : Requirements
    1. previous Activation Module
      1. Thus you can't activate the Activation Module if the previous isn't jet ON.
    2. next Activation Module → NOT (jet)
      1. Thus you can't activate the Activation Module if the next one in order is already ON.

    AND_2 is a sibling of AND and triggers RESET through the sorted interface if
    • Button is used
    • Requirements are NOT met.
    ______
    NOTE : About activation modules and signal processing in SM

    ( Activation Modules remember the very last input
    , accept only 1 change per signal source
    , which are : delay|trigger|user
    , but not : and|or (as they don't create a new instance of signal)
    )
     
    Last edited:

    Edymnion

    Carebear Extraordinaire!
    Joined
    Mar 18, 2015
    Messages
    2,709
    Reaction score
    1,512
    • Purchased!
    • Thinking Positive Gold
    • Legacy Citizen 5
    Methinks someone doesn't understand the concept of "Good enough".

    There is a a difference between flawless execution, and being good enough to work in most cases. The original post was good enough to function as intended most of the time, with the onus being on the player that broke it. The idea was never to create the most foolproof system ever created, it was to build something that was easy to set up and effective.

    If you don't like the free logic, then either don't use it or come up with a better one and post it up yourself.