Turrets: Logic, Rail Rotator & Memory

    Joined
    Jul 22, 2016
    Messages
    76
    Reaction score
    17
    I have underlined below what I think is the core of my problem.

    I am trying to set up a ship with four turrets each on a rail rotator that allows you to use 5 inner ship remotes to send one of five commands "Even", "Starboard", "Dorsal", "Port", "Ventral". This would allow you to somewhat increase your firepower towards a given direction, obviously this is more an RP ability than actually useful, but still would be cool to implement. Images of what I am attempting below:
    Bow
    starmade-screenshot-0104.png
    Dorsal rotation starmade-screenshot-0105.png
    45 Degree Rotation starmade-screenshot-0106.png Port rotation starmade-screenshot-0107.png
    Code:
    From the bow.
    Even:
      T           T
         O------O
         |      |
         O------O
      T           T
    
    Starboard:
                T
       TO------O
         |      |
       TO------O
                T
    
    Dorsal:
         T     T
         O------O
         |      |
        TO------OT
    
    Port:
         T
         O------OT
         |      |
         O------OT
         T
    
    Ventral:
       TO------OT
         |      |
         O------O
         T     T
    However, I am running into problems with getting the rotator logic working. The conceptual issue I am having is that unlike with standard rails everything is relative. I can't (so far as I know) have logic set the rotation to "45 degrees clockwise from arbitrary orientation" rather it is always "45 degrees clockwise from current orientation". This creates three problems.
    1. I need to have the ship turrets rotation on being loaded be the same as the rotation I have setup the logic to assume they are.
    2. I need memory set up to remember what the current rotation is so that the logic can translate the player inputing "Rotate to Port" to "Rotate 45 degrees" or "Rotate 90 degrees" or "Do not rotate" depending on the prior turret position.
    3. I need to figure out the logic to not accept rotation commands until all turrets are finished rotating.
    The first problem I figure I'll solve via trial and error when I've finished setting up the logic to work otherwise.
    The second problem I feel like I've more or less gotten a handle on despite making my brain hurt a bit
    The third problem is super easy to solve with standard rails and entity location, but I'm much less certain with rail rotators. Is this something where I need to set up a button next to the rail rotator and it will have to count the 45 degree rotations and send a signal to an AND block (1) when the correct numer of rotations have been completed? Then the inner ship remotes would each go to AND blocks (2-5) that require both their respective inner ship remotes and that original AND block (1) in order tell the turrets to rotate?
     
    Last edited:
    Joined
    Jul 6, 2013
    Messages
    451
    Reaction score
    108
    • Purchased!
    • Community Content - Bronze 2
    • Legacy Citizen 5
    I'm not completely sure but if you have the entire turret system just docked to single rotor rail that would make the logic very complicated.

    If might be possible to simplify the logic if the 4 turrets are on the same mounting frame and that frame is running around on a small track internally rather than a single rotator.

    Where o is a rotator and - or | is a rail.
    0--0
    | |
    o--o

    Moving the frame around on this rail would get you 4 of your 5 turret setups. And you can use the rails that activate actuators to link into your logic to indicate where the frame is.

    If the corners are logically setup to rotate the frame depending on which side the frame is coming from then that logic should be separate from the reset of your logic system. Then its should be possible to reverse the travel of the frame anytime rather than locking out the controls until a movement is completed.

    To get the last "even" position you would need to rotate all 4 turrets on the frame by 45 degrees. Then reverse them back when going to a different position. This will give you an "even" position switch that would work at any rotation the frame is at. Since this control would be separate from rotating the frame and would be an on or off it shouldn't conflict with the rotating frame logic.

    Another idea is instead of direction buttons which will complicate the logic use a left or right button which will simplify the logic a lot better and attach an indicator (light/display unit) on the frame that rotates around whatever ship camera your using thus showing you the direction the turrets are optimised without you having to look outside of your ship. Unfortunately this will require precise positioning. The rail track the frame runs on would have to be small. You can use the display swap logic to show a different display unit when in the "even" position.

    Hope this gives you ideas.
     
    Joined
    Jul 22, 2016
    Messages
    76
    Reaction score
    17
    I'm having a bit of trouble following the change to the rails that you're suggesting.

    Here GIFs of the interior and exterior while rotating at the moment:
    starmade-gif-0011.gif starmade-gif-0010.gif
    Screen shot of the interior:
    starmade-screenshot-0109.png
    Are you suggesting changing it to be attached to rails setup like these below?:
    starmade-screenshot-0110.png
    Or would all four turrets be on the same rail system located at the center of the ship rather than right under the turret?
     
    Joined
    Jul 6, 2013
    Messages
    451
    Reaction score
    108
    • Purchased!
    • Community Content - Bronze 2
    • Legacy Citizen 5
    Here is a working example attached.

    The ship core has a display showing if the turrets are extended or rotated and in which direction if not extended.
    I have placeholders where the turrets should be I just put a stick up showing the direction the turret would be rather than docking actual turrets to the turret docks.
    Innership controls are Left, Right and Extend. Extend when off will retract the turrets to the directional setting.
    The main ship has a reversed camera so you can look back at the turret mounts while using the inner ship remotes but you will have to zoom out a little

    Also the logic should be pretty fool proof with the exception of actual button spamming. Extending and rotating logic is separate so they can be activated at the same though the end position of the extended turrets is the same regardless of actual frame rotation.

    Hope this helps.
     

    Attachments

    Joined
    Jul 22, 2016
    Messages
    76
    Reaction score
    17
    Oh I see what you meant. Very cool and definitely helps, thank you(y). I'm going to keep working at the more complicated logic approach since it'll look less funky than parts of the ship flying around. But again thank you, I'm very happy to have a solution that will work when/if I can't wrap my head around the fancier way. Also the indicator is a fantastic idea that I'm definitely going to end up using regardless.
     
    Joined
    Jul 22, 2016
    Messages
    76
    Reaction score
    17
    Mork2, so I didn't end up using your system, but figuring out how your logic worked got me out the mental rut I've been stuck in and I've finished this for one turret. Getting it set up on the other three so that they are in sync will just be a matter of rebuilding the logic 3 more times, but I'm going to wait to do that grunt work until I've started working in the innards of the ship and I know where I want the logic to be.

    Basically, problem #3 was super easy to fix when I realized/remembered that rotator blocks output a signal on completing their full rotation whether it is 45 or 90 degrees so each rotator block just needs a button unlocking to an rs-nor latch (which locks from the button that sends the final rotation command) going into a shared AND block which unlocks the rotation commands when all four entities have finished rotating.

    Now, I just need to remember how it works when I come back to finish the ship.

    I've attached current blueprint of the ship if you're curious what ended up working (no promises that the logic isn't more convoluted than necessary.)
     

    Attachments