Need help moving TGB project over to iTGB
by Jereis Zaatri · in iTorque 2D · 05/09/2010 (9:22 pm) · 9 replies
Hello,
==Background Info==
I'm working with a group of people on a game that originally started with TGB. The plan was that we would create the game and then port it, but after going over that topic in a prior thread I realized that might not work out that well. For one, trying to run the game with iTGB caused the game to hang. So now the plan is to port what we currently have and I was tasked with the job of porting it.
From what I understand from my fellow group members is that the game is based off the "Adventure Kit", so hopefully this gives a little bit of background to this problem I have with porting it.
==The Problem==
The game hangs after selecting a new game which is likely to be caused due to the loading of the level. After reading the documents it sounds like one of the culprits may be the loading of the data blocks. If this is the case does anyone know how to rework the loading of the data blocks for iTGB?
So far that's the only thing that comes to mind. If anyone knows anything else that needs to be changed, please let me know.
Thanks
==Background Info==
I'm working with a group of people on a game that originally started with TGB. The plan was that we would create the game and then port it, but after going over that topic in a prior thread I realized that might not work out that well. For one, trying to run the game with iTGB caused the game to hang. So now the plan is to port what we currently have and I was tasked with the job of porting it.
From what I understand from my fellow group members is that the game is based off the "Adventure Kit", so hopefully this gives a little bit of background to this problem I have with porting it.
==The Problem==
The game hangs after selecting a new game which is likely to be caused due to the loading of the level. After reading the documents it sounds like one of the culprits may be the loading of the data blocks. If this is the case does anyone know how to rework the loading of the data blocks for iTGB?
So far that's the only thing that comes to mind. If anyone knows anything else that needs to be changed, please let me know.
Thanks
#2
As for porting the game, I feel I'm a bit in over my head with this one. For one, that list would be nice. Quite frankly I don't have that great of an understanding of TGB. If you could break down the conversion into steps, that would help a lot, because quite frankly I don't know where everything is. Could the differences be broken down into categories: loading, controls, etc.
The biggest problem is that I have this abstract understanding of what's going wrong, but I don't know where to begin to fix it. So I guess the best way to solve this problem is to start with how exactly TGB and iTGB loads levels. Is there a specific place where this is all done?
05/09/2010 (10:58 pm)
Currently I'm using windows and the longer I stay away from the mac, the better. I've had too many frustrating moments with it.As for porting the game, I feel I'm a bit in over my head with this one. For one, that list would be nice. Quite frankly I don't have that great of an understanding of TGB. If you could break down the conversion into steps, that would help a lot, because quite frankly I don't know where everything is. Could the differences be broken down into categories: loading, controls, etc.
The biggest problem is that I have this abstract understanding of what's going wrong, but I don't know where to begin to fix it. So I guess the best way to solve this problem is to start with how exactly TGB and iTGB loads levels. Is there a specific place where this is all done?
#3
If your application is constantly crashing with the "TorqueGameBuilder has encoutered an error ... etc" that is a known problem. Not sure if this is what you're experiencing, but one problem is that whenever iTGB starts up it saves it's configuration. I use WinXP, and on my system iTGB saves a folder in the following location:
C:\Documents and Settings\Mark\Application Data\GarageGames
and in WinXP the folder name is:
\Torque Game Builder(iPhone)
For some reason this data gets corrupted, so you'll need to delete that folder before you open iTGB, otherwise it will crash. This doesn't happen on the Mac, but then the Mac version has other issues, which we won't go into at this point.
That was the first gotcha that I encountered, and I was amazed that it wasn't officially documented, but there you go. I eventually found the answer in the forums. So, that would be the first thing to look at.
Apart from that, the way that levels are loaded is, as far as I know, the same in TGB and iTGB, and you shouldn't experience any problems there. I'd start with the "iPhoneExample". Try deleting that folder that I mentioned, and then you should be able to open that project several times without any issues (just delete that folder before you try opening a project)
As far as execution goes, if you take a look at the "iPhoneExample" the first script to be executed is:
projectFiles\main.cs
which then calls the initialiseProject() function, which is in
\projectFiles\game\main.cs
followed by:
projectFiles\game\scripts\game.cs
which is where the level is loaded. This flow should be exactly the same in TGB and iTGB.
05/09/2010 (11:31 pm)
I agree about the Mac, I also try to use the windows version as much as possible, and I think that is the best place to start. Obviously, you won't be able to test any performance related issues there, but I still think it is the best place to start and the best place to get familar with the engine.If your application is constantly crashing with the "TorqueGameBuilder has encoutered an error ... etc" that is a known problem. Not sure if this is what you're experiencing, but one problem is that whenever iTGB starts up it saves it's configuration. I use WinXP, and on my system iTGB saves a folder in the following location:
C:\Documents and Settings\Mark\Application Data\GarageGames
and in WinXP the folder name is:
\Torque Game Builder(iPhone)
For some reason this data gets corrupted, so you'll need to delete that folder before you open iTGB, otherwise it will crash. This doesn't happen on the Mac, but then the Mac version has other issues, which we won't go into at this point.
That was the first gotcha that I encountered, and I was amazed that it wasn't officially documented, but there you go. I eventually found the answer in the forums. So, that would be the first thing to look at.
Apart from that, the way that levels are loaded is, as far as I know, the same in TGB and iTGB, and you shouldn't experience any problems there. I'd start with the "iPhoneExample". Try deleting that folder that I mentioned, and then you should be able to open that project several times without any issues (just delete that folder before you try opening a project)
As far as execution goes, if you take a look at the "iPhoneExample" the first script to be executed is:
projectFiles\main.cs
which then calls the initialiseProject() function, which is in
\projectFiles\game\main.cs
followed by:
projectFiles\game\scripts\game.cs
which is where the level is loaded. This flow should be exactly the same in TGB and iTGB.
#4
I guess a good way to narrow down the possibilities is to consider area unaffected by the move.
Is any of the stuff generated by TGB (not manually coded) affected by the move?
05/09/2010 (11:59 pm)
Well I can load TGB, the problem I encounter is when I run the game. I get the menu screen, but when I start a new game it hangs on the loading screen.I guess a good way to narrow down the possibilities is to consider area unaffected by the move.
Is any of the stuff generated by TGB (not manually coded) affected by the move?
#5
05/10/2010 (12:17 am)
Yes, that's what I meant. You can open iTGB, but when you try load a project or start a new game it crashes, right? If you are seeing that, it's the folder problem that I'm talking about. What version of Windows are you using?
#6
05/10/2010 (12:48 am)
XP, thanks for the info, I'll try it next time I boot up my windows computer. Personally Linux is my favorite, but I guess at some point Linux was no longer supported. I'll let you know how it goes.
#7
05/10/2010 (7:46 am)
@Jereis - Is it actually hanging? Are you able to open the console while the game is running?
#8
Also that fix didn't work, I deleted that folder with no effect.
05/10/2010 (11:08 am)
Nope, totally hangs. Can't even do cnrl alt del. My computer is frozen solid.Also that fix didn't work, I deleted that folder with no effect.
#9
Also, on one occasion iTGB crashed and hosed itself, something got corrupted and it wouldn't start after that. I reinstalled to fix that problem.
Once you get it running, you'll definitely need to use that folder-deletion trick, so don't forget about that.
05/10/2010 (9:45 pm)
The only thing I recall that caused it to hang was when I accidentally corrupted the managed datablocks file. If I remember correctly, an error message was posted in the console log. Take a look at the console.log file to see if there is anything there.Also, on one occasion iTGB crashed and hosed itself, something got corrupted and it wouldn't start after that. I reinstalled to fix that problem.
Once you get it running, you'll definitely need to use that folder-deletion trick, so don't forget about that.
Torque Owner Mark Davies
Porting from TGB to iTGB is actually not that hard once you understand the main differences. There are differences, if you try to run a TGB project in iTGB it will definitely crash. I would recommend that you start again with a completely blank iTGB project (I would take the "iPhoneExample" that ships with the engine) and then port your scripts and resources over to the new project.
One of the first things I did was to port the Breakout tutorial code from TGB to iTGB, and it didn't take long. I followed the PDFs that shipe with the engine, which describe some of the differences (the biggest being the way that datablocks are used), and the only major problem that I found was mouse support and how that gets mapped to the iPhone touch screen.
I've posted my Breakout port, so that might serve as a good stater reference. It's only a very basic app, but it does help to show how certain things are ported, such as porting from mouse to touch screen. Check out the post here:
http://www.torquepowered.com/community/forums/viewthread/115043
I'm not going to lie though, so I'm going to admit that developing with iTGB is definitely not as easy as using TGB. The current version of iTGB is buggy, but there are workarounds for most things. I can provide you with a list of some gotchas if you're interested. Some of these bugs are pretty major, and you'll need to know about them, otherise you'll just be frustrated.
From what you've tried so far, are you running iTGB in Windows or the Mac? There are different issues associated with both.
Thanks
Mark