Game Development Community

Cannot create t2dImageMapDatablock within new thread?

by Justin Mosiman · in Torque Game Builder · 06/09/2009 (3:30 pm) · 1 replies

Note: I am building with iTGB, but this looks like it is a TGB specific problem so that's why I am posting it here. I am building on my Windows computer.


In my game, I have a lot of datablocks that need to be loaded. Due to the speed of the iPhone/iPod Touch, I want to load these datablocks within a new thread during runtime. If I don't do this, the loading time is extremely long. I have created a new thread (via "new Thread()"), and I am trying to execute a torque script function that creates a new t2dImageMapDatablock. When this function is not run from the new thread, it does not run with any errors. However, when I try to run this function within a new thread, my game quits with the error:

Quote:
Fatal: (c:\documents and settings\justin mosiman\my documents\game\engine\source\console\compiledeval.cc @ 4986) String stack not popped enough in script exec
1339
keyboard0 input device unacquired.
DirectInput deactivated.
ImageMap(BaseImageMap)SrcBitmap(game/data/images/spriteSheet.png) Error: 'Reported Maximum Hardware Texture Size is invalid!' (11)

Is there a reason why I cannot create a new t2dImageMapDatablock within its own thread? If I do something else within this function (such as just echoing text), then I have no errors. Because of this, I am pretty sure that it is specific to creating a new t2dImageMapDatablock.

Thanks,
Justin

#1
06/09/2009 (5:01 pm)
You have to make sure that the subsystems you are using are actually thread-safe. AFAIK none of the higher-level systems in iTGB/TGB are equipped for multithreaded use.