Game Development Community

Platformer issues on iPhone version 1.3 for Mac

by Dave Rushton · in iTorque 2D · 01/26/2010 (5:57 pm) · 7 replies

I have been using the parallaxObject, PlatformerCameraBehavior, and platformerControls behaviors from the Platformer tutorial on the web site. The behaviors and the rest of my game, work great when run in Torque Game Builder. When I put them on the iPhone device they won't run. If I use the autoScroll feature, the backgrounds freeze in place. If I don't use it, the parallaxing does not function at all. I am using parallaxing to hold some sprites in place(stationary on the screen) while also using it to scroll different background layers at different speeds. It looks amazing on TGB.
PlatformerControls appears to work fine. All of these functions worked great on version 1.2 and on 1.3 Beta. They no longer work correctly on version 1.3. I have used echo statements to make sure the functions (behaviors) are being called and are updating. Can anyone please shed some light on this?

#1
01/29/2010 (5:19 pm)
After several hours of debugging things it would appear that the parallaxing problems are tied to a problem with the camera code. When the PlatformerCameraBehavior tries to create an instance of the camera attached to the target, the t2dAnimatedSprite object has not yet been created giving me the dreaded "Unable to find object...." message. This process works correctly in the emulator, so the iPhone must exec files in a different order than the emulator (or so it would appear to my feeble mind). In the console it begins to exec the level.t2d file which contains the info on the sprite, calls the onAddToScene function, but the onAddToScene function is giving me the error of not being able to find the object. Can someone please give me an idea on how to solve this?
#2
01/29/2010 (5:43 pm)
Unfortunately there isn't a solution to this problem except coding checks in Update() to make sure that all the necessary interconnects between objects have been initialized correctly.

In my game I had a boolean for every behavior that was set to false in the constructor and set to true when the last dependency was resolved. I then would check this boolean in Update() and if it was false would attempt to look everything up. Until all dependencies were resolved the behaviors were disabled (every dependency found and it was also fully initialized).

It was a major PITA and I'd recommend not using behaviors at all (I wrote all new extensions to the engine as subclasses of t2dSprite/t2dStaticSprite etc instead of behaviors after discovering this fatal flaw) but unfortunately iTGB is broken in this arena. It can work perfectly and then you delete/re-added something to the scene and everything gets created/initialized in a different order.

I had a thread on it last year and Dave Calabrese tried to fix it but wasn't able to fully fix it. It's one, of many reasons, I decided to temporarily abandon iTGB until it's in a more functional and performant state (or hardware improves enough to not matter).
#3
01/29/2010 (8:29 pm)
Which engine would you suggest? We are going to be doing a whole series of games once I determine which way to go. I have heard that Game Salad is great and actually has customer service. We are currently using Unity for a couple of other large PC/Mac projects. Their customer service is non-existent.
#4
01/29/2010 (8:36 pm)
I have programmed on over 70 shipped console and handheld ( handhelds were primarily DS and PSP)titles over the past 14 years and this has been the most frustrating experience I have ever had in making a game. There is almost no support and the few answers you ever get always take it for granted that you know things that you don't. Very frustrating
#5
01/30/2010 (4:14 pm)
Did you check the TDN, TGB Section?
#6
01/30/2010 (5:39 pm)
I got the basic parallax object code from the behaviors section of it and the basic PlatformerCamerBehavior, and also got the controls basics from the platformer tutorial contained in the tutorial section. I have spent a lot of hours narrowing things down to the problem mentioned in the initial posting. It has been very painful as I have been working from a Mac (which I really dislike). On PC you have Torsion and MS Visual Studio. On Mac I have been using jEdit which would only suck if it got a lot better. When I have had problems working on Nintendo, MS, and Sony platforms I could always get help from someone including the hardware manufacturers. With Torque, you have some very useful developers who are nice enough to lend their expertise and if you are extremely lucky, someone from Garage Games will say something. This particular issue appears to be a Torque problem based on everything I have been able to find out. I have narrowed a very broad issue down to one specific problem but can see no way of fixing that problem without help from Garage Games. If I can't fix it, I need to move to another engine that can help me get it done, or write it from scratch. If there is a fix, please give me some very specific instructions on how to do it. Sorry for the rant, but my frustration level is very high at this point.
#7
01/31/2010 (2:49 am)
@Dave I use Unity right now and love it, the performance of it on the iPhone is outstanding and everything just works for me. I've only used iTGB and Unity so I can't recommend/compare to anything else.

Like I said iTGB doesn't have a guaranteed order of creation for Behaviors. You will get Updates on one behavior before the init's have been called on other behaviors. You have to manually code around this by checking if the object was found, and if not delay a frame and search for it again etc. It's a major PITA.

IE. All my behaviors have a doInit() function and in my Update functions I did:
if (!doInit())
return;

In my doInit() I'd initialize this class AND find any references to other classes. I removed all circular dependencies between behaviors and hand added checks in this method for dependent classes existing AND being initialized.

All my code was in C++ so your mileage may vary in script. I don't think you can realistically use Update's in script anyway because of performance issues so if your in script and having this problem I'm not sure it's even solvable.