top | item 24934722

Show HN: What would mechanical programming look like?

719 points| felipereigosa | 5 years ago |mockmechanics.com

149 comments

order
[+] felipereigosa|5 years ago|reply
Hey guys, I've been working on this Clojure project for a while now, honestly I'm not even entirely sure what it is, a game? a game engine? a 3d editor? a visual programming language? Anyway, it's a system to create mechanical contraptions and interact with them. I built a few test machines and you can see them in the first video I posted on my channel [1]. For instance you can create a fully functional piano in 5 minutes and play it, the keys move, it plays the sounds as you would expect. And this system turned out surprisingly powerful, to build these machines it often does not require any coding which was kind of surprising. I created this tetris game in half an hour [2]. It's not perfect but it is functional and again it required only a tiny snippet of code to coordinate the different submachines and even that might be unnecessary. The "programs" i.e. the machines created also interact in a way that you usually only see with command line programs. You can create a machine then someone else can use that machine as a part for a more powerful machine, for instance that lever that turns the tetris game on and off doesn't "come standard" with the system, I build it separately then imported it. Using the program is a lot like programming, thinking logically, coming up with solutions to problems, fixing bugs, but it's entirely visual so you can use your physical intuition to figure things out, maybe that's why it's possible to do things so fast. Anyway I was hoping some of you would give it a try and give me some feedback. I need people to see what they can build with it, I don't even know what's possible at this point. And if you want to give it a go and get stuck, feel free to contact me with any questions.

[1] MockMechanics Introduction Video - https://www.youtube.com/watch?v=HrwxbQj5mj0&t=193s

[2] Tetris Machine Video - https://www.youtube.com/watch?v=cSPm1xxQ-qY

[3] https://mockmechanics.com/

[+] JoshTriplett|5 years ago|reply
This looks amazing. Several times in the last couple of decades, as graphics and physics engines have evolved, I've built little prototypes whose main goal was "this should work using real physics and mechanics", and then built things like marble machines. Games like Crayon Physics always felt so limiting; they were only about things bouncing off each other. I'd like gears that turn and mesh, light that diffracts, motors that naturally work in reverse as generators, and the ability to build machines that use more than one of those effects without any special-casing.

I look forward to playing with this, and extending it!

[+] taneq|5 years ago|reply
I think what you're looking for is a "shed". It's a space in the real world where all the usual physics apply and you can make things using them. ;)

All jokes aside, this sandbox looks awesome and I want to play with it more. :)

[+] felipereigosa|5 years ago|reply
Thanks, once you are familiar with it you can start extending it right away, a couple of motherboards running custom short scripts could implement all those things you mentioned and then you could make that machine (for example the motor/generator) available for others to use on their own machines!
[+] mikevin|5 years ago|reply
>... honestly I'm not even entirely sure what it is, a game? a game engine? a 3d editor? a visual programming language? Anyway...

It's refreshing to see this kind of exploratory project. Every now and then, I need to be reminded there's room for play and exploring in life, not just productivity and producing. Thank you for reminding me!

[+] felipereigosa|5 years ago|reply
You're welcome :) I remember someone saying somewhere that most of the great computer programs probably haven't been written yet, if we remember that maybe we'll be the ones to write them!
[+] Animats|5 years ago|reply
That looks like Working Model, from Knowledge Revolution, from the early 1990s. That was a great little program for Macs that let you build 2D machines. It was too slow and the physics engine was primitive, but I used it to figure out how to do robotic legged running up hills.

The CEO went on to found Roblox, which is much more successful.

[+] doinathing|5 years ago|reply
This looks amazing! Please consider making your website more accessible... the menu cannot be focused with the tab key, the images in your gallery do not have alt attributes. Those are some low hanging fruit you can correct. The overall strategy of toggling the main content with CSS might need some aria announcing so folks at least know different stuff is on screen as you move from one thing to another.

Again, AMAZINGLY COOL project, not wanting to take anything away from that. Just want everybody to be able to learn about it, even if they are not mouse users, not sighted, etc.

[+] felipereigosa|5 years ago|reply
Not at all, this is exactly what I want, some good feedback, I hadn't even considered those things you mentioned, I'll look into it thanks!
[+] bigiain|5 years ago|reply
That's really cool feedback - and now I'm wondering if more projects shouldn't put their websites on GitHub (or similar) so people who want to contribute but who's skills are web/frontend focussed have an easy way to make updates and send pull requests?
[+] dkersten|5 years ago|reply
That's pretty cool! It seems like a weird mixture of physical contraptions (lego/meccano etc) or minecraft redstone circuits, and something you'd see in Media Molecules' Dreams (especially the graph-motion).

I just watched the Tetris video and it reminded me of this mechanical pong game: https://www.youtube.com/watch?v=iBoe3yM9IKs

What inspired you to create this?

[+] felipereigosa|5 years ago|reply
Thanks and that pong game is a great idea for my next machine, unless someone beats me to it! If I recall correctly the very first thought that led to this project was thinking about how to formalize mechanical devices, they have a language of sorts to describe chess games, same with choreographed dance I think. I was thinking how can I do that for machines without all the extra stuff like heat and friction, but I pivoted a lot since then and ended up with this.
[+] imtringued|5 years ago|reply
It looks more like a lean version of gary's mod. Although that game lets you build very complicated things a lot of people end up just playing premade games instead of building their own stuff, so there is still a lot of room for a more focused "maker" experience.
[+] amelius|5 years ago|reply
This reminds me of logic gates based on pulleys and weights:

