• Register
Post news Report RSS Devblog: Programming Robots

A quick overview of programming in Main Assembly, our crafting game due out Q4 2019.

Posted by on

Hi folks, [BYG]Watts here. This is my first devblog and we're going to talk about something near and dear to my heart: programming!

Happy drone, programmer drone!


In Main Assembly, we want to allow players to control elaborate contraptions and make cunning devices, but in an approachable and enjoyable fashion. Not everyone enjoys writing code, after all!

The brain of any bot is either a Docking Station where your little drone avatar can directly interface with the robot, or a Processor which is designed to operate without direct control. While your drone is docked, your controller inputs (mouse and keyboard or gamepad) are available for you to use in programming. Both Docking Stations and Processors can also use inputs from sensor parts, such as proximity and orientation sensors, get feedback from powered parts, and generate their own signals such as waves and noise.

Advanced docking station


As an important aside, Docking Stations are available in two flavours. The Simple Docking Station has reduced capabilities but can automatically program itself to control robots that look a bit like a conventional car. The Advanced Docking Station is, well, much more advanced!

When you have a docking station or processor on a robot, you can use a shortcut to enter Programming Mode at any time during crafting.

The programming itself uses a node- or graph-based representation. Signals carrying fractional values (normally between -1.0 and +1.0) enter the Docking Station or Processor, from inputs or sensors, and can then be combined with simple math operations (addition, multiplication etc.), tested against each other (minimum, maximum, equality etc.), used with very simple memory systems (take the mean value, delay the input for some time, etc.), and finally sent to powered parts!

One of the simplest such parts is a Motor. If the programming sends a value of 1.0 to a motor, it spins at its maximum speed. If it instead receives 0.25, it will spin at quarter speed. And if it is sent -0.5, it will spin backwards at half speed. Most parts accept this kind of continuous input and respond accordingly.

Programming a drive motor


Slightly more complex is the Drive Motor. This combines a simple motor with a mechanism for turning the wheel, a brake and a suspension assembly. Turning and braking are controlled through independent outputs. As the name hopefully suggests, this part is designed to get robots up and driving around with minimum fuss.

Successfully programmed!


Parts such as Servos and Pistons treat the values they receive as a target position, based on their limited range of motion. For example, if a servo can turn from -90° to +90°, a value of 0.5 corresponds to +45°. It will then turn until its actuator is aligned with this target angle, assuming it is not blocked.

Combining all these features allows for a remarkable level of control! Chaining servos, pistons, hinges and motors permits many degrees of freedom, and the programming lets you adjust these parts with as few or many inputs as you need.

Advanced programming


You can even make a crab bot with just a handful of servos!

Crab!


Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Related Games
Main Assembly
Main Assembly Adventure
Related Engines
Unreal Engine 4
Unreal Engine 4 Commercial
Related Groups
Bad Yolk Games
Bad Yolk Games Developer