FPS demo problem on 360
by JohnT · in Torque X 2D · 06/09/2008 (2:54 pm) · 60 replies
I have tried to run TX2 on the Xbox360 and am having a couple of issues when running 3D apps.
1. First the terrain is showing black sections where details are coming in and out.
2. The app completely crashes when I try and go into anything other than Terrain from the main menu.
To make sure that this was not an issue with how I compiled the engine I have reinstalled using the binary version and still have the exact problem. Also I tried debug and release versions but did not make a difference.
1. First the terrain is showing black sections where details are coming in and out.
2. The app completely crashes when I try and go into anything other than Terrain from the main menu.
To make sure that this was not an issue with how I compiled the engine I have reinstalled using the binary version and still have the exact problem. Also I tried debug and release versions but did not make a difference.
About the author
#2
Has anyone from GG commented on this issue? I am counting on using TorqueX 3D for the dream-build-play competition and we have until September to submit a game for the 360.
06/11/2008 (5:18 am)
I did not see much about it on the forums and thought I'd better make sure they knew about it. Has anyone from GG commented on this issue? I am counting on using TorqueX 3D for the dream-build-play competition and we have until September to submit a game for the 360.
#3
Actually, if you check the XNA Creator's Club submissions, you'll see I submitted a /mostly/ working variation of the FPS demo. It is currently one of the Creator's downloads available via Xbox Live. There seem to be some issues running on some people's 1080-HDTVs (memory?) and on SDTVs (MS downsampling bug/doc issue). It works very well on HDTV at 720, however. As soon as FedEx shows up with the source code which was just recovered from my crashed hard-disk, I'm going to fix those problems...
The problem with the black terrain has to do with the terrain clipmap blender. It's a prettty easy fix if you have the TorqueX source. In Materials\ClipMapBlenderImageCache.cs, add "Environment.OSVersion.Platform == PlatformID.Xbox || " to the beginning of the if on line 145 (the nVidia check). That will make it only create one level of mip data for the clipmapper on Xbox. I don't know why it is necessary on Xbox, they should be come for free, but this seems to work fine.
Also, you will want to add "&& XNA_1" to lines 196 and 375 (near there - the #if XBOX lines). That will prevent some weird artifacts with the clipmapper. That code is no longer necessary (or correct) because those render targets are preserving their contents under Game Studio 2.
I'm pretty sure the crashes you are encountering come from the 1080/SDTV problem. Try running at 720 if you're on HDTV - I don't know what to say for SDTVs yet... Try running under the debugger, that's how I figured out what was causing my crashes.
Another possiblity on the crash is a bunch of places where texture and vertex/index buffer data are being set while being used by the graphics device. That means the code is calling .SetData on a resource being used by the main XNA GraphicsDevice, such as .Vertex[0]. Still doesn't make sense, huh? Around line 324 (in ClipMapBlenderImageCache.cs), there is a line which calls _renderQuadVB.Instance.SetData. Insert this line above it: "GFXDevice.Instance.Device.Vertices[0].SetSource(null, 0, 0);" There are a bunch of those kind of calls throughout the engine. I did a search for SetData, analyzed each and fixed the ones which could cause problems.
Hope that helps get you going :)
06/11/2008 (1:44 pm)
I have had excellent success running on the 360. In the process, however, I've run into both the problems you describe (and more).Actually, if you check the XNA Creator's Club submissions, you'll see I submitted a /mostly/ working variation of the FPS demo. It is currently one of the Creator's downloads available via Xbox Live. There seem to be some issues running on some people's 1080-HDTVs (memory?) and on SDTVs (MS downsampling bug/doc issue). It works very well on HDTV at 720, however. As soon as FedEx shows up with the source code which was just recovered from my crashed hard-disk, I'm going to fix those problems...
The problem with the black terrain has to do with the terrain clipmap blender. It's a prettty easy fix if you have the TorqueX source. In Materials\ClipMapBlenderImageCache.cs, add "Environment.OSVersion.Platform == PlatformID.Xbox || " to the beginning of the if on line 145 (the nVidia check). That will make it only create one level of mip data for the clipmapper on Xbox. I don't know why it is necessary on Xbox, they should be come for free, but this seems to work fine.
Also, you will want to add "&& XNA_1" to lines 196 and 375 (near there - the #if XBOX lines). That will prevent some weird artifacts with the clipmapper. That code is no longer necessary (or correct) because those render targets are preserving their contents under Game Studio 2.
I'm pretty sure the crashes you are encountering come from the 1080/SDTV problem. Try running at 720 if you're on HDTV - I don't know what to say for SDTVs yet... Try running under the debugger, that's how I figured out what was causing my crashes.
Another possiblity on the crash is a bunch of places where texture and vertex/index buffer data are being set while being used by the graphics device. That means the code is calling .SetData on a resource being used by the main XNA GraphicsDevice, such as .Vertex[0]. Still doesn't make sense, huh? Around line 324 (in ClipMapBlenderImageCache.cs), there is a line which calls _renderQuadVB.Instance.SetData. Insert this line above it: "GFXDevice.Instance.Device.Vertices[0].SetSource(null, 0, 0);" There are a bunch of those kind of calls throughout the engine. I did a search for SetData, analyzed each and fixed the ones which could cause problems.
Hope that helps get you going :)
#4
06/11/2008 (2:04 pm)
Excellent help there, Devon! Thanks!
#5
As for the SDTV problem, it is an Exception about a depth buffer not matching when one isn't even being used. The solution is to handle the scene's depth buffer the same way as the scene's viewport during clipmap blending. All the following takes place in ClipMapBlenderImageCache.cs:
1) add a variable (around line 388) "private DepthStencilBuffer _sceneDepthBuffer;". You should see "Viewport _sceneViewport;" - add it after that
2) add "_sceneDepthBuffer = device.DepthStencilBuffer;" after setting _sceneViewport on line 184
3) after the call to SetRenderTarget on line 188, add the line "device.DepthStencilBuffer = null;"
4) finally, add "device.DepthStencilBuffer = _sceneDepthBuffer;" after line 273, again following the _sceneViewport pattern
Predicated Tiling on the Xbox 360 looks to be the major cause of the crashes in 1080. Running the demo in 1080 should be fine after applying the fixes I've described here - with the exception of the FPS level. The dynamic modification of resources (textures, vertex/index buffers, etc.) per-player for split-screen does not play well with predicated tiling. Basically, after player one is drawn, player two re-uses resources to draw. The subsequent calling of .GetData and .SetData on those resources after they have already been used in the current "tiling bracket" throws an Exception. I'm stumped... Maybe downgrading to 720 for the FPS level would be possible? That would probably make it run faster, too.
06/11/2008 (6:46 pm)
I have spent some time digging into the 1080/SDTV problems and have more information. They are definitely different issues. The SDTV problem is an easy four-step fix. The 1080 problem is more complicated...As for the SDTV problem, it is an Exception about a depth buffer not matching when one isn't even being used. The solution is to handle the scene's depth buffer the same way as the scene's viewport during clipmap blending. All the following takes place in ClipMapBlenderImageCache.cs:
1) add a variable (around line 388) "private DepthStencilBuffer _sceneDepthBuffer;". You should see "Viewport _sceneViewport;" - add it after that
2) add "_sceneDepthBuffer = device.DepthStencilBuffer;" after setting _sceneViewport on line 184
3) after the call to SetRenderTarget on line 188, add the line "device.DepthStencilBuffer = null;"
4) finally, add "device.DepthStencilBuffer = _sceneDepthBuffer;" after line 273, again following the _sceneViewport pattern
Predicated Tiling on the Xbox 360 looks to be the major cause of the crashes in 1080. Running the demo in 1080 should be fine after applying the fixes I've described here - with the exception of the FPS level. The dynamic modification of resources (textures, vertex/index buffers, etc.) per-player for split-screen does not play well with predicated tiling. Basically, after player one is drawn, player two re-uses resources to draw. The subsequent calling of .GetData and .SetData on those resources after they have already been used in the current "tiling bracket" throws an Exception. I'm stumped... Maybe downgrading to 720 for the FPS level would be possible? That would probably make it run faster, too.
#6
This information is amazing, thank you!
I believe I have implemented all the changes but am still not able to run anything other than the terrain (looks great now :)) Everytime I go into FPS from the main menu the program crashes with the following exception:
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
TypeUtil.cs
Line 204
_property.SetValue(obj, value, null); (value = "data\\shapes\\boombot\\blue_player.dts")
This looks like it is related to the GFXDevice.Instance.Device.Vertices[0].SetSource(null, 0, 0); issue but I'm not able to walk through the code to see where the offending code could be. Also, I have dropped my resolution down to 420p and still have the problem.
Thanks for all the help!
John
06/11/2008 (7:27 pm)
Devon,This information is amazing, thank you!
I believe I have implemented all the changes but am still not able to run anything other than the terrain (looks great now :)) Everytime I go into FPS from the main menu the program crashes with the following exception:
An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
TypeUtil.cs
Line 204
_property.SetValue(obj, value, null); (value = "data\\shapes\\boombot\\blue_player.dts")
This looks like it is related to the GFXDevice.Instance.Device.Vertices[0].SetSource(null, 0, 0); issue but I'm not able to walk through the code to see where the offending code could be. Also, I have dropped my resolution down to 420p and still have the problem.
Thanks for all the help!
John
#7
FileStream fs = new FileStream(_shapeName, FileMode.Open);
An exception is being thrown when any dts objects are attempting to be opened.
06/12/2008 (6:23 am)
Finally figured out how to navigate into the offending object through the debugger. The problem is in T3DTSRenderComponent line 64.FileStream fs = new FileStream(_shapeName, FileMode.Open);
An exception is being thrown when any dts objects are attempting to be opened.
#8
Replaced the line mentioned above with:
FileStream fs = new FileStream(_shapeName, FileMode.Open, FileAccess.Read);
Apparently the Xbox requires ReadOnly access in order to open files for security reasons. I'm getting closer and see the player dropping into the world but still have a crash something to do with BlobShadows.
Update: Finally there! Last problem with BlobShadow was attributed to the resources not reflecting the BlobShadow image. All I had to do was include it in the *.resx file. From what I can tell, everything is now working except for the 1080 mode as mentioned above.
06/12/2008 (6:47 am)
A little more progress, Yeah!!Replaced the line mentioned above with:
FileStream fs = new FileStream(_shapeName, FileMode.Open, FileAccess.Read);
Apparently the Xbox requires ReadOnly access in order to open files for security reasons. I'm getting closer and see the player dropping into the world but still have a crash something to do with BlobShadows.
Update: Finally there! Last problem with BlobShadow was attributed to the resources not reflecting the BlobShadow image. All I had to do was include it in the *.resx file. From what I can tell, everything is now working except for the 1080 mode as mentioned above.
#9
using (Stream fs = File.OpenRead(_shapeName))
{
...
}
and got rid of the fs.Close(); line. I find "using" to be cleaner, but either way it does need to be read-only. The only way to write files on Xbox is via the StorageContainer.
The blob shadow was another place I had to call "GFXDevice.Instance.Device.Vertices[0].SetSource(null, 0, 0);" before calling .SetData. It should go at line 239 in T3dBlobShadowCasterComponent.cs - after adding a bracket on line 238 for the "if" - then the closing bracket on line 241.
Looking at a file-comparison between my running version and the original source, I think that's all there is to get it running on the Xbox (assuming you found all the .SetData calls in the clipmap code and obviously handled the resx stuff). You'll probably notice other "features" running on the Xbox, but I don't think you'll crash anymore ;)
06/12/2008 (8:35 am)
That's great! I had fixed the .dts problem by wrapping everything inside the if (File.Exists()) withusing (Stream fs = File.OpenRead(_shapeName))
{
...
}
and got rid of the fs.Close(); line. I find "using" to be cleaner, but either way it does need to be read-only. The only way to write files on Xbox is via the StorageContainer.
The blob shadow was another place I had to call "GFXDevice.Instance.Device.Vertices[0].SetSource(null, 0, 0);" before calling .SetData. It should go at line 239 in T3dBlobShadowCasterComponent.cs - after adding a bracket on line 238 for the "if" - then the closing bracket on line 241.
Looking at a file-comparison between my running version and the original source, I think that's all there is to get it running on the Xbox (assuming you found all the .SetData calls in the clipmap code and obviously handled the resx stuff). You'll probably notice other "features" running on the Xbox, but I don't think you'll crash anymore ;)
#10
06/12/2008 (8:45 am)
Is there any chance of posting a .ccgame build of a working FPS demo? I'm interested in using Torque for DBP but a bit worried if I fork out for the source license and I still can't get it to work properly my entry will be doomed.
#11
06/12/2008 (8:50 am)
Weirdly I can see these forums even though I don't think I own Torque X Pro.
#12
John K.
06/12/2008 (9:14 am)
I'm already getting a patch update put together that includes fixes for most of the bugs posted in the forums, including this one. I'm expecting to release it very soon.John K.
#13
I have uploaded a .ccgame version of the project to:
http://www.oesis.net/downloads/startergame-xbox360.ccgame
I changed the FPS to single player screen mode since performance was a bit slow with split screen and it will only run up to 720. From what I can tell, this looks like it will work for my game and I am now comfortable with the engine for the DBP competition.
Hope this helps,
John
06/12/2008 (9:16 am)
I was thinking the same thing....I have uploaded a .ccgame version of the project to:
http://www.oesis.net/downloads/startergame-xbox360.ccgame
I changed the FPS to single player screen mode since performance was a bit slow with split screen and it will only run up to 720. From what I can tell, this looks like it will work for my game and I am now comfortable with the engine for the DBP competition.
Hope this helps,
John
#14
JohnT: Ace, downloading it now and will give it a try. I'm running 720p as well. Thanks for doing that, much appreciated.
06/12/2008 (9:22 am)
John Kanalakis: That's awesome news. JohnT: Ace, downloading it now and will give it a try. I'm running 720p as well. Thanks for doing that, much appreciated.
#15
Awesome! I was hoping someone from GG would do that... Any word on whether that patch contains TGBX 3D???
06/12/2008 (9:30 am)
Quote:I'm already getting a patch update put together that includes fixes for most of the bugs posted in the forums, including this one. I'm expecting to release it very soon.
John K.
Awesome! I was hoping someone from GG would do that... Any word on whether that patch contains TGBX 3D???
#16
Is there any word from GG about the performance? I can't imagine there's much that can be done really with it all being in C#.
06/12/2008 (10:25 am)
JohnT: Demo ran fine, thanks. I'll probably go and purchase the Pro version now. Is there any word from GG about the performance? I can't imagine there's much that can be done really with it all being in C#.
#17
I'm also going to start a new thread on engine performance. The engine, by default, is not in high performance mode, but supports the broadest range of graphics cards. The new thread will kick off discussions about how to optimize performance and share experiences.
John K.
06/12/2008 (1:17 pm)
What's the TGBX issue again? The patch I'm putting up is just going to address the engine bugs - physics fixes, class/property accessibility, support for L3DT terrains, and running issues on Xbox360. I'm also going to start a new thread on engine performance. The engine, by default, is not in high performance mode, but supports the broadest range of graphics cards. The new thread will kick off discussions about how to optimize performance and share experiences.
John K.
#18
I'm just glad that there is something in the works and that it sounds like we can use it for Dream-Build-Play.
06/12/2008 (1:35 pm)
Thanks John K.I'm just glad that there is something in the works and that it sounds like we can use it for Dream-Build-Play.
#19
06/12/2008 (4:59 pm)
Quote:John K.: What's the TGBX issue again?]Not an issue, per-se, [?off-topic] I want to know about that ambiguous release date for the XNA version of the 3D-enabled TGB. The last I saw was your teaser post from May 26...
#20
Another area of focus is on resolving the reported 3D issues on Xbox360. Our goal is to see a Torque X game win the Dream-Build-Play competition. GarageGames has a strong focus getting Torque X and supporting tools quickly sharpened to help everyone here build great games.
John K.
06/12/2008 (8:45 pm)
I can say that the 3D Builder is functionally complete and going into test. There were some initial bugs that had to be fixed and still some more critical bugs remaining. But a release is really close. In fact, these type of releases usually happen right around big game events/conferences/etc. Especially ones located on the west coast. Even ones in the very northwestern region. Sometimes, hosted by large multi-billion dollar companies.Another area of focus is on resolving the reported 3D issues on Xbox360. Our goal is to see a Torque X game win the Dream-Build-Play competition. GarageGames has a strong focus getting Torque X and supporting tools quickly sharpened to help everyone here build great games.
John K.
Torque 3D Owner Will O-Reagan
Modern Intrigues