Build an isometric 3D game in 2D — #1 Project setup and basic calculation

I’ve released a game called Ladder Box, it’s a 3D puzzle game that is all programmed in a 2D environment.

Folks on Reddit curious how I make this, I tried to briefly describe the overall idea of how to make this happen but did not dive deep, and now I’m gonna tell you guys how I make this work.

I’m using Godot Engine in this series, but you can skip the engine-specific part (scripting, scene building) and do it in other engines/frameworks, and I highly encourage you to do so.

You can find all the textures, scripts in this GitHub repo:

Godot 3.2.x is used in this project, you can check the commits for what’s new in each part of this series.

Edit: project structure will follow Godot’s project organization tutorial.

First, let’s make those blocks

I’m gonna have a movable and an unmovable scene, and a scene for floor tile.

Both movable and unmovable scenes only contain a sprite node with old textures from Ladder Box.

The size of the block texture is 24(w)x25(h), and our calculation from 3d to 2d will be based on this.

Don’t forget to uncheck ‘Filter’ for both textures in the “Import” tab.

For the floor tile scene, follow Godot’s tutorial to set up a tilemap, change cell size and mode to make it fit our texture(Cell -> Size and TileMap -> Mode).

If you think they’re too small when you run the scene, just set the scale for all these scenes to the same value, mine is V2(3,3)

Game Axis

This is the game-axis we’ll be using, now let’s build one of the core parts of the game, implement 3d effects in a 2d environment.

Start with y=0

Let’s start with something simple, set only one layer, y=0.

Maybe you can tell by looking at the picture above when coordinates are V3(1,0,0), convert it to engine position will not be like V2( 25/2,0), but V2(25/2,24/4) instead.

Write some code

Now let’s have a global script to handle all the 2d/3d(game/engine) conversion.

Note that we did not have y in our calculation yet.

Then let’s have a scene to hold our floor and create blocks.

  • make the camera current
  • in floor_tile.tscn, set position.y to -1
  • “movable” and “unmovable” are both Node 2D and acts as containers for our blocks.

And attach a script to our main node.

and run the scene :

Pile up

Now let’s take y into our calculation

Add tow lines to scripts/global/ :

and in function game_to_engine:

with those two lines added, we can change _ready() in our

And we got it roughly right, but if you reordered the movables create function, you’ll get something weird like this:

And we’ll fix this next time.

You can check the code here: