My name is Martin Magni. I make games. Right now I'm working on Flatom.

Reinventing the Wheel

April 14, 2014Tagged Flatom, Games

My Chipmunk Physics experiment has deviated so far from Flatom that it's probably a game of its own. In fact, I have already split the project into two code bases. Here's what the wheel I was going on about in the last post looks like in the new, yet to be named, code base:


Chipmunk enables the use of complex shapes and constraints, just like the PhysX engine we used in Blocksworld. E.g., the above wheel consists of a square base, a circular tire that can rotate freely, and a linear spring constraint that connects the tire to the base.

This wheel is like a 2D version of Blocksworld's wheel. However, unlike Blocksworld, this wheel doesn't require a symbolic scripting language. You simply connect it with wires, just like the electronic circuits in Flatom. Any interactive and functional object can be created by wiring bricks together. E.g., here's how you would build a controllable car:


The rear wheel is wired to two buttons. Pressing the right button will send a current to the wheel's right input jack, which turns the motor clockwise and drives the car forward. Similarly, the left button reverses.

In case the consequence of this idea is not immediately apparent I'll emphasize it here in bold. You can build entire games with this method, no scripting or programming is required.

I was immensely proud of having invented this build-and-wire concept, until I realized it's been done before, like all good ideas it seems. The PS3/Vita game Little Big Planet's create mode works the same way. (You might say I've reinvented the wheel both figuratively and literally!) Though that title, while extremely successful, hasn't been released on any other platforms, presumably because their publisher Sony wants exclusivity.

In any case, this experiment represents a significant pivot from Flatom. But as I have no deadlines, nor bosses that tell me what to do, I may as well explore this path as long as I deem it promising.

I appreciate any feedback

Chipmunk Physics

April 02, 2014Tagged Flatom, Games

Flatom forces users to reinvent the wheel. I mean that quite literally. If you want a wheel, you have to figure out a way to construct one from atoms. And it's not trivial either:


The wheel hub is a user controlled input atom. It powers a tire made of rocket atoms. The rockets all need to be aligned in a circular pattern in order to provide torque. Finally, the hub is held in place by multiple long springs connected to the car body. It is vital that these springs all connect to the central hub, not the tire, or else the wheel won't be able to rotate freely.

Why use atoms if they're complicated to build with? Because they're simple to simulate! A physics engine for atoms with uniform size and shape is relatively straightforward. Collision detection between circles reduces to a simple distance check and you can ignore rotation alltogether because a circle looks the same if you turn it:


This simplicity enabled me to write my own physics engine for Flatom. (I've previously attempted to write 2D physics for arbitrary convex shapes. When I finally gave up I had no working code but a huge respect for people who write physics engines.)

Are there any alternatives? Well, most physics games just use some existing physics engine, developed by someone else. E.g. Angry Birds used Box2D, free of charge. I decided to try out the Chipmunk engine to see how wheels could work:


Now these are a nice set of wheels! (At least if you ignore my placeholder graphics.) I was quickly able to set up constraints to replicate some of the feel of Hill Climb Racing, which is a good sign since that game is loads of fun! And these wheels would be super simple to use as a single integrated building block, including the hub, motor, and suspension system. While they're much more complicated to simulate, Chipmunk takes care of it for me.

Neither of these two ways of making wheels is necessarily better or worse than the other. The ability to construct a wheel out of atoms is elegant in one way and the ease of use of a ready-made wheel is elegant in another way. Exploring both options will help me choose.

Comment on this


March 16, 2014Tagged Martin, Flatom, Games, Photos

Lately I've come down with a severe case of self-doubt. I have begun to question everything about the game I'm making, even why I'm making it.

It started when I was trying to come up with more puzzle challenges for Flatom. They all felt contrived, certainly not fun. While I'm having fun thinking up atomic contraptions, perhaps that's because it's my atom simulator. Real user might just find the whole experience frustrating.

Now I find myself lost in endless thought experiments, trying to recapture that elusive "fun." As a result I haven't made much progress and the prospect of ever completing the project is starting to feel remote. Perhaps I was overly optimistic to think I could make this entire game, from scratch, by myself.

I try to clear my mind by taking long walks through the forest:


All that snow has melted away and been replaced by beautiful spring weather:


Discuss this


March 11, 2014Tagged Flatom, Games

In which directions does gravity pull? That's a question I've revisited a couple of times already.

I started with having everything fall down. Downward gravity is simple and intuitive. It's so simple as to be unworthy of mention, except that it causes two problems. First, what prevents all atoms from just free falling down, and second, what happens with atoms that fall off the edge of the (finite) world?

The major alternative is to have gravity towards the world's center. This solves both problems. Atoms fall away from the world's edges and stop falling when they collide with each other to form a small planetoid at the world's center. Here's a tiny planetoid with a light house:


Another advantage of centered gravity would be the ability to drive vehicles around the miniature planets. If the camera follows a vehicle's position and rotation it would feel like you're traversing an infinite surface. When I tested this, however, I discovered you also feel acutely nauseous as the spinning can cause motion sickness. But if you don't rotate the camera then things are often upside down and, unintuitively, fall upwards.

It seems both downward and central gravity have pros and cons. I was stuck with this realization for a while. Then it hit me that I might be able to introduce a Super Mario Galaxy-inspired gravity towards the closest surface. I could precompute a gravity field grid where each cell's gravity is determined by the closest surface atom:


The left half of the image shows downward gravity while the right half has gravity towards a planetoid's center. And the effect is an automatic consequence of the way the surface atoms are arranged in a line or in a ball. Thus the gravity field could combine the best of both approaches, even in the same world!

Planetoids may be used in the story and game mechanic too. Perhaps the purpose of the game is to evacuate all characters before an impending asteroid impact smashes the planet to pieces? Here's a tiny character ready to blast off the surface of the planet in a rocket:


A level would be complete when the characters reach space, at which point the view would zoom out to reveal a universe filled with planets. That would be a nice way of tying the main menu level selector into the story as well:


Comment on this

First Look at Flatom

March 02, 2014Tagged Flatom, Games

Here's a first look at some in-game video footage of Flatom!

Talk to me

Atom Shader

February 20, 2014Tagged Flatom, Games

When two atoms are right next to each other you can't see whether they are connected by a spring or not. In thinking about this problem I looked at real chemical models for inspiration. Here's a typical 3D model of a water molecule next to my 2D representation:


The straight edge between the circles indicate their connectedness without having to clutter the visuals with criss-crossing spring lines everywhere.

As you can see I'm going for a flat monochrome shading, which I hope will give the game a modern clean and minimalistic look. To test this out I reconstructed the machine sketches in-game:

flatom-0013.png flatom-0014.png flatom-0015.png flatom-0016.png flatom-0017.png flatom-0018.png

None of these machines actually work yet. My next task will be to implement the atomic circuit idea and build working nano machines!

I appreciate any feedback

Molecular Circuits

February 13, 2014Tagged Flatom, Games

A big unknown in the last post's sketches was how to control the vehicles. It occurred to me that spring bonds could also works as "electrical" wires between atoms. For example, a touch sensor atom could activate a connected rocket engine atom. In this sketch the regular springs are grey and the wires are red:


The beauty of this solution to the control problem is that it stays squarely within the same atoms+springs model that would be used to construct the vehicles themselves. It's also WYSIWYG in the sense that you see the entire object and all its "scripting" at a glance.

This contrasts with the control scripts in Blocksworld, which use ordered rows of 2D icons that are entirely separate from the 3D building blocks. In addition, I can only show you half of this Blocksworld rocket ship's controls because only the selected block's scripts are visible:


The Flatom rocket ship sketch illustrates a direct coupling from sensor atoms (L and R button) to action atoms (the rocket engines). A third type of logic gate atoms could be introduced in-between sensors and actions to construct more complex functionality.

Here's a flasher circuit that could be used to drive a blinking light. Feeding the buffer's inverted signal back into itself with a delay will toggle the signal on and off with a period that equals the delay:


Here's a flip flop circuit I found on Google. It's bistable and will work as a memory of which of the L and R button you pushed last:


Of course, this will need some kind of spreading activation to be implemented on top of the physics simulation. But, seeing as these circuits feature NOR gates, such an addition should result in Turing completeness :)

Tell me what you think

Home Office

February 09, 2014Tagged Photos, Martin

This is where all the Flatom development happens.


To the right you can glimpse my small kitchen.


Behind me is a couch and a bed. That's pretty much it!

Get in touch with me

Molecular Machines

February 06, 2014Tagged Flatom, Games

I've done a lot of sketching on what you could build using a 2D atom simulation!

Some of my inspiration comes from The Planiverse. The book describes a physically plausible 2D universe, the creatures that inhabit it, and the machines and vehicles they build. The protagonist meets an inventor who's trying to build a wheeled vehicle, but there's no practical way of attaching a 2D wheel to the vehicle's chassis while still allowing it to rotate freely.

I think I can get around that difficulty by extending my particle simulation with simple spring forces. You can view these springs as atomic bonds that keep an atom in place relative to its bonded neighbours. By ignoring springs during collision detection you could fix a wheel's center to the chassis while still allowing the atoms that make up the tire to rotate freely:


It should be a simple matter to give some atoms negative weight so you can build balloons:


This rocket ship uses the light gray atoms as rocket engines, though I don't yet know how that would work:


The spring bonds have a fixed length. If that length could somehow be varied dynamically then you could conceivably build walking creatures! I'm on a horse:


I don't see why you couldn't even make tracked vehicles. This excavator would move about on its track and control the scoop by varying spring lengths:


Finally, here's a mockup of a touchscreen user interface being used to build a windmill:


I appreciate any feedback

Introducing Project Flatom

January 30, 2014Tagged Flatom, Games

After working two years non-stop on Blocksworld I decided it was time to invent something new! But what?

More than 100 games are added to the App Store each day! For a game developer that's both humbling and terrifying. Mostly terrifying. Making yet another game seems like a recipe for failure.

Yet, that's what I'm going to do. At least I've had more success with games than with other ventures. And I hope (or rationalize?) that there's still room for more creative-building-type games.

Most games I play myself are on my iPad. The touchscreen still feels almost magical. However 3D games, like Blocksworld, will always suffer from a disconnect between the 2D touchscreen and the 3D world. In essence you're pointing at objects in a 3D space behind a glass window through which you cannot reach.

This disconnect creates all sorts of interface problems. Actions that would be trivially easy if you held the objects in your hand become frustrating exercises in indirect manipulation. I observed this myself when looking at novice players trying to place and rotate Blocksworld blocks.

So I'm thinking my next game will be 2D. (Also, the math is easier :). I made a small Javascript experiment with the simplest possible 2D physics, a particle system with equal sized spherical particles. It runs just fine in mobile Safari on the iPad:


For ease of reference I'll call the experiment Flatom, a contraction of flat atom. Could something simple like this be a basis for a game? I'm betting it can. Now I'll stop writing and start brainstorm game ideas!

Give me feedback


 Next >>