This action requires saving a cookie to remember the page's state. You can read more about that on the cookies page.

 

Cubetrix

Released on: 2024-08-30

NOTE: The Cubetrix game is not affiliated with the CubeTrix youtube channel or the CUBETRIX 3D printer. Read more.

TL;DR

I’ve created an Android game called Cubetrix. Here’s an ultra quick demo (~1 minute):

The goal is to get your highest value block as high as possible. At the time of this writing, I’ve got it to 2048, but I haven’t managed to get it to 4096, yet.

I’d love to see your screenshots of how far you get on social media with the hashtag #cubetrix .

If you have tricks that help you get further, I’d love to see those as well. I’ll post a few of my own soon.

Table of contents

Backstory

Over the last 2-3 months, it would be fair to say that I’ve been into the game, 2048:

A bunch of screenshots of interesting moments playing 2048.
Above: A bunch of screenshots of interesting moments playing 2048.

While thinking about this, I started thinking about how cool it would be to play it in 3D, essentially playing multiple games at once. Which lead to this:

A screenshot of Cubetrix in action.
Above: A screenshot of Cubetrix in action.

How to get Cubetrix

It’s available on Google play.

For users

How to play

Controls

  • Swipe (brush your finger across part of the display in a direction) left, right, up, or down anywhere on the screen to compact numbers into higher value numbers.
  • Twitch the phone as if you’re trying to flick the blocks, to rotate the contents of the cube and expose another side.
    • This works both side-to-side, and forwards and backwards from you.
    • If this doesn’t work for you (any mid-range to high-end phone should work), you can tap anywhere on the screen to show/hide buttons that you can use instead.
  • To look around on a phone without gyros, do a drag: Simply hold your finger longer than about half a second. The number displays will all go grey to give you feedback that you have successfully entered this mode. At this point, you can move your finger around to look around.
    • You can also do the drag faster instead of the “twitching” motion described above to rotate the contents of the cube.
    • The normal re-centering gravity is turned off while you are dragging, because I found the gravity annoying while testing it on a phone that doesn’t have a gyro.

Objective

Keep combining blocks together until you reach the value of 2048.

Although, really, it’s to keep going as long as you can. I’ve been testing this a lot, and have got to 2048 a few times, but I haven’t managed to get to 4096 yet.

I suspect that there will be a lot of people much smarter than me who will get much further, and I can’t wait to see their screenshots on social media with the hashtag #cubetrix .

A lost game on my way to 4096.
Above: A lost game on my way to 4096.

What the colours mean

Cubes

A cyan block is a normal block.
Above: A cyan block is a normal block.

A blue block is newly added.
Above: A blue block is newly added.

A green block is the highest value.
Above: A green block is the highest value.

When a layer of blocks is orange, Cubetrix was not able to place any new blocks on that layer, and its allocated new blocks have spilled into other layers.
Above: When a layer of blocks is orange, Cubetrix was not able to place any new blocks on that layer, and its allocated new blocks have spilled into other layers.

If there are any red blocks, the game is lost.
Above: If there are any red blocks, the game is lost.

If the front blocks are their normal colours, but appear to be getting dirty, it’s because at least one layer of blocks behind them are orange. The more layers that are orange; the more dirty the front blocks will look, and the more challenging it is to recover from.

Number displays

The yellow number display shows the current score.
Above: The yellow number display shows the current score.

The green number display shows the current highest value.
Above: The green number display shows the current highest value.

The purple number display shows the number of moves that you've made.
Above: The purple number display shows the number of moves that you’ve made.

The cyan number display in the background shows the game title, and doesn't change.
Above: The cyan number display in the background shows the game title, and doesn’t change.

When a game is lost

The game ends when Cubetrix does not have enough space to place every block that is required for that turn. Essentially, the player is in debt for space.

You can enter this state regardless of whether there are still playable moves remaining.

A lost game.
Above: A lost game.

When you can take a turn

As long as the game isn’t lost (red), you can always take a turn, even if there are no moves on the currently visible layer.

If there are no places available on the currently visible layer, its block will be placed on one of the layers behind it. Be careful!; Cascading blocks build up very quickly.

Privacy

There is no tracking, and no data is shared with third parties.

You can read more in the Privacy policy for Cubetrix.

For geeks/nerds

Design considerations

General asthetics

I’ve always loved the look of the 3D interactions in movies like Hackers. Eg from 1:10 in this clip:

So that was a big part of the inspiration in how I wanted the game to look.

Readability vs looking cool

My early tests looked really cool, but were really hard to read:

One of my early designs that got hard to read very quickly.
Above: One of my early designs that got hard to read very quickly.

On any given frame, it can be pretty easy to figure out what you’re looking at. But when things are changing rapidly, it quickly became overwhelming to interpret what you were seeing.

It also helps that this board is completely uniform with every block representing 2048.

Another problem that this design had was that it was hard to tell which layer you were looking at. This was particularly the case when the board was fairly empty.

I opted for something similar to this when the cube it tilted off center, but to drop the opacity of the background layers by a lot while the cube is in a fairly neutral position. This had the effect of making the closest layer the main focus, and only making the background layers more visible while you’re intentionally looking around. This gave a nice balance betweeen readability, functionality, and looking cool.

Rotating the contents of the cube

I’m using the gyros to move the cube around. But to independently rotate the contents, I’ve created a flicking gesture on the pitch and yaw axies which is essentially:

if (angle > 30 degrees) and (angularVelocity > threshold):
    rotateContents;