https://www.youtube.com/watch?v=CNbScb8v-MI

(someone posted this here on HN a few weeks ago)

[+] felipereigosa|5 years ago|reply
It's interesting you'd mention that, because most of the program is "mechanical", you manipulate things in 3d, but for some things you have to go into a window and connect a few 2d nodes like the gates in motherboard mode. I was thinking maybe I should use 3d manipulation for everything, maybe the video you posted could serve as inspiration for 3d gates.
[+] IIAOPSW|5 years ago|reply
I don't say this very often, but I think you're sitting on the next minecraft. You've captured that brilliant, simple, elegant, open ended thing-beyond-words which can be instantly recognized but rarely built.

Whatever you do, please never ruin the simplicity. Every object's state is defined by a single number. The logic of numbers is connected like plumbing. Never change this recipe.

[+] felipereigosa|5 years ago|reply
Thank you so much! I won't, if anything sometimes I go too far trying to make things even simpler. For instance I use a track for both building wagon paths and as a motor, I thought maybe that's confusing but the track value wasn't being used for anything why add yet another part when it isn't necessary? In fact, there are things I know I can simplify. The button part for instance is completely unnecessary, I have built one that looks and works identically using a wagon on a short path and a few chips hidden in another layer. One of the things I may do is to make it a library part that can be imported instead.
[+] luminati|5 years ago|reply
This has to be one of the best show hns I have seen in quite a while. It looks amazing - congrats and thanks!
[+] felipereigosa|5 years ago|reply
Thank you so much! I've been working hard for quite a while on this, you don't know how much it means to me that people liked it.
[+] gitgud|5 years ago|reply
One of the best things I've seen in a long time on here. It reminds me of a few different games; "Little Big Planet", "The Incredible Machine" and of course "Factorio" but this synthesises the best part... Inventing machines!
[+] felipereigosa|5 years ago|reply
Thanks, one of the great things about creating a program where other people can create things is seeing them inventing things you wouldn't even think of, it's so open ended. Alan Turing and those other guys had no clue what we would do with his idea. I'm looking forward to see what people will make with this. (Not that I'm comparing myself to Alan Turing!)
[+] skellystudios|5 years ago|reply
Really cool project – but I found it took quite a bit of digging before I could work out just how cool it is.

Have you thought about making the gallery from videos or even gifs? The movement is sort of the best part, and a bunch of people (like me) might skip the long video on the homepage.

[+] felipereigosa|5 years ago|reply
Interesting, I think I'll do that, I even already have the gif for the tetris machine, but I ended up not using it.
[+] maddyboo|5 years ago|reply
This is one of the first things I’ve seen in a looong time that got me genuinely excited. I can see so many possibilities for the future. Kudos and great work, I think you have beginnings of something great on your hands.
[+] felipereigosa|5 years ago|reply
Thanks, we do :). From now on what the program can do depends on what people build, the library machines they create so that other people can use them as parts and so on.
[+] frompdx|5 years ago|reply
Awesome project. Can you share which libraries you are using with this project?
[+] felipereigosa|5 years ago|reply
org.clojure/clojure obviously, org.clojars.nakkaya/vecmath, org.clojars.nakkaya/jbullet, batik and lwjgl. All the other stuff, the opengl shapes and whatnot I wrote myself over the years, mostly to learn how to do it. In fact I probably can speed up this program a lot by not using my own code for those parts where libraries are available.
[+] whiskey14|5 years ago|reply
Dude this is great! I think this would be superb for teaching children physics, coding and design. Also, it could have minecraft type vibes of addictivity and fun
[+] felipereigosa|5 years ago|reply
Thank you. Yes one of the directions I want to take this is to create an avatar you can move around just like minecraft and then interact with your machines like I show in the first video. I always thought educational gamefication is something that could be done better. When I was a kid I knew every pokemon, their evolutions, their powers and I wasn't even trying, I just wanted to play pokered. If I create something that makes people, especially kids, care that much about programming... To storm that castle you have to build a catapult and to do that you have to understand these programming ideas...
[+] trungdq88|5 years ago|reply
Looks amazing! I can imagine this become a wonderful sandbox game!

I try to run the app on macOS but it crashes immediately. Do you know why? Log: https://pastebin.com/amQgGz43

[+] felipereigosa|5 years ago|reply
Thanks! I just looked up "sandbox game" on Wikipedia to refresh my memory and it gave me the idea of maybe adding challenges to make it one of those "solve this problem anyway you can" deals. Maybe a puzzle mode? I'll add it to my idea file.

Someone else mentioned that it crashes on mac but didn't provide the output yet so thanks for that. I don't have a mac but I'll have a look to see if I can fix it.

[+] felipereigosa|5 years ago|reply
Hey guys, I'm not sure if I should post this here or create a new post on the main page? I spent the morning implementing the music box that I talked about with @bigiain yesterday. I went even further and created a little submachine to load text file songs from the computer. I hope you like it. If you would like updates like this, follow me as MockMechanics on twitter and Instagram, and if you'd like to support my work I'm now on Patreon too.

Music player - https://youtu.be/Kz9GDBJuVwk