Game Development Community

Layer file not saving "0 0" position?

by wingman · in Torque Game Builder · 07/20/2006 (8:45 pm) · 9 replies

I finally got around to fooling with TGB today since I bought it over a month ago.
I have gone through some of the tutorials on TDN.

However, I do have a couple of quick questions:

1. When I position a tilemap in the editor, and set its position to "0 0" to match the
camera (the camera is at coordinates 0, 0 and the camera extent is 100, 75), then
save the .lyr file, the position field will not be saved in the .lyr file. Anything other
than a 0, 0 position for the layer and it will save properly.

new t2dTileLayer() {
LayerFile = "mygame/data/tilemaps/layer1.lyr";
position = "1 1"; <---- this line here is gone if coords are "0 0"
size = "100 75";
Layer = "30";
mountID = "2";
};

2. What is the size limit for each layer? Im fooling around with a
zelda style (top down 2d) rpg, but instead of having to load screen by screen,
I want to be able to roam freely, and am wondering how big I can make each
layer. I hope this question is clear enough.

#1
07/21/2006 (2:13 am)
1. I assume you're talking about a t2d file (level file), not a lyr file (tile layer) - lyr files are stored binary. The reason the position line isn't there for "0 0" is because it only needs to store values that differ from the default value to save disc space and load time; "0 0" happens to be the default position for all scene objects. If your tile layer is not showing up at (0, 0), that's an entirely different issue and needs to be addressed. Try setting a name on that object, then setting its position to (0, 0), saving/restarting TGB, and doing [name].dump(); in the console. Then you can scroll up and check if the position is actually "0 0".

2. There is no hard limit. Your world can be as expansive as you have memory to store. Regardless, I would suggest some sort of system to load and unload sections of your level that are off-screen as your player moves to save resources. After all, the lower the system requirements on your game, the more people can play it, right? ;)
#2
07/21/2006 (3:17 am)
Thanks for the response.

And yes, I did mean the .t2d file, and not the .lyr file. When I load the editor, the layer is always at "100 100", and not "0 0" since there is no position field in my .t2d file. If "0 0" was default, I would assume that the layer would load properly in my scene.

Kind of wierd.
#3
07/21/2006 (4:08 am)
That is wierd. Ill test it now and post back.
#4
07/21/2006 (4:13 am)
Ouch, yea.. thats definitely a bug! Set it to (0, 0) and just start the level and it shoots to exactly (100, 100). I'll report it for ya. That's a wierd one. Thanks for posting this.
#5
07/21/2006 (4:15 am)
Ouch, yea.. thats definitely a bug! Set it to (0, 0) and just start the level and it shoots to exactly (100, 100). I'll report it for ya. That's a wierd one. Thanks for posting this.
#6
07/21/2006 (5:19 am)
Ok, it's reported. I wish I could say that you could manually set it to "0 0" in the level file, but that seems to have the same effect once you run the level. Sorry for the inconvinience. Hopefully this issue will be resolved soon.
#7
07/21/2006 (1:08 pm)
Good news: I tried it with the next version and it's already fixed. :)

It should be out soon.
#8
07/21/2006 (3:06 pm)
Nice!
#9
07/22/2006 (3:30 am)
Good I noticed that as well :)