Game Development Community

Problems with mounted objects?

by Adam Johnston · in Torque Game Builder · 12/02/2005 (5:26 pm) · 16 replies

This seems very weird... and I don't know if this is a problem with my code or the engine.
Is there a possibility that the mounted objects could crash T2D when
the t2dSceneWindow is changed? I was fighting with this misterious crashing
without luck today. I have mounted lines to the "enemies" in order to see
their visibility and othere params, when I want to change a level I delete all the enemies
and the mounted sprites are deleted automatically. Sometimes everything works fine, sometimes
T2D crash without complain.
Someone has experienced the same?

#1
12/03/2005 (5:22 am)
I have created a class ExtSprite in C++ that is composed of t2dSceneObject for the physical representation and a t2dAnimatedSprite for the visual representation. Extsprite is derived of t2dSceneObject and automatically creates and mounts the t2dAnimatedSprite in its constructor. When deleting the Extsprite T2D would sometimes crash when the t2dAnimatedSprite was owned by ExtSprite. But maybe these is not due to a bug but just some failure in my code. Everything in early prototyping state, so I haven't looked into this problem, just let the t2dAnimatedSprite leak.
#2
12/03/2005 (6:39 am)
@Adam: Could you run a debug-build and let me know exactly where it crashes?

- Melv.
#3
12/04/2005 (6:13 pm)
@Melv: Ok Melv I would do it tomorrow because I don't have VC++ 2003 here.
By the way: Is safe to create two instances of a t2dSceneWindow object?
#4
12/05/2005 (1:09 am)
Absolutely, they're just a GUI object like any other. T2D doesn't impose a strict limit on any of its objects, including scene-graphs and scene-windows.

- Melv.
#5
12/05/2005 (9:14 am)
Ok Melv I was able to get the error in debug mode...

I guess this is the script that trows the error. I'm deleting the "enemies" of the SimSet
and after that deleting the simset itself. (I don't know if this is safe)

function gameGeneric::freeEnemies (%this)
{
	if (isObject ($go_enemySet))
	{
		%numEnemies = $go_enemySet.getCount ();
		for (%k = %numEnemies - 1; %k >= 0; %k--)
		{
		   %enemy = $go_enemySet.getObject (%k);
		   %enemy.free ();  // see below
		}
		$go_enemySet.delete ();
	}
}

function chaActor::free (%this)
{
	// free action
	if (isObject (%this.gpx.action))	{ %this.gpx.action.free (); }
	// free arm
	if (isObject (%this.arm))			{ %this.arm.free (); }
	// gpx isn't deleted automatically
	%this.gpx.safeDelete ();
	// delete this object
	%this.delete ();
}


ERROR: this is the error that jumps (in spanish), It says just an uncontrolled exception, I guess a bad pointer.

[error ]
Excepci
#6
12/06/2005 (12:25 am)
Adam,

Thanks for the report. We've seen this before a merge with TGE v1.4 and we suspected it may be related to the merge; looks like it isn't. There's already an issue to look at this problem as a certain game-studio has encountered the problem as well.

I'll report back here when we've got the solution.

- Melv.
#7
12/06/2005 (12:51 am)
In the meantime, I've sent you an email with the latest t2dSceneGraph; could you replace the one you have in the alpha#1 and see if the problem persists?

Any help you could provide would be great.

Thanks,

- Melv.
#8
12/06/2005 (9:25 am)
Hi Melv. I've tested with the files you
sent to me. And I was unable to catch
the error in debug mode
I was happy until I tried with the release mode
and T2D crashed again. So I guess the problem
is still there...
Maybe is associated with this problem
but sometimes the mounted lines
aren't deleted and are still visible when the
owner objects are deleted. T2D don't crash
when this happens but there is no way to delete
this lines then.
Regards.
#9
12/06/2005 (11:29 am)
@Adam:

Is there anything you could send me that duplicates the problem? I'm extremely worried about this problem and it's been reported a few times on other projects almost at random.

I'd be eternally grateful of any help you could provide.

- Melv.
#10
12/06/2005 (2:03 pm)
Melv, in the "little" level I'm doing to test the physics with you
I was unable to reproduce the crash. Weird... even in my "real"
project the bug is hidding now, but I know it is still there. (As I reported previously)
Please give a little more time to add the scenewindow2D changes that uses
my game in order to see if I can reproduce this.
I'm pressed here, so give a little more time.
I'm really worried about this too.
Sadly my actual game uses a lot of art of a third part
that I'm not allowed to distribute in any way.
If it were in my hands I would send you the game
without hesitation. After all you are the creator of all this.

I'm suspecting that the crash happens only in big levels
when memory leaks arise from the darknes.
#11
12/06/2005 (11:10 pm)
Adam,

No problem. Are you absolutely sure that the crash was related to the same problem though? Did you do a full build in RELEASE after you included the files? Perhaps it didn't compile correctly? If it's "hiding" now, what has changed? Did you perhaps do a new build?

If you could let me know how you get on though, I'd appreciated it as I'd like to report back to some other projects who are having similar problems.

The code should definately stop dead objects from causing a problem but if it's corruption then the problem could be elsewhere.

Thanks for your help!

- Melv.
#12
12/07/2005 (3:30 am)
Just to note that this issue referenced as issue #773.

- Melv.
#13
12/07/2005 (8:31 am)
Hi Melv, I rechecked and rebuilt all the project in debug mode
and I was lucky(?) enough to get the crash in debug mode, is still in the same place but
with the new changes you have done. Here the stack:

T2D_DEBUG.exe!BitSet32::test(const unsigned int m=3) L
#14
12/07/2005 (8:36 am)
That's not good. It's looking like something's getting corrupted, eek.

Darn it; I wish I could produce this here.

- Melv.
#15
12/09/2005 (5:09 pm)
Melv, I found something interesting this afternoon, when testing my arms-editor
I found that T2D was crashing inmediately loading the level. I launched T2D in
debug mode and found this in the call stack:

T2D_DEBUG.exe!strlen() L
#16
12/10/2005 (7:37 am)
@Adam: There's probably a problem with "bindCmd" being passed empty strings or something; this is a core-engine thing. It probably would've been best to post this in a seperate thread as it's not really got anything to do with the previous problem. I'll try to do something similar to see what's wrong; maybe this bug has been fixed in TGE v1.4?

- Melv.