Building a Game for Mechanical Simulation with Articulated Physics
Kuba Seidl joined DeepMotion’s 2018 closed alpha, hoping to achieve interesting new mechanical simulation results using our Unity physics SDK. Excited by his creative
![Building a Game for Mechanical Simulation with Articulated Physics](https://storage.googleapis.com/www.deepmotion.com/assets/6455380df2986348b83d59ff/8bd5a9db3002d37c2fc31e7e00807715.png)
Kuba Seidl joined DeepMotion’s 2018 closed alpha, hoping to achieve interesting new mechanical simulation results using our Unity physics SDK. Excited by his creative
Kuba Seidl joined DeepMotion’s 2018 closed alpha, hoping to achieve interesting new mechanical simulation results using our Unity physics SDK. Excited by his creative use of our engine, we asked him to share more about his work with our team.
Kuba only learned Unity in 2017 after some introductory experience with programming in Python and Lua. After spending a summer learning C# and Unity on his own, he began his first real project, a circuit simulator in Unity. “The initial idea was to help my schoolmates understand current and voltage better, and in an interactive way,” says Kuba. “I used the analogy between electricity and water to show current (water flow) and voltage (pressure translated to heights of water columns), all in a procedurally generated 3D model of a user-built circuit.” The project was successful enough to serve as the basis for his semester physics project, resulting in an intricate step-by-step simulation of circuits, currents, and voltage, abstracted in a water flow visualization.
“Besides that, I have no other background with simulations, perhaps only that I enjoy sandbox physics-based games,” says Kuba, who has been working on a more intricate project—a mechanical simulation game with in-game C# scripting.
The initial idea for the game can be traced back to his days using Lego Mindstorms 2.0 and EV3, where he quickly reached the limitations of what could be built with existing motors, bricks, and sensors in the games. Minecraft Redstone offered more complexity, particularly once he found a mod called OpenComputers, which enabled Kuba to build computers, tablets, and drones that were programmable in Lua. “I fell in love with it” says Kuba, “but there were still obstacles and limitations: it had a very basic script editor, and everything was still static and bound to a blocky grid”. The idea for his game was born out of his desire for a more robust and flexible way to build digital machines.
“I wanted to make a game where the player would be able to build anything they want out of static or moving parts, and write their own behavior in C# to control the various parts,” says Kuba. Emboldened to give players more control to create dynamic machines and vehicles, he quickly ran up against a limitation more fundamental to game development—stable physics. By the second iteration of his game, Kuba realized that he wouldn’t be able to achieve the stability he needed using PhysX. “Its joints weren’t stable enough, especially with large mass differences,” says Kuba. “It was impossible to make machines with moving parts when the joints were always wobbly and unstable. I even tried making my own fake physics joints, but those didn’t go anywhere.”
DeepMotion physics is built for simulating complex dynamic systems naturally (in particular, characters). Bipedal characters—which need to be able to maintain balance despite a high center of mass and limited contact with the ground—require hundreds of simulated muscles and joint parameters to work together to maintain balance, to walk, and to learn more advanced motions. The result is an engine that can produce reliable and intricate biomechanical or robotic simulations. Kuba found an old hexapod demo on the Unity subreddit, which he found to be “suspiciously stable”, and decided to apply to test our early software package.
“Simply put, DeepMotion provided physics as they were meant to be for the game,” says Kuba. “PhysX is great and fast for simulating individual objects, and games like RPGs, shooters, strategy games or platformers don’t need much else. DeepMotion’s articulated physics however provided me with stable joints, which allow the player to build machines such as the crane in my demo.” Building upon an engine designed for complex character physics, Kuba has been able to prototype his game with far more success. His demo is designed to show the entire workflow and how the individual systems work together to produce a stable mechanical simulation with bespoke behaviors. “The crane demo showcases how custom behavior can be programmed into a terminal block, how the script interacts with linked world objects (e.g. terminal screen, hinges, pistons), and how the crane is stable, precise, and does not wobble while moving,” says Kuba.
With the proper fundamentals in place, Kuba can focus on developing other core features of his game, like a script editor—something he needs in order to create a flexible and robust physics-based sandbox game that even coding novices can play. “I believe my game would provide a fun 3D environment where even beginners could write a couple of lines and produce a simple behavior that was immediately observable. And for those who already know C# well, the game would make it possible to develop advanced programs for fully autonomous behavior.”