The Only Alternative
by Michael Woerister · 08/13/2006 (4:02 am) · 8 comments
The Problem with TGB's Tile-Maps
I always found TGB's tile-map system to be on the unhandy side. The lack of real tile-sets like you find them everywhere else (or at least I thought so) can be a pain in the ass when you have to make changes throughout a whole project. As long as it is just visuals that have to be changed you are ok - you can just modify the image-file or the animation datablock. But as soon as collision or custom data is concerned you have to go through all your tile-maps, find the tiles in question, change them by hand, save to tile-layer and go on to the next. There are brushes in the editor, which makes your life a bit easier but still - this can get quite ugly if your project is big enough.
In addition to that TGB's existing tile-layer system is memory eater. Every tile holds its own t2dPhysics object plus the data for rendering which makes 300 bytes per tile. That makes nearly 3 MB for 100x100 = 10000 tiles. Suppose you've got a top-down RPG or RTS with a tile-size 16x16 pixels on a 800x600 screen. That would be about 1900 tiles per screen - making the 10000 tiles about 6 screens of tile-map. Take your average RTS with maps at least 10x10 screens big - that would make 50 MB just for the tile-map. That can be a lot for low-end systems.
TGB's tile-layers clearly got their field of application. If you've got a lot of unique tiles that actually use physics (which often is not the case), your tiles are big and your project is small enough then they are quite convenient to use.
Yet, building a big RPG or a Super Mario-like Jump 'n Run with this system didn't sound very inviting. So I started to develope an alternative tile-layer implementation for TGB. That was about 2-3 weeks ago and this is what I've got so far:

The object above is a t2dAltTileLayer that is associated to a t2dTileSet. It pretty much is the same as t2dTileLayer but it doesn't need a t2dTileMap as owner and its tiles are just 20 bytes big. But the main reason I developed this were the tile-sets. After I had to mark every tile my character could walk on with a "walkable" custom data string in my last project I just wanted to be able to mark a certain type of tile just once. As it is now the same thing is copied and pasted over and over again in memory. Tile-sets provide you with the means to avoid this.
t2dAltTileLayer does not support wrapping or panning at this time (but at least panning is to come). It uses only as many t2dPhysics objects as it needs. The whole system takes advantage of TGB resource management system and will allow any image-maps to unload themselves if they are not used. And it can be used side-by-side with the existing solution without any interference. Once you've got to know Torque's console system and TGB it is a pleasure to implement your own t2dSceneObjects and editors therefore.
Half of the time I spent on the TileSet Editor:

It integrates into TGB's level builder as a resource and will save the tile-sets just as the animation builder saves animations. It needs some testing but should be fully usable by now. There are still some convenience tools to come though.
One very big chunk of work will be the integrate tile-layer editing. I still have to figure out how the level builder organizes stuff, how tools communicate with the quick edit fields, how I can register a new type of object in the create tab. And of course the editing itself.
Problem is my time is limited. From tomorrow I will officially start to work with Jason McIntosh from Creatrix Games on a still unanounced project. I am really looking forward to that and Jason seems like someone you want to work with :)
The t2dAltTileLayers will probably be used in the project, of which the implementation would benefit a lot in terms of testing and usability. But there is still a lot of work to be done.
Press comments:
I always found TGB's tile-map system to be on the unhandy side. The lack of real tile-sets like you find them everywhere else (or at least I thought so) can be a pain in the ass when you have to make changes throughout a whole project. As long as it is just visuals that have to be changed you are ok - you can just modify the image-file or the animation datablock. But as soon as collision or custom data is concerned you have to go through all your tile-maps, find the tiles in question, change them by hand, save to tile-layer and go on to the next. There are brushes in the editor, which makes your life a bit easier but still - this can get quite ugly if your project is big enough.
In addition to that TGB's existing tile-layer system is memory eater. Every tile holds its own t2dPhysics object plus the data for rendering which makes 300 bytes per tile. That makes nearly 3 MB for 100x100 = 10000 tiles. Suppose you've got a top-down RPG or RTS with a tile-size 16x16 pixels on a 800x600 screen. That would be about 1900 tiles per screen - making the 10000 tiles about 6 screens of tile-map. Take your average RTS with maps at least 10x10 screens big - that would make 50 MB just for the tile-map. That can be a lot for low-end systems.
TGB's tile-layers clearly got their field of application. If you've got a lot of unique tiles that actually use physics (which often is not the case), your tiles are big and your project is small enough then they are quite convenient to use.
Yet, building a big RPG or a Super Mario-like Jump 'n Run with this system didn't sound very inviting. So I started to develope an alternative tile-layer implementation for TGB. That was about 2-3 weeks ago and this is what I've got so far:

