Game Development Community

raw terrain for xbox

by Eric Ewen · in Torque X 3D · 11/08/2009 (3:45 pm) · 5 replies

I'm using TX3D 3.1.4

I also replied to this blog post:

http://www.garagegames.com/community/blogs/view/17277

I too got this to work...kinda. Has anyone tried this on Xbox? When I did I received a couple errors, mainly UnauthorizedAccessException. This was an easy fix (only if you have the source). I had to replace a couple lines in the source:

FileStream fs = new FileStream(_shapeName, FileMode.Open);

To:

FileStream fs = new FileStream(_shapeName, FileMode.Open, FileAccess.Read);

To make things easier just do a search on FileMode.Open.

So once I did this I thought I was in the clear....WRONG. There is a XBOX/PC conditional in the ClipMapUniqueImageCache.cs Initialize method. In the XBOX code there is a for loop that iterates mipmap levels. The first pass (i=0) is fine but subsequent passes causes line (~129):

sourceTex.GetData<uint>(i, rect, data, 0, dataSize);

to bomb out ("Value does not fall within the expected range"). Curious, I just threw a try catch in there an DoRectUpdate bombed. Trowing a try catch to swallow those exceptions rendered a black terrain on Xbox without any texture.

John, my question is...Is this a bug? Did I create my terrain incorrectly in l3dt? I followed your instuctions to the letter (I think). I have also tried multiple variations of terrains (~14) with different settings/resolutions and nothing seems to work.

PS. Just as a heads up I see this line at line number 112 in ClipMapUniqueImageCache.cs:

while (width > 1 && height >= 1);

Not sure what this is doing there.

#1
11/09/2009 (3:08 am)
Weird. I just tried it and besides the Filestream issue everything was fine. Did take a bit to load but then it loaded an ran fine.

are you using 3.1.4?

#2
11/09/2009 (3:33 pm)
Yeah, I'm using 3.1.4. When John said "Set a map size of 16 for the X and Y values" I don't see this option. Is this the width and height of the map? Is this when I set the HF/DM ratio? Am I looking for 16 x 16 pixels? When I change the size of the map I have to change the HF/DM ratio lower or higher depending on the map resolution.

Also, there is a LODlevels of 4 on my terrain XML in the txscene file. Does this have to be modified?

I thought my first l3dt map wasn't working because I added a x4 reslution heightmap and texturemap. I created a new map with the defaults and that didn't seem to work either.

Thanks for the help
#3
11/09/2009 (3:35 pm)
Oh yeah...I also see VERY slow load times. Like 5 minutes slow. This was my largest map (2048x2048) but the 512x512 loaded in about 2 minutes...still unacceptable for a game submitted to XBL
#4
11/09/2009 (6:24 pm)
Dudes I deal with it this way:

http://www.garagegames.com/community/forums/viewthread/78749

Make a new .ter file using the TGE there is a download in the thread. And it drops right in, also can used in the editor.

Ta Da!
#5
11/09/2009 (6:37 pm)
I've used this but it takes a while to make a decent terrain....so I bought L3DT. Oooops. But yes, these do drop right in. Maybe I didn't look into the TGE editor settings so hopefully I can import a heightmap created in L3DT?

Either way thanks for the heads up Henry!