Over the last few weeks I have built up the gameplay systems for tools and fasteners in Wrench. I talked briefly about what my plans were for the fasteners in my last post, but now that the systems are finished I can show it off in detail. This video is an overview of how both the ratchet and the fasteners function in Wrench:
I designed a 1/2 drive ratchet that borrows the chunky silhouette common on ratchets from the 1930s and 1940s but with a modern machined look. This image is an in game capture dropped onto a background in photoshop.
From a gameplay perspective, a ratchet is a great starting point for developing other tools. With only a few changes, the ratchet code can be re-purposed into a combination wrench, a torque wrench, or an impact gun. Some of the interesting gameplay features in the ratchet:
- The ratchet reads the socket size from the fastener and automatically spawns the correct socket- No hunting for sockets.
- Dynamically adjustable ratchet stiffness that ties into the torque calculated at the fastener. Using some basic assumptions about how strong the player combined with the length of the tool I can approximate how much torque the player can overcome. The player won’t be able to use a 5″ 1/4 ratchet to install a crank bolt (they can try, it just won’t go well). Stiffness only increases on the forward stroke, this makes the ratchet mechanics feel free/unloaded while the forward stroke feels like you are doing some work.
- Fully simulated 60 tooth ratchet mechanism with sound + haptic feedback as you pass each tooth. Backlash between teeth is simulated, on a reverse stroke backlash is generated until you hit the next tooth. When the direction changes back to forward, that backlash total has to be used up before the tool will apply any rotation to the fastener.
- The ratchet attaches to fasteners with my EventUseItem input (a button press). Holding that button triggers a different event which I am using to swap from tighten to loosen. The LED on the ratchet indicates the ratchet direction.
In my last post I spoke about the art for fasteners. To recap, I build them with correct dimensions, including thread pitch. Since I have that data for every fastener I use it to accurately simulate fastener functionality. In my final implementation, fasteners are simulated in 5 phases. I will be using joint analysis software to generate accurate curves for ever fastener:
- 1- Attachment.
When a fastener is first placed into a joint it reads a variable called Rundown from the install location. This number represents the distance the fastener can move inward before the head begins to seat on the part. Reading this from each joint allows the same nut or bolt to be used in different joint configurations. This phase represents the first 10 degrees of rotation. During the attachment phase I allow the player to remove the fastener from the joint. The joint sends the fastener a variable “IsTorqueCritical”. Torque critical fasteners will need to be installed with a correct torque or bolt stretch amount. Non critical fasteners just need to be made tight.
- 2- Rundown.
During this phase the fastener can no longer be removed. In the rundown phase the fastener isn’t generating any torque or bolt stretch. This phase represents tightening the fastener until it becomes finger tight.
- 3 – Seating.
This phase is a short period where the head of the fastener and the part are being forced into alignment. The fastener begins to generate torque but there is no appreciable fastener stretch or clamping force.
- 4 – Stretch.
During the stretch phase the fastener is fully engaged with the part and it begins to generate a stretch value. Torque increases linearly through this phase. Fastener stretch is simply (DegreesRotation/360)*ThreadPitch.
- 5- Yield.
The fastener is stretched to the point of plastic deformation. This is what happens when a fastener is over torqued. Torque and clamping force drop off until the bolt fails. I haven’t fully settled on what I want failure to look like. Mostly likely the fastener will be considered junk and the player will need to get/purchase a new one. I will not require players to attempt to extract a broken bolt since I don’t think there is an entertaining way to make that happen. In some applications over torquing could be used to damage the part being clamped- If you use a 1/2″ impact to install head bolts on an aluminum head, you are going to have a bad day.