Game Development Community

Increase the SetLayer() limit?

by Jason Swearingen · in Torque Game Builder · 08/01/2005 (1:39 pm) · 8 replies

I was thinking of various "illusion of depth" scenarios that one would wish to perform with T2D, then I looked at the GEtLayer() and SetLayer() ConsoleMethods...

There is a max of 32 layers.. While I havent written a game yet, does that strike anyone else as being a tad on the low end of the usefullness spectrum?

In my mind, a hypothetical Isometrics scenario could easily have more than 32 layers needed to give the proper depth illusion.

Are there any plans on changing this upwards? I think 255 would be a good lower bounds :)

Of course, as I mentioned, I have not produced even one game yet. So I might be talking out of my arse sideways. Is there something I am missing here? is there another way of setting depth that I dont know about?

Thanks,

-Jason

#1
08/01/2005 (1:52 pm)
It's at 32 because a lot of layer (and group) masking is done by the engine for various things. An integer is 32 bits, and thus only 32 layers can be masked. Of course, the engine could use a 64 bit int, but, it doesn't. I can't imagine it being too horrible to change.

You can sort objects within there layer with sceneGraph.setLayerDrawOrder().
#2
08/01/2005 (2:00 pm)
Ahh, as long as another method of sorting exists (the .setLayerDrawOrder() you mentioned) then that's cool.

The docs on that are not very intuitive, but I will play with it before asking more questions :)

Edit: The reference.pdf that comes with t2d gives a good explanation of this function, it looks like it will suit my needs :)

Thanks Adam!
#3
08/01/2005 (5:52 pm)
I'm just the opposite of you... I don't work in Isometric however. But I see '32' and think MAN, I'll never need that many layers for my game. I'll use 3-5, depending on how detailed I want to get.
#4
08/01/2005 (9:58 pm)
Quote:While I havent written a game yet, does that strike anyone else as being a tad on the low end of the usefullness spectrum?

No. I'm pretty sure that there's never been a production 2D game that uses more than 16 image tilemap layers. And even going past 8 is probably being either pathological (ie, there's a better, simpler way to get the results) or doing some specialized effect.

Quote:In my mind, a hypothetical Isometrics scenario could easily have more than 32 layers needed to give the proper depth illusion.

Any practical isometic system doesn't need a bunch of layers to work. It needs some, of course, but 32 for a reasonable scene? No.
#5
08/01/2005 (10:47 pm)
To follow Smaug's point, take a look at Rebelstar Tactical Command (a new Namco title) for the GBA from the makers of the original X-COM. It is isometric in 2D on the GBA with proper front-to-back rendering... now, before you say: "well, sure, it's easy with a custom drawing engine"... don't forget that the GBA is limited to 4 tile layers (of fixed Z order) + 64 sprites. That's all they get and they are pulling it off! Now, think about T2D... We've got WAY, WAY more power than a GBA on even the most baseline PC. If they can do every GBA game with only 4 layers, including isometric games, we can certainly do it with 32!
#6
08/01/2005 (10:53 pm)
Also, you are only limited to 32 layers per fxSceneGraph2D/fxSceneWindow2D. There's nothing saying you can't have more than one of these on top of each other (they are invisible unless you draw something). My current title uses 2 fxSceneWindow2D/Graph2D pairs set to full screen dimensions. I use the "bottom" one for my zoomable game content and I use the "top" one for fixed size content.

For example, in my bottom Window, I use .setCurrentCameraZoom to zoom in and out based on the size of the level, but I still want text and other UI elements on top, that are unaffected by the zoom, so the top window has a fixed zoom of 1.0.

There's nothing saying I couldn't have 8 of these things though to get 8 * 32 = 256 layers. I only use 4 layers in my game currently across both Window sets, so perf is perfect... so I have no idea what happens with 256 layers.
#7
08/02/2005 (1:31 am)
I belive my confusion was that I didnt know there was a way to set layer draw order. Now that I know there is that function, i could pretty much do all the layering in the world, just use 1 layer (of course i'd still probably seperate this a bit)

Anyway, thanks for your guys feedback. DrawOrder is what solves all the layering questions for me!
#8
08/02/2005 (2:04 am)
And interesting point about the use of multiple scenegraph's JasonC... i'll keep that in mind.

-The other jason