Space Engineers

Space Engineers

Not enough ratings
DragonsKin's Mech Leg Driver
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
6.587 KB
6 Dec, 2017 @ 8:17pm
1 Change Note ( view )

Subscribe to download
DragonsKin's Mech Leg Driver

Description
Though this script still works, I recommend moving to version 2 (Mech Driver MkII - Dragon Tech Industries)
Found here: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1307589642

I want to see your Mechs!

============================
Definition
============================

This script is what I hope will be the starting point for your creations. No Mech is a good one if it cannot walk! Therefore I have devised a system that is not only intuitive, but dynamic enough to allow you to be creative. I want to see what crazy creations people can come up with if they are not stuck battling the intricacies of making an effective walking Mecha. The walking behavior is meant to simulate that of a human. The idea behind that is the implicit understanding and simplicity in design.

============================
Highlights
============================

1. One script does it all. Through simple Run.Arguments it will manage walking, stopping/standing, and self-repeating (thats right folks, no timers needed!).

2. Script can be customized without having to write/change any code! All parameters are read from your programmable block's CustomData fields (the script will default them for you and you can do as you wish from there!). Any changes can be made on-the-go and the script will respond!

3. Adaptive parameters include (but are not limited to): The frequency that the script will run (seconds and/or milliseconds!), Rotor/Piston bounds and velocities, and more.
- Why not change some of them on the blocks themselves you ask?
Because that is TEDIOUS and presents an opportunity for inconsistencies. Let the script do the boring stuff, you've got a Mech to build and stomp around!

4. Remember that one script does all bit? This is true for a Mech with any number of legs! Bi-pedal, Quad-pedal, Octo-pedal? You decide!

5. Setup is fast and intuitive, so lets get to it!

============================
Setup
============================

1. Build your Mech. I recommend from the top-down. Keep in mind rotor/piston weight limits (unless you've got the mods on of course!). More legs = more weight capacity!
Be sure to leave room for a programmable block (and to add this script to it).

2. The most important part: The walking MECHAnism.

Each leg is made of up 4 core components: 2 Rotors, at least one Piston, and at least one Landing Gear.
- One Rotor serves as a "Hip" and the other as the "Ankle".
- The Piston extension serves for pivoting on a leg.
- The Landing Gear lock the pivoting leg to the ground to allow forward motion (and utilize locking mechanism to prevent block damage with the ground!).

3. Building a Leg:
- Start with a Hip Rotor (0 degree should be upward facing).
- Build the Piston(s) with the piston head facing downward (180 degree of Hip Rotor).
- Next build the Ankle Rotor (0 degree should be upward facing).
- This rotor head should face the opposite direction of the Hip Rotor.
- Finally build the Landing Gear(s). These should be downward facing.
- These are the only requirements, you may greeble away as long as these specs are met (these blocks do not have to be connected directly).
- DO NOT WORRY about any of the parameters of these components (the script will do it remember?) :-).

4. Naming:
Each component should follow the naming convention here (so that the script can differentiate between these and other components of your awesome Mech!):
- "Hip Rotor", "Leg Piston", "Ankle Rotor", "Foot Gear".

All components on a leg share a common purpose. For the script to unify their functions you must designate the components of a leg by adding a Leg Tag to the end of their names. For example one leg could contain the following components:
- "Hip Rotor [Left]", "Leg Piston [Left]", "Ankle Rotor [Left]", "Foot Gear [Left] 1", "Foot Gear [Left] 2", "Foot Gear [Left] 3".

- If your build features multiple Pistons or Gear per leg the name can be appended with a unique identifier (Ex. "Foot Gear [Left] 1" or "Foot Gear [Left] Front").

5. Finalize:
- Once legs have been designated with Tags, you are ready to start walking. First set the default argument (in the Programmable block) to be a comma seperated list of all of your Leg Tags (Ex. "[Left], [Right]").

- You will want to name your programmable block as: "Leg Driver". This allows the script to know which block is running it and utilize it's Custom Data appropriately.

- When the script is run it determines which legs to walk based on the arguments provided. This means you can walk all legs in-sync or individually.
(Ex. In a hotbar option you could pass only "[Left]" as the argument and only the [Left] leg would walk.)

- WAIT! Before you start walking around you will likely want the option to stop right? To stop simply run the script with the "Stand" argument.

6. What are you waiting for!? Get out there!

============================
Optional Components
============================

You may experience a "backwards-tilt" depending on your build (mostly bi-pedals).
- By adding a forward-facing gyroscope and naming it "Balance Gyroscope", you can take advantage of letting the script offset this tilt while walking. The offset is also customizable through a parameter in CustomData!

Outputs for script behavior is also available! By default the script will output to it's console (In the Programmable Block), but you can also provide panels for the output. Name a panel to "Panel [AllLegs]" (thats ALLLEGS but w/o all caps) and you can see output from all legs. For leg specific output you can name a panel to "Panel [Left]" for example and see status output for the [Left] leg!

============================
Extras
============================

Though this mech uses a deprecated (old) version of this script, you can get the idea of how it works here!
My Vanilla Mecha GRIM: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1127842916

If you make a build utilizing this script, please leave a comment referencing it. I want to see them all!

You may desire your mech to have a distinct walking pattern
(ie. "All Front then All Back", or "All Left then All Right", etc). Any walking pattern can be achieved by running the script on each leg independently until the mech is in the desired pattern, then run the script with all Leg Tags and it will walk the legs following the provided pattern.
- After initial setup the mech will continue with that pattern until manually changed again (or recompiled). This includes after utilizing the "Stand" feature :-).

I hope you enjoy this as much as I have!
Thank you
Popular Discussions View All (1)
11
4 Jan, 2018 @ 7:53pm
Code Error: System.NullReferenceException
Enderspoons
4 Comments
drag0nsKin  [author] 19 Feb, 2018 @ 3:02pm 
Ah, I like it! I haven't done any Mods yet, but that might be a good place to start!

I am releasing a new version of this today that would make your idea a lot more practical!

Thanks for the input :steamhappy:!
CTH2004 17 Feb, 2018 @ 8:47am 
Would be cool if it could know what direction you're going in, and auto-walk that way!

Just press w, and go foward, a to turn... You get the gist!
drag0nsKin  [author] 11 Jan, 2018 @ 12:02am 
You could use this script with a different setup from what I laid out here, just use the "run_when_incomplete" option in the config . Also I am working on a new script that will more compatible with other walking types (like the ones shown in BlackArmors new tutorial).


Valve Logo
NTSFMagellan 9 Jan, 2018 @ 10:09am 
Perfect. Now we just Need to be able to build legs without pistons as well as ones that Adapt to terrain.