The object above is a t2dAltTileLayer that is associated to a t2dTileSet. It pretty much is the same as t2dTileLayer but it doesn't need a t2dTileMap as owner and its tiles are just 20 bytes big. But the main reason I developed this were the tile-sets. After I had to mark every tile my character could walk on with a "walkable" custom data string in my last project I just wanted to be able to mark a certain type of tile just once. As it is now the same thing is copied and pasted over and over again in memory. Tile-sets provide you with the means to avoid this.
t2dAltTileLayer does not support wrapping or panning at this time (but at least panning is to come). It uses only as many t2dPhysics objects as it needs. The whole system takes advantage of TGB resource management system and will allow any image-maps to unload themselves if they are not used. And it can be used side-by-side with the existing solution without any interference. Once you've got to know Torque's console system and TGB it is a pleasure to implement your own t2dSceneObjects and editors therefore.
Half of the time I spent on the TileSet Editor:

It integrates into TGB's level builder as a resource and will save the tile-sets just as the animation builder saves animations. It needs some testing but should be fully usable by now. There are still some convenience tools to come though.
One very big chunk of work will be the integrate tile-layer editing. I still have to figure out how the level builder organizes stuff, how tools communicate with the quick edit fields, how I can register a new type of object in the create tab. And of course the editing itself.
Problem is my time is limited. From tomorrow I will officially start to work with Jason McIntosh from Creatrix Games on a still unanounced project. I am really looking forward to that and Jason seems like someone you want to work with :)
The t2dAltTileLayers will probably be used in the project, of which the implementation would benefit a lot in terms of testing and usability. But there is still a lot of work to be done.
Press comments:
Quote:- New Yorker
It begins as a detective novel, dips into a screwball comedy, and at its close becomes a tale of possession ... A highly accomplished piece of craftmanship"
Quote:- Independent on Sunday
How does M. manage to make poetry while writing of contemporary life and tile-layers? I am weak-kneed with admiration
Quote:- Jay McInerney
A remarkable writer ... he captures the common ache of the contemporary heart and head
About the author
#2
08/14/2006 (7:09 am)
Awesome stuff! Please finish this... :)
#3
You are such a stud doing things like this! Sounds like very cool stuff indeed. Awesome news about the job you landed, those guys must be able to recognize talent when they see it!
Cheers and Best Regards,
-Justin
08/16/2006 (11:40 am)
Michael,You are such a stud doing things like this! Sounds like very cool stuff indeed. Awesome news about the job you landed, those guys must be able to recognize talent when they see it!
Cheers and Best Regards,
-Justin
#4
- Melv.
08/16/2006 (11:51 am)
Great work Michael! I can't wait to see what you and Jason can come up with.- Melv.
#5
This is rather low priority though at the moment as there are a lot of other things to do. And I am quite reliefed to get a break from it for some time.
As for Creatrix' new project: Enjoy not being blind as long as you can - because as soon as you see it your eyes will fall out for sure! ;)
08/16/2006 (1:30 pm)
Thanks everyone! :)This is rather low priority though at the moment as there are a lot of other things to do. And I am quite reliefed to get a break from it for some time.
As for Creatrix' new project: Enjoy not being blind as long as you can - because as soon as you see it your eyes will fall out for sure! ;)
#6
08/16/2006 (1:40 pm)
You may not wanna use that in your marketing material... just a suggestion :)
#7
08/16/2006 (1:46 pm)
Marketing is not my department ;)
#8
08/17/2006 (1:47 pm)
This looks really cool, I hope it can eventually find it's way to becomming a TGB resource / addon. 
Torque Owner Andrew Douglas
Anyway, I'm really looking forward to hearing lots more about this unannounced title. Good luck and good work on the tile system and editors. Very cool indeed.
-Andrew
theoreticalgames.com