Game Development Community

Wondering about T2D capabilities

by njfd · in Torque 2D Beginner · 06/06/2014 (6:58 am) · 3 replies

Hello all of you.

I'm currently in a quest to make a small game. To balance between ease of development and depth of gameplay, I've decided on an isometric (axonometric to be precise) perspective. Like you all know, this gives an impression of a 3D world while only needing 2D assets. Good examples are Age of Empires (1 and 2) and Diablo II. I'm also doing it because I frankly like how it looks.

What I'm not looking for is an 3D engine that gives an "isometric" camera, like for example AoE 3 or Dungeon Siege. I want to do this without ever having to touch 3D models.

I was wondering whether something like that is viable in Torque2D. I've played around with other 2D engines, but they have for example no way to deal with occlusion, by which I mean a character's ability to walk in front and behind objects, as well as between objects, as illustrated in the image at the bottom of my post. I would like to accomplish this without having to modify the engine itself, as I'm afraid I'm not good enough a programmer to do that just yet (this is a project to hone my skills, after all).

Note: the purple cylinder represents a moveable character.
i4.minus.com/iGmTaXwgHMnJa.jpg

About the author

Recent Threads


#1
06/06/2014 (11:14 am)
Most definitely. In fact, just before T2D released under MIT (v2.0), several changes were made to the camera and "tile system" to better support the features you are asking about.

The first pass resulted in this vide: T2D Isometric Rendering.

The system was improved further, which can be seen in this video: T2D MIT 2.0. Between 0:40 and 1:10, you should see many uses of the CompositeSprite object. This is used for a variety of features, including "tile maps", which supports the isometric perspective, sorting, and occlusion. I think that's exactly what you are looking for.

To see it for yourself, download the latest build of the engine (3.0). When you compile and run, you will initially run the Sandbox demo. If you open the menu, you can change toys. Load the CompositeSpriteToy. From the menu, you can change the different types, sorting, and so on.

Docs on CompositeSprite can be found here.
#2
06/06/2014 (11:22 am)
@njfd : I've created a fully-functional isometric engine in T2D with scripts only. My version uses Hexagonal tiles but standard "tilted squares" work with the same logic.

The subject is quite complex however.

First up, your "map" will be composed of one or more CompositeSprite objects. All tiles will be spread across 32 Scene Layers (Layers that have a lower index appear in front of others). The cool thing is that each Scene Layer can be subdivided as much as you need using SceneDepth, which basically allows you to use the entire range of a float variable for depth coordination of your scene.

If your player character needs to move smoothly (not on a tile-per-tile basis, like in Xcom) you would need to check his position every frame to make sure that the character's sprite is updated to the correct SceneLayer and SceneDepth.

Take a look at my Blog on the subject.

If you have any further questions after reading + trying it out, feel free to ask them on your post, so as to keep things clean :)
#3
06/07/2014 (3:50 pm)
Thank you very much for your replies. You have saved me a lot of time and headaches. The way I see it now, there isn't really anything that can stop me.

A funny coincidence, I've seen that exact blogpost a couple of weeks ago when I was first researching game engines. It's comforting to know that occlusion can be implemented without sacrificing too much performance. I was afraid that a high-level language wouldn't be fast enough for the task.