Active Tiles...
by Melv May · in Torque Game Builder · 04/30/2005 (10:42 am) · 7 replies
Well I don't get much chance to play on stuff I like to do but I did manage to play around with active-tiles a little over the last few days. If you didn't already know, active-tiles are another class of tile that you can create within a tile-layer in the exact same way you can a static or animated tile. The difference with active-tiles though are that they are a complete object in their own right and have their own script-interface, time-integration and rendering. This means that they can do virtually anything!
A classic use would be for something like a gun-turret which tracks another T2D object and fires at it. Active-tiles were 95% done but didn't have that final love which enabled them to really shine. To be completely honest; they'd been implemented but never tested even with a test class.
Some of you may have noticed that there's a basic example of an active-tile in the v1_0_2 release (although not added to the build). This is a tile which simply flashes a random colour; nothing interesting but handled completely by the tile itself.
The code to get an active tile is nothing special either:-
The position of an active-tile is identical to a 'standard' tile e.g. it pans/moves with the tile layer but it is not restricted in anyway in terms of rendering. If the tile wants to render over the whole screen or execute some script, it could. It might decide it wants to render another scene-view within the tile itself or perhaps create a particle effect that moves along with the tile.
So where do you get these magical active-tiles from? Well, of course, you'll have to create them yourself in C++ but they are really easy to create and I'll be providing some basic examples (as I've already done with the test-tile in v1_0_2) and I can see the community generating all sorts of wonderfully active-tiles as resources.
Now although you can use active-tiles in the v1_0_2 release, I've given it a little more love since then and it's pretty much finished in terms of base functionality so that'll obviously be in the next release.
So enough talk, here's a couple of examples of active-tiles and please note that any judder is the movie capture utility and not T2D; active-tiles are fast!
Active-Tile Movie#1 (DivX 2.5mb)
Active-Tile Movie#2 (DivX 2.5mb)
Notice how the tiles all rotate to face the 'player' object and that they're not restricted to the tile-space that was originally intended for the tile. All this is being done by the active-tiles themselves and don't need any script. Any amount of functionality could be configured for the active-tile, in this case, it's just to face a specified T2D object.
Hopefully, this'll generate some ideas on how you can use active-tiles in your projects.
Active-Tiles 'facing' a specific object in realtime

- Melv.
A classic use would be for something like a gun-turret which tracks another T2D object and fires at it. Active-tiles were 95% done but didn't have that final love which enabled them to really shine. To be completely honest; they'd been implemented but never tested even with a test class.
Some of you may have noticed that there's a basic example of an active-tile in the v1_0_2 release (although not added to the build). This is a tile which simply flashes a random colour; nothing interesting but handled completely by the tile itself.
The code to get an active tile is nothing special either:-
// This is the standard way to get an active-tile. %tileObj = %layer.setActiveTile( %x SPC %y, t2dGunTurret ); // This is specific to my custom functionality of "t2dGunTurret". %tileObj.setImageMap( shipImageMap ); %tileObj.setTrackObject( player );This code will create an active-tile of class "t2dGunTurret" at position (%x, %y) and return you the object so that you can configure it. We can then configure the tile-object with whatever functionality if provides, in this case, setting an imageMap and telling it which T2D object to face towards.
The position of an active-tile is identical to a 'standard' tile e.g. it pans/moves with the tile layer but it is not restricted in anyway in terms of rendering. If the tile wants to render over the whole screen or execute some script, it could. It might decide it wants to render another scene-view within the tile itself or perhaps create a particle effect that moves along with the tile.
So where do you get these magical active-tiles from? Well, of course, you'll have to create them yourself in C++ but they are really easy to create and I'll be providing some basic examples (as I've already done with the test-tile in v1_0_2) and I can see the community generating all sorts of wonderfully active-tiles as resources.
Now although you can use active-tiles in the v1_0_2 release, I've given it a little more love since then and it's pretty much finished in terms of base functionality so that'll obviously be in the next release.
So enough talk, here's a couple of examples of active-tiles and please note that any judder is the movie capture utility and not T2D; active-tiles are fast!
Active-Tile Movie#1 (DivX 2.5mb)
Active-Tile Movie#2 (DivX 2.5mb)
Notice how the tiles all rotate to face the 'player' object and that they're not restricted to the tile-space that was originally intended for the tile. All this is being done by the active-tiles themselves and don't need any script. Any amount of functionality could be configured for the active-tile, in this case, it's just to face a specified T2D object.
Hopefully, this'll generate some ideas on how you can use active-tiles in your projects.
Active-Tiles 'facing' a specific object in realtime

- Melv.
About the author
#2
04/30/2005 (11:16 am)
Whoa, that's nice. Those will be very very useful!
#3
04/30/2005 (11:32 am)
Woohoo, sweet! :) That's a seriously trippy effect. :-p
#4
04/30/2005 (1:03 pm)
Nice stuff, Melv. Already a plethora of new ideas for the current project. Thanks...
#5
04/30/2005 (3:26 pm)
Wow, awesome videos! Active-tiles seem amazingly powerful!
#6
Do i smell another Tut coming on, on how to best put this baby to use?
04/30/2005 (5:02 pm)
HmmmmmDo i smell another Tut coming on, on how to best put this baby to use?
#7
Melv, this in itself is a valuable tutorial; I found it very useful and am thinking of using it as part of my
A* driven C++, armoured vehicle demo which I intend to donate to the T2D community sometime within the coming weeks!:) Thank you!:)
If Melv, "King Tut" and a few others keep churning things like this out at the current rate, we'll be swamped with information overload in no time flat! lol Statement meant as a deterrent? On the contrary!:) Bring it on everybody!:)
05/01/2005 (11:35 am)
I'd hate to be in the middle of all those fighter ships, even if it's only in a game! lol Melv, this in itself is a valuable tutorial; I found it very useful and am thinking of using it as part of my
A* driven C++, armoured vehicle demo which I intend to donate to the T2D community sometime within the coming weeks!:) Thank you!:)
If Melv, "King Tut" and a few others keep churning things like this out at the current rate, we'll be swamped with information overload in no time flat! lol Statement meant as a deterrent? On the contrary!:) Bring it on everybody!:)
Torque Owner Philip Mansfield
Default Studio Name
I can just see a few objects being fired around the scene in opposite directions, and alternating tiles rotate to face them. Hey presto, hypno-effect!
Nice work!