Find the hidden error - GAME!

Find the hidden error - GAME!

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Find the hidden error - GAME!

Post by TradeMark »

Can you find the hidden error which causes crashes randomly when using high amount of units with this script?

Winner gets free lollipop!

Code: Select all

#define TA			// This is a TA script

#include "sfxtype.h"
#include "exptype.h"

piece  base, body, aim, emitnano;

static-var  Static_Var_1, Static_Var_2, statechg_DesiredState, statechg_StateChanging;


Activatescr()
{
	sleep 1;
}

Deactivatescr()
{
	sleep 1;
}

SmokeUnit(healthpercent, sleeptime, smoketype)
{
	while( get BUILD_PERCENT_LEFT )
	{
		sleep 400;
	}
	while( TRUE )
	{
		healthpercent = get HEALTH;
		if( healthpercent < 66 )
		{
			smoketype = 256 | 2;
			if( Rand( 1, 66 ) < healthpercent )
			{
				smoketype = 256 | 1;
			}
			emit-sfx smoketype from aim;
		}
		sleeptime = healthpercent * 50;
		if( sleeptime < 200 )
		{
			sleeptime = 200;
		}
		sleep sleeptime;
	}
}

Go()
{
	call-script Activatescr();
	turn aim to y-axis Static_Var_1 speed <160.000000>;
	wait-for-turn aim around y-axis;
	set INBUILDSTANCE to 1;
}

Stop()
{
	set INBUILDSTANCE to 0;
	call-script Deactivatescr();
}

InitState()
{
	statechg_DesiredState = TRUE;
	statechg_StateChanging = FALSE;
}

RequestState(requestedstate, currentstate)
{
	if( statechg_StateChanging )
	{
		statechg_DesiredState = requestedstate;
		return (0);
	}
	statechg_StateChanging = TRUE;
	currentstate = statechg_DesiredState;
	statechg_DesiredState = requestedstate;
	while( statechg_DesiredState != currentstate )
	{
		if( statechg_DesiredState == 0 )
		{
			call-script Go();
			currentstate = 0;
		}
		if( statechg_DesiredState == 1 )
		{
			call-script Stop();
			currentstate = 1;
		}
	}
	statechg_StateChanging = FALSE;
}

Create()
{
	call-script InitState();
	start-script SmokeUnit();
	Static_Var_1 = 0;
	Static_Var_2 = 5000;
}

RestoreAfterDelay()
{
	sleep Static_Var_2;
	turn aim to y-axis <0.000000> speed <100.000000>;
	wait-for-turn aim around y-axis;
}

Activate()
{
	start-script RequestState(0);
}

Deactivate()
{
	start-script RequestState(1);
}

StartBuilding(Func_Var_1)
{
	Static_Var_1 = Func_Var_1;
	start-script RequestState(0);
}

StopBuilding()
{
	start-script RequestState(1);
}

QueryNanoPiece(piecenum)
{
	piecenum = emitnano;
}

TargetHeading(Func_Var_1)
{
	Static_Var_1 = 0 - Func_Var_1;
}

SweetSpot(piecenum)
{
	piecenum = aim;
}

