Sprite material in torque project causes Code 3 in Xbox
by Raymond Ku · in Torque X 2D · 07/08/2010 (7:47 pm) · 9 replies
Hey everyone, I've got a headache.
For 12 hours or so I've been dealing with a code 3 on my xbox deployment of game.
Finally I narrowed it down to two sprites.
The situation:
If I run my game without these two sprite materials in my torque x builder, just having them removed from torque, visual studio project, etc everywhere, the game runs fine.
If in torque x builder I click add material and add either of these two png files, when i finally deploy my game to Xbox360, I get a code 3 crash.
Actually using 3.1.5 beta 2 the behavior has changed a bit.
If i add the materials in TXB, its okay. If I try to use the materials as static sprite or animated sprite in the scene:
1. First time will run and deploy but the place where sprite should be is a white square the size of the object. So i noticed that when i saved the scene and project the sprite didnt added to my visual game stuido project (the file is in the folder, but not the project). I manually add the materials to my images folder in my project.
following,
2. I deploy the game to xbox 360 and when i load scene, Code 3 goodness.
the two png sheets are totally different from each other, but i have no idea why i'm having so much trouble importing/compiling them.
perhaps the situation can be solved by drawing new sheets, but if so I would like to know what to avoid the next time I'm creating sprite sheet materials.
Hope someone can help me.
Much thanks
Ray
For 12 hours or so I've been dealing with a code 3 on my xbox deployment of game.
Finally I narrowed it down to two sprites.
The situation:
If I run my game without these two sprite materials in my torque x builder, just having them removed from torque, visual studio project, etc everywhere, the game runs fine.
If in torque x builder I click add material and add either of these two png files, when i finally deploy my game to Xbox360, I get a code 3 crash.
Actually using 3.1.5 beta 2 the behavior has changed a bit.
If i add the materials in TXB, its okay. If I try to use the materials as static sprite or animated sprite in the scene:
1. First time will run and deploy but the place where sprite should be is a white square the size of the object. So i noticed that when i saved the scene and project the sprite didnt added to my visual game stuido project (the file is in the folder, but not the project). I manually add the materials to my images folder in my project.
following,
2. I deploy the game to xbox 360 and when i load scene, Code 3 goodness.
the two png sheets are totally different from each other, but i have no idea why i'm having so much trouble importing/compiling them.
perhaps the situation can be solved by drawing new sheets, but if so I would like to know what to avoid the next time I'm creating sprite sheet materials.
Hope someone can help me.
Much thanks
Ray
About the author
http://cip-game.blogspot.com
#2
I'll try shrinking them a little bit.
07/08/2010 (10:59 pm)
one is 2000 by 1200 which is weird cause i've used plenty of other sprites exactly the same size. The other is 2000 by 2000. I used to have problems with things bigger then 2048 but i think this is a different problem.I'll try shrinking them a little bit.
#3
07/09/2010 (2:05 pm)
First, try making them powers of 2, like 2048. If that doesn't work, make sure the png depths are 24 or 32. it is possible to have a higher encoding, which I assume would not go well on xbox. maybe even lower ones wouldn't.
#4
It was a bizarre error because we haven't been changing the png's in anyway and only those two were giving this bizarre problem. When I get more time i'll revisit the png's. But the problem could of been how TXB was running on my computer. I think the fresh install helped a lot. Its still weird how only those two sprites were affected though. Thanks
Ray
07/09/2010 (10:35 pm)
Thanks Olivier, i'll relay the info to my artist. But I did manage to run the game without getting an error code. I removed all txb builds and then reinstalled. Afterwards i shrunk both issue causing png's to smaller resolution (although not power of 2) and using 3.1.4 tx2d builder i added the content. They both got added and compiled to my visual studio project correctly and i was able to run my game correctly on the xbox.It was a bizarre error because we haven't been changing the png's in anyway and only those two were giving this bizarre problem. When I get more time i'll revisit the png's. But the problem could of been how TXB was running on my computer. I think the fresh install helped a lot. Its still weird how only those two sprites were affected though. Thanks
Ray
#5
the Code 3 error on the Xbox is a low level error happening in a way that the managed code cannot trap it, so, bottom line, it's a non managed Code 4.
This usually happens when an GPF-like error is raised by any GPU related code: shaders, rendertargets and so on. On the xbox the GPU has quite strict constraints (way better than the PS3 though) so the best way to go is to use the ARGB format for the assets (ARGB8888) better if sized as multiple of 4 or (even better) power of 2. In this way you'll use the GPU at its best performance avoiding internal out of memory exceptions which are shown as Code 3 errors.
~Pino
07/12/2010 (8:40 am)
Hi,the Code 3 error on the Xbox is a low level error happening in a way that the managed code cannot trap it, so, bottom line, it's a non managed Code 4.
This usually happens when an GPF-like error is raised by any GPU related code: shaders, rendertargets and so on. On the xbox the GPU has quite strict constraints (way better than the PS3 though) so the best way to go is to use the ARGB format for the assets (ARGB8888) better if sized as multiple of 4 or (even better) power of 2. In this way you'll use the GPU at its best performance avoiding internal out of memory exceptions which are shown as Code 3 errors.
~Pino
#6
As we go through our sprites and reformat them, i have a worrying question. Is there a limit to the number of sprite materials the xbox360 can handle?
At the moment we are numbering about 120 sprite materials, some materials used for static sprites others for animated. I am wondering if you guys have used more or less for your xbox xna torque games.
Thanks
Ray
07/26/2010 (11:20 pm)
Thanks for the replys, converting a large quantity of our sprites to sizes of power of 2 has fixed a lot of the problem. But sometimes we still get code 3's when loading our old scenes where we have not converted all the sprites.As we go through our sprites and reformat them, i have a worrying question. Is there a limit to the number of sprite materials the xbox360 can handle?
At the moment we are numbering about 120 sprite materials, some materials used for static sprites others for animated. I am wondering if you guys have used more or less for your xbox xna torque games.
Thanks
Ray
#7
120 is a small number, nothing to be worried about. Be sure to DXT compress all of them (they must be multiple of 4 in size) or at least the big ones. To activate the DXT compression just select the textures in Visual Studio and go in the Property pane, expand the Content Processor and change the Texture Format from Color to DXTCompressed.
To avoid memory fragmentation and reduce the loading time try to maximize the usage of sprite-sheets. The maximum size I've used so far is 4096x4096 without any problem.
Cheers,
Pino
07/26/2010 (11:59 pm)
Hey Ray,120 is a small number, nothing to be worried about. Be sure to DXT compress all of them (they must be multiple of 4 in size) or at least the big ones. To activate the DXT compression just select the textures in Visual Studio and go in the Property pane, expand the Content Processor and change the Texture Format from Color to DXTCompressed.
To avoid memory fragmentation and reduce the loading time try to maximize the usage of sprite-sheets. The maximum size I've used so far is 4096x4096 without any problem.
Cheers,
Pino
#8
Thanks so much for that little tutorial. All those pesky code 3's went away.
Thanks again
Ray
07/27/2010 (12:55 am)
Ah Pino, where would we be without you. Thanks so much for that little tutorial. All those pesky code 3's went away.
Thanks again
Ray
#9
07/27/2010 (1:03 am)
Glad to hear that ;)
Torque Owner Christopher Perkins