I have a pretty decent experience with tile based 2d games and I would like to try to create a mixed 3d-2d game. To 3d elements will be very simple (ground, walls and water), all other elements will be 2d sprites drawn onto this 3d map. (I am envisioning something similar to Final Fantasy III for iPad, top down view, always the same angle)

Now, here is my question: What are the technical aspects of implementing a 3d tile engine? Are there some good examples on how to do this? Basically I would like to create the maps the same way that I would do in a 2d tile based game.

  • 3
    \$\begingroup\$ Are you talking about isometry? (that's more common term than 3d tiles) \$\endgroup\$ – alxx Jun 8 '11 at 5:47
  • \$\begingroup\$ He could also be talking about a Minecraft style voxel map (though I doubt it). \$\endgroup\$ – The Communist Duck Jun 8 '11 at 14:36

It's actually quite similar to a 2D tile engine. You need to create the level somehow (i.e.: procedural generation or a map saved into a file that you created in an editor). Then you need to read that data, create the tiles and transform them to the appropriate locations and rotations. Draw only the tiles or polygons that are visible on screen (frustum culling) to keep the performance snappy.

Depending on whether your play area includes tiles at varying heights, you will need to find a solution for defining the collision bounds of the floor, walls, and platforms. Include collision data in each tile or, better yet, simplify that data and store it elsewhere to enjoy both memory and performance savings.

I hope this answered your question!

  • 2
    \$\begingroup\$ +1 for short and sweet. You literally are just using 3D models as the tiles instead of textures. You just need to translate the system to work in that manner (move this tile to those world coordinates with that rotation, etc) to stitch the 3D tiles into place. The other alternate to this is to just made a 3D world, not use tile pieces, and still use 2D sprites on top of it like I did in my Final Fantasy Tactics clone (sourceforge.net/projects/bpfat) \$\endgroup\$ – James Jun 8 '11 at 21:04
  • \$\begingroup\$ @James +1 That technique was also used in some isometric PlayStation era RPGs, including Breath of Fire 3 and 4. Raphael may wish to look those up, in addition to your game, for reference. \$\endgroup\$ – AWrightIV Jun 8 '11 at 21:13
  • \$\begingroup\$ @James - I've tried to checkout your code but it seems that the repository is empty. \$\endgroup\$ – Raphael Jun 9 '11 at 23:55
  • 2
    \$\begingroup\$ @Raphael Go to the Files section, you can find a zip of the source code there.. No idea why the repositories are empty and no one has touched the code since we graduated school :) \$\endgroup\$ – James Jun 9 '11 at 23:58
  • \$\begingroup\$ @James- Thanks! This will really help me to implement my game. \$\endgroup\$ – Raphael Jun 10 '11 at 0:36

Learn how to write a custom camera. A camera simply translates 3D coordinates in world space, into 2D screen space. (It also performs view culling.) Then you can draw your billboard sprites at those particular coordinates. This is a common pattern and learning resources abound.

I wrote a generalised version of this, a pseudo-3d tile engine that allows arbitrary rotation, tilt and zoom in real time using only affine transformation to create wall and floor perspectives, respectively. In this generalised version, the transformations and depth ordering were the hardest. Particularly if you plan a multi-storey approach, depth ordering will take a bit of time. In my case I used transformations for walls and floor specifically because I didn't want to be concerned with drawing angled tiles. In that sense, mine are more like textures than tiles. You might consider the benefits of this.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.