Game Development Community

iT2D 1.4.1 - moveTo & onCollision & Static Audio - RESOLVED

by David Schlabach · in iTorque 2D · 04/03/2011 (11:57 am) · 16 replies

Question 1: Why do I have to setUsePhysics to true to be able to use moveTo in the iPhone simulator, it's not required in the regular torque simulator?

Question 2: Would setting use physics mess with onCollision? The use physics command doesn't seem to be causing problems in the torque simulator and the game works fine there, however in the iPhone simulator the collision detection is no happening.

Also, I still have static audio in the Torque simulator with 1.4.1 and no audio in the iPhone simulator.

-David


Build: 1.4.1 Release

(what platform/OS did this happen on?)
Platform: OS X 10.6.6, OS X 10.6.7, iTorque Simulator, iPhone Simulator (XCode 4) - (iOS 4.3)

(where is this bug happening?)
Target: Editors, iPhone Simulator

(what is the bug)
Issues: In the iTorque engine I get static, in the iPhone Simulator I get no sound

(tell us how to trigger the bug)
Steps to Repeat:
1. Run TGB editor.
2. Open my project
3. Run game from editor
4. Static
5. When running iTorque2DGame.app on Simulator I get no sound.

No Errors in log but here you go.
Console Log

Here is my code for audio
Audio Code

#1
04/03/2011 (12:19 pm)
1. It's an optimisation feature to increase performance on what is a weaker mobile platform in comparison to a PC. - When you say Torque simulator, do you mean when you click play in iTorque editor window? If so which platform?

2. Is it that the callback isn't triggering or that objects aren't physically reacting to the collision?
#2
04/03/2011 (12:55 pm)
1. It's an optimisation feature to increase performance on what is a weaker mobile platform in comparison to a PC. - When you say Torque simulator, do you mean when you click play in iTorque editor window? If so which platform?

>Yeah, within iTorque. Thanks I will remember to set that for my objects going forward.

2. Is it that the callback isn't triggering or that objects aren't physically reacting to the collision?
>The onCollision method isn't getting called. in iTorque it works find so I setup some debug echo calls.

iTorque
Echo..Object A moves towards B
Echo..Object A collides with B
Echo..Object A stops moving and starts attacking object B

Exact same .cs and .dso files but running in the iPhone simulator
Echo..Object A moves towards B

At this point object a just passes by b and keeps going. It's really weird.

#3
04/03/2011 (2:51 pm)
Quote:
>The onCollision method isn't getting called. in iTorque it works find so I setup some debug echo calls.

If the method is not being called, perhaps your onCollision Callback is not set. You can set via script or in the editor, collisions panel.
#4
04/03/2011 (3:50 pm)
But it's working when run directly from the Torque editor? Is there something else, kinds of like setUsePhysics to make onCollision work when running from the iPhone?

-David
#5
04/03/2011 (4:38 pm)
Well, I believe in the .t2d, you must set...

UsesPhysics = "1";

... Inside the objects code. UsesPhysics is different from setUsePhysics, I think.
#6
04/03/2011 (8:35 pm)
@David - So you have multiple things going on in this thread. I will try to tackle each one.

1. Not a bug, but an optimization. It is very much specific to running on an iOS device, but it can affect desktop games as well if not consistently toggled.

2. Do you have collision send and receive turned on for both objects, as well as Uses Physics enabled for both?

3. This is extremely worrying. This is the first I have heard of this happening with 1.4.1. I distinctly remembered fixing this for 1.4.1 and none of our demos are affected by this.

It is hard to figure out exactly what is going on. Could you reformat your post to use the Official Bug Reporting Standard?
#7
04/04/2011 (9:24 am)
I'll reformat my post tonight, also FYI setting physics on for the object being collided into resolved that problem. Thanks so very much! Guess I need to reread my itorque documentation.

-David
#8
04/05/2011 (2:52 pm)
Don't hurt to ask. Just dont make a habit of it. IDK. I use to ask all the time, but as I progress I need to ask less.



Works for me.

:))(
#9
04/05/2011 (3:41 pm)
@David - Thanks for reformatting. Can you post your AudioDescription, AudioProfile and the code you use to play the audio?
#10
04/06/2011 (3:14 pm)
Logged as ITGB-151.
#11
04/06/2011 (4:45 pm)
I've added my audio code above at the parent thread.
#12
04/06/2011 (4:52 pm)
@David - Thanks. Humor me and try replacing your code with the following to see if you get the same results:

new AudioDescription(NoLoopingTest)
{
   volume = 1.0;
   isLooping = false;
   is3D = false;
   type = 0;
};

new AudioProfile(SplashScreenAudio)
{
   filename = "game/data/audio/AnD_Games.wav";
   description = "NoLoopingTest";
   preload = true;
};

if ( $GAME::muteSounds == false )
{
   alxPlay(SplashScreenAudio);
}
#13
04/10/2011 (12:34 pm)
Yeah, I'm still getting static in the Torque editor
#14
05/25/2011 (1:03 pm)
Since getting the game to build on my Macbook pro, I now have sound in the iPhone simulator, however iTorque is still static. Now that audio was working in the xcode iphone simulator I thought maybe it would start working on my iPhone device.

Nope, no sound, I just kept getting audio profile X not found. So I looked throught the logs and noticed that when the game is run on the device the /Audio.cs file fails to compile with an invalid script file error. However the file compiles fine in the xcode simulator.

I stepped through the source code and sure enough, the script compile size for Audio.cs was 0.?.?.?
But only when run on my iPhone.......???????

So I poked around the forums and I tried:
Moving exec call to Audio.cs file to the top of main - Result: No Audio
I verified the Audio.cs file was UTF-8 formatted - Result: No Audio

I copied the contents of Audio.cs and create a new UTF-8 file and pasted the clipboard buffer into a new file, Audio2.cs. - Result: Boom, I had audio on my phone.

Talk about being. So, not liking Hacks I deleted the Audio.cs file verified no dso's existed and renamed the file from Audio2.cs to Audio.cs. I verified everything was in place compiled and sent to the device.

No Audio! Script File Invalid.

Is Audio.cs a reserved word?

Either way, I renamed the file back and I have audio again but I'm still curious as to way the file cannot be named Audio.cs.

-David
#15
07/08/2011 (5:36 pm)
So while trying to figure out why particles wouldn't work, I stumbled on why audio was static in the torque simulator.

When I had copied my project over from v1.3, I had not replaced the iTorque2DGame.app in my [projectFiles] folder.



---------To Make this Searchable------------
t2dPhysics::loadStream() - Invalid Stream Header ID!
t2dParticleEffect::loadEffect()

To reiterate, if you have installed a newer version of iTorque than what you started with, make sure to Delete the iTorque2DGame.app file in your [projectFiles] folder and replace it with one from the newer version of Torque.
#16
09/16/2011 (11:35 am)
That explains why we haven't been able to reproduce it. 1.3 still had that bug so the bug was just ported over accidentally then. If you recompile the Mac project that will replace the .app with the new code.