In a future version, I’m probably going to reduce the angle a bit more, and increase the threshold for the angularVelocity. It’s very easy to trigger most of the time. But sometimes it’s not comfortable to rotate the device that far.

To roll or not to roll

This looked cool, and it was literally the last day before I submitted it to the Google Play store when I removed this feature. The reason:

It was fricken annoying.

The cube rotating to a mild degree. (Using the old 2048Cubed name.)
Above: The cube rotating to a mild degree. (Using the old 2048Cubed name.)

The name change

Speaking of the name change. I originally called it 2048Cubed, but it got rejected from Google Play for impersonation. This wasn’t my intention, but I could see where they were coming from. So I spent a few days researching names, and bantering with friends before changing the name to Cubetrix.

Update: I’m a long way down the path of promoting the game, and have just discovered that there is already a youtube channel called CubeTrix, and a 3D printer called CUBETRIX. Neither of these showed up when I was searching for possible name collisions.

Displaying the stats in 3D with the board

Most games have the score and other stats anchored to a specific place on the screen. I chose to move them around in 3D with the board because it’s fricken cool, and something I’ve not seen before. And it doesn’t affect the readability. (This is the thing that would have killed the idea if it had been a problem.)

Showing the stats from above the cube.
Above: Showing the stats from above the cube.

Showing the stats from slightly below the cube.
Above: Showing the stats from slightly below the cube.

Containing cube

I originally had a large cube containing the whole game. The idea was to intuitively show the boundaries of the game. In reality, I had to have it pretty faint to not be distracting. And yet, it was still distracting, and not obvious what it was for.

An early prototype showing a faint cube containing all of the blocks.
Above: An early prototype showing a faint cube containing all of the blocks.

Penalty for rotating the cube

A feature that I never got around to implementing was to add some number of blocks to the board every time the blocks got rotated within the board. The idea was to give cause to stop and think before taking action.

By the time I was ready to implement the feature, it was apparent that the game didn’t need to be made harder, and it would detract from one of the coolest aspects of the game. So I no longer have plans to add this.

Landscape vs Portrait

All-too-often these days, landscape is being intentionally broken (I think out of laziness rather than malice). So I made a point of making sure that it works both ways:

The landscape orientation in full swing.
Above: The landscape orientation in full swing.

Learning and challenges

Transparency

While I wrote my own library for producing 3D graphics back in the 90s, this was my first time working with OpenGL. It was a really interesting mix of some things being easier than I expected, and some things being harder than I expected. The way transparency works in OpenGL actually requires a lot of care to do well.

I wish I had taken screenshots of my early failures. Some of them looked quite special.

Motion tracking

Last time I played with motion tracking on mobile devices, gyros were rare, so I had to use accelerometers and do nasty things with data cleaning and mixing inputs to get something slightly usable. Even with all of that, it would have still been unpleasant to use the game on that data.

Now gyros are standard pretty much everywhere. So I opted to have that as the primary way of interacting with the device, and then have some buttons pop up to replace the essential functionality if the gyros aren’t detected.

You can show/hide these buttons at any time by tapping anywhere on the screen. But your experience will definitely be better using the gyros, because you can look around the cube.

The left, right, up, and down buttons for rotating the contents of the cube.
Above: The left, right, up, and down buttons for rotating the contents of the cube.

Interesting updates

This was getting long, so I’ve moved it to the Cubetrix - Change log.

This post references

1970-01-01
I've done a few software projects over the years. Here's a collection of some of them.

This post is referenced by

I live-streamed an attempt to get to 8192 again in Cubetrix. Let's see what happened.
The privacy policy of Cubetrix.

Posts using the same tags

I live-streamed an attempt to get to 8192 again in Cubetrix. Let's see what happened.
An Android game like 2048, but 3D, and requiring a different strategy.
The privacy policy of Cubetrix.
It was time for a much needed update to the resolution app. Here's what I've improved.
Getting the information and access you need to your infrastructure quickly, so that you can get back to sleep.
It's time to blow the dust off machine learning, and apply it to a dataset that I know.
I've just released the biggest, most exciting, update since the first public release of handWavey. The learning curve is dramatically reduced!
The story of where Achel came from, and where it's going.
My CV had gained so much weight that it was hard to do anything with it any more, and it was hard to read. So I did something about it...
Control your computer using a Leap Motion controller, but with an every-day-quality implementation.
What began as 3 tripods on a hill, and hours per photo, ended with way better results in seconds, hand held.
How much of your phone's screen resolution can you actually see? This app helps you quantify it.
Over the last few years, there has been a lot of talk about whether you can make use of the full resolution on a phone with a 4K display. Let's dig in and actually understand this.
An easy way to get a dark theme for kmail content, that reliably works on pretty much everything.
calibrate multiple touch and non touch screens on a single linux system." This is to address the issue on multi-display Linux desktops where the touch panel is automatically calibrated to operate over all of the displays, and even if you get the calibration right, it's then wrong again when you ...
DoneIt is a time tracker for working out where your time is going. For me there were a few things I wanted to achieve with it - Be able to say what I've been doing all day. - See how much time is lost to time ...
Well over a year ago I introduced mass which is a tool for managing large numbers of servers. It's come along way in that time, and it's well and truly time for another look. From the users' point of view, the most interesting things are probably that you can now ...
Achel is a programming language that I have been working on for the past 13 years (I said 12 in the video, it has been a long time!) There has been growing interest in the programs I have been writing using it, so I have now released it as open ...
1970-01-01
I've done a few software projects over the years. Here's a collection of some of them.

More...

Home | About | Contact | Cookies