Killed(severity, corpsetype)
{
	if( severity <= 25 )
	{
		corpsetype = 1;
		explode base type BITMAPONLY | BITMAP1;
		explode aim type BITMAPONLY | BITMAP3;
		return (0);
	}
	if( severity <= 50 )
	{
		corpsetype = 2;
		explode base type FALL | BITMAP1;
		explode aim type FALL | BITMAP3;
		return (0);
	}
	if( severity <= 99 )
	{
		corpsetype = 3;
		explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
		explode aim type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
		return (0);
	}
	corpsetype = 3;
	explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
	explode aim type SHATTER | EXPLODE_ON_HIT | BITMAP3;
}
Seriously, thats armnanotc script, and ive noticed that it causes spring crash very often when im using many nanotowers at once.
Last edited by TradeMark on 08 May 2007, 20:06, edited 1 time in total.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Not really no. Try recompiling it as TAK script (#define TAK + TAK icon in scriptor) and see if it changes anything.
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Post by Neddie »

The issue is probably the large spikes of synced data you have to send due to the nanolathe, though I'm no expert. Oh, and there are more efficent ways to assist construction than with nanoturrets.
Last edited by Neddie on 08 May 2007, 20:43, edited 1 time in total.
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

That TA state script set is rather pointless, especially considering that there's no activation animation.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

neddiedrow wrote:The issue is probably the large spikes of synced data you have to send due to the nanolathe, though I'm no expert. Oh, and there are more efficent ways to assist construction than with nanoturrets.
It's a widespread myth, but nanolathe being synced does not mean any data has to be sent over the net for it. The only practical thing it means is that the amount of nanolathe particles can't be reduced to fit below your max particle count.
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Post by Neddie »

Well, then this entire thread has no point. I can't see any errors in the script, and none of the emergent factors would bear on the problem!
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

Same. The script is fine as it is.
P3374H wrote:That TA state script set is rather pointless
Yeah. If someone could engligthen us what it's actually good for...
User avatar
Dragon45
Posts: 2883
Joined: 16 Aug 2004, 04:36

Post by Dragon45 »

Make sure you're not SHATTER 'ing any point objects.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Post by zwzsg »

That was a TA issue, not a Spring one, afaik, Dragon45. And he never mentionned crashes when his nanoturret die, but when they are built in masses.



I was about to complain about how that script is uber ugly, then I unscripted a Cavedog ArmCK and it was almost as ugly. Try this simplified script:

Code: Select all

#define TA// This is a TA script

#include "sfxtype.h"
#include "exptype.h"

piecebase, body, aim, emitnano;


SmokeUnit()
{
	var healthpercent, sleeptime, smoketype;
	while( get BUILD_PERCENT_LEFT )
	{
		sleep 400;
	}
	while( TRUE )
	{
		healthpercent = get HEALTH;
		if( healthpercent < 66 )
		{
			smoketype = SFXTYPE_BLACKSMOKE;
			if( Rand( 1, 66 ) < healthpercent )
			{
				smoketype = SFXTYPE_WHITESMOKE;
			}
			emit-sfx smoketype from hull;
		}
		sleeptime = healthpercent * 50;
		if( sleeptime < 200 )
		{
			sleeptime = 200;
		}
		sleep sleeptime;
	}
}

Create()
{
	set INBUILDSTANCE to TRUE;
	start-script SmokeUnit();
}

StartBuilding(heading)
{
	turn aim to y-axis heading now;
}

QueryNanoPiece(piecenum)
{
	piecenum = emitnano;
}

SweetSpot(piecenum)
{
	piecenum=aim;
}

Killed(severity, corpsetype)
{
	if(severity<=25)
	{
		corpsetype=1;
		explode base type BITMAPONLY | BITMAP1;
		explode aim type BITMAPONLY | BITMAP3;
		return;
	}
	if(severity<=50)
	{
		corpsetype=2;
		explode base type FALL | BITMAP1;
		explode aim type FALL | BITMAP3;
		return;
	}
	corpsetype=3;
	explode base type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | 	BITMAP1;
	explode aim type SHATTER | EXPLODE_ON_HIT | BITMAP3;
	return;
}
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

The BITMAP flags are ignored by Spring and EXPLODE_ON_HIT means "do 20 damage to other units".
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Post by TradeMark »

Tobi wrote:
neddiedrow wrote:The issue is probably the large spikes of synced data you have to send due to the nanolathe, though I'm no expert. Oh, and there are more efficent ways to assist construction than with nanoturrets.
It's a widespread myth, but nanolathe being synced does not mean any data has to be sent over the net for it. The only practical thing it means is that the amount of nanolathe particles can't be reduced to fit below your max particle count.
So my spring crashes because those particles cant fit to my memory? I use low particle count anyways. But i havent noticed less crashes when ive used full particle count.
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Post by Neddie »

The point is that the nanoturrets can't be the cause. Next!
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Post by TradeMark »

It must be. :shock:

It happens so many times to me. When i start building with nanos, and then click -> spring crash.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Post infolog.txt w/ stacktrace?
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Post by TradeMark »

I dont save them anymore, because i was told they were useless.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Ah, because you spammed them on mantis yeah, didn't include any information regarding which mod/map, how to reproduce etc. and many (if not all) of them didn't contain a stacktrace at all...
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Post by rattle »

In regard to this someone should make a locked sticky thread about good and bad bug reporting. :)
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Post Reply

Return to “Game Development”