Game Development Community

Hanging program

by Crystal Pegasus · in Technical Issues · 12/11/2008 (10:27 pm) · 4 replies

Hi,

I am programming an interaction between bots. One side replicates when it kills another bot upon collision with it. The other side keeps replicating indefinitely, so long as it is near a food source.

The problem I am getting is that program "hangs" and I need to do a "force quit" on it. I think it is either to do with copying the bot, deleting it, or perhaps the collision response (e.g. having too many "send collisions"??.... yes I have read the tutorial on collisions).

%dstObj.safeDelete();
%this.cloneWithBehaviors();

Can someone please shed light on this problem. I am pretty much tearing my hair out, so if someone could help out, that would be great.

Thanks.

#1
12/11/2008 (10:56 pm)
Which engine are you using? I read your problem like you're using TGB -- if so I'm not all that familiar with it but it may be trying to replicate an infinite number of bots, or if not infinity then a higher number than the engine can count. Depending on the number of bots, collision responses can add up quickly. Another possibility is that you may be trying to delete something that the engine has already lost it's reference to (ie. after you kill something).

Can you determine for which set of the bots that the problem stems from?
#2
12/11/2008 (11:28 pm)
Hi,

Thanks muchly for looking at my problem.

I am currently working in TGB, scripting.

The problem occurs for a small number of bots, as well as a large number. I have encountered problems when bots fill the screen, and would ascribe that to the collision detection modalities.

I think I have narrowed down the problem to the handles obtained in the onCollision function. I have commented out the following, and it seems to work. Though I haven't run it for a couple of minutes.

// %dstObj.safeDelete(); // Bot B
// %srcObj.pDivision(); // Check whether it can divide - Bot A

function BotA::pDivision(%this)
{
.....
}
#3
12/11/2008 (11:45 pm)
Hi,

Thanks muchly for looking at my problem.

I am currently working in TGB, scripting.

The problem occurs for a small number of bots, as well as a large number. I have encountered problems when bots fill the screen, and would ascribe that to the collision detection modalities.

I think I have narrowed down the problem to the handles obtained in the onCollision function. I have commented out the following, and it seems to work. Though I haven't run it for a couple of minutes.

// %dstObj.safeDelete(); // Bot B
// %srcObj.pDivision(); // Check whether it can divide - Bot A

function BotA::pDivision(%this)
{
.....
}
#4
12/12/2008 (12:45 am)
Hi silentMike,

I have fixed the weird problem. Thanks for your help.

The cause has taken me a day to find!! It was from the pDivision() function which had a .cloneWithBehaviours() function. This was confused with the behaviour 'spawnOnDelete', which had one child to be spawned when the parent was deleted. Go figure.

okies. Thanks and have a good day/evening.

Cheers.