Porting to iTGB (iPhone)
by Rachel P · in Torque Game Builder · 03/23/2009 (9:29 pm) · 11 replies
Hello everyone! Apologies for the question, but I cant seem to find a tutorial. I know I can make a game using TGB and then use iTGB to port it to iPhone, but is there a way to insert special coding that takes use of the iPhone's features (like touchscreen) into TGB or do I have to wait to do that until I get iTGB? How exactly does the transition work? For example, say in TGB I have it where you mouse click on something, yet on iPhone I need it so the user can just tap on it... How easy will it be to make that transition, coding-wise?
Just a basic explanation would be very much appreciated. Thanks guys!
Just a basic explanation would be very much appreciated. Thanks guys!
About the author
#2
Plus, really, I'd recommend just getting your game running in TGB. Keep it light on the script where you can. Porting to iTGB is fairly simple.
03/24/2009 (2:29 pm)
Agreed with Ronny on those points. Plus, really, I'd recommend just getting your game running in TGB. Keep it light on the script where you can. Porting to iTGB is fairly simple.
#3
I'll take your advice and construct my game using TGB right now (since I can't really pay $500 for iTGB at the moment anyway =P) and then port it. Just curious, is there any online guide or FAQ regarding porting things to iTGB that I could look at for reference? I am pretty much making this game with the iPhone in mind (I would use the native iPhone SDK and xcode, but this seems to be easier) so I want to make sure I'm doing things appropriately with that in mind.
03/25/2009 (4:43 pm)
Thanks for the responses!I'll take your advice and construct my game using TGB right now (since I can't really pay $500 for iTGB at the moment anyway =P) and then port it. Just curious, is there any online guide or FAQ regarding porting things to iTGB that I could look at for reference? I am pretty much making this game with the iPhone in mind (I would use the native iPhone SDK and xcode, but this seems to be easier) so I want to make sure I'm doing things appropriately with that in mind.
#4
Also, make sure to design you game in such a way that it would work on a 320x480 or 480x320 screen (iPhone resolution), and make you GUIs easily scalable to that size.
03/25/2009 (5:37 pm)
Try not to do a lot of computation/math in your scripts, particularly if they get called every frame (use onUpdate() sparingly) and porting should be simple once you get there.Also, make sure to design you game in such a way that it would work on a 320x480 or 480x320 screen (iPhone resolution), and make you GUIs easily scalable to that size.
#5
03/26/2009 (6:37 pm)
I hear some complaints about frame rate issues when compared to other iPhone engines, will what Mat has suggested make a real difference to the frame rate so that iTGB becomes a contender for iPhone development? I haven't quite followed this issue closely so maybe it's not as bad anymore for starters.
#6
03/26/2009 (7:22 pm)
@Pac.... Yes, pulling script out of a main loop most certainly helps. Once I'd ported over my code hot spots from script to C++, I saw a 150% improvement in FPS.
#7
If I'm interperating what you said correctly, Chris, the game will run faster on the iPhone if the coding is in C++? Or is that just for certain scripts (such as, as mentioned, scripts that update every frame, etc)?
Sorry for the newbie-ish questions... I just really want to begin developing my game for the iPhone, and TGB/iTGB seems like a great way to do it assuming it will work correctly when ported! :)
03/27/2009 (3:14 pm)
Question... since I just bought TGB last fall and haven't used it in several months, I'm a bit rusty on my knowledge. Is there a way to automatically translate the native torque script to C++? One of, if not the, main reasons I'm using TGB for my iPhone game development is because C++ is too complicated for me right now since it goes beyond game code. If I'm interperating what you said correctly, Chris, the game will run faster on the iPhone if the coding is in C++? Or is that just for certain scripts (such as, as mentioned, scripts that update every frame, etc)?
Sorry for the newbie-ish questions... I just really want to begin developing my game for the iPhone, and TGB/iTGB seems like a great way to do it assuming it will work correctly when ported! :)
#8
In addition to what Rachel asked it'd be interesting to hear any FPS numbers from people who's done development for the iPhone. At the moment I'm under the impression a fully scripted game with a simple onUpdateScene (casting collisions for 1-4 objects) would run around 10-15 fps.. I understand that it's impossible to tell what to expect but still, would be good to hear some numbers.
If your game is out there on the app store it'd be interesting to check it out. Just need the name and you'll be a few dollars richer. :)
I would really love to see my game on the iPhone, and not having to rewrite it in other engines sounds great. Having to rewrite it in C++ sounds less than great for me. Haven't dabbled in it at all but can imagine it'd take a while to get your head around it for someone just starting to look at that side of TGB.
03/28/2009 (9:25 am)
Thanks Chris for the reply.In addition to what Rachel asked it'd be interesting to hear any FPS numbers from people who's done development for the iPhone. At the moment I'm under the impression a fully scripted game with a simple onUpdateScene (casting collisions for 1-4 objects) would run around 10-15 fps.. I understand that it's impossible to tell what to expect but still, would be good to hear some numbers.
If your game is out there on the app store it'd be interesting to check it out. Just need the name and you'll be a few dollars richer. :)
I would really love to see my game on the iPhone, and not having to rewrite it in other engines sounds great. Having to rewrite it in C++ sounds less than great for me. Haven't dabbled in it at all but can imagine it'd take a while to get your head around it for someone just starting to look at that side of TGB.
#9
03/28/2009 (12:50 pm)
Like Mat said, where and what dictates whether scripts are slow. It might be better to design a reactive engine, with objects responding to events, rather than trying to have what's basically a second mainloop in script.
#10
Thank you for explaining! :)
03/28/2009 (3:55 pm)
Ah, I believe I understand. I had started designing a regular game using TGB several months ago, and as I look back through the coding, I see that it appears to be a "reactive engine" like you said, where objects respond to events (such as collisions, etc). So if I stick with that, I should be fine, eh? Cool! I don't think I'll be needing to use a script that requires updating each second (can't think of what I would use that for), so I should be good.Thank you for explaining! :)
#11
I don't have a game in the app store, but here's a video of me playing my racing prototype on an iPod touch. It's pretty smooth, imo.
03/28/2009 (5:49 pm)
There is no automatic tool for converting script to C++. Ronny is correct that a good starting point is simply to not have a main loop. For me, I had a game that required it. But even then, I got it up to 26 FPS with a little effort. So I think if you're careful and do things right, frame rate really isn't an issue. Just remember you're in the mobile context; minimal is better!I don't have a game in the app store, but here's a video of me playing my racing prototype on an iPod touch. It's pretty smooth, imo.
Torque 3D Owner Ronny Bangsund
Torque Cheerleaders