SVN bugs / Oddities Found, current build

SVN bugs / Oddities Found, current build

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

SVN bugs / Oddities Found, current build

Post by Argh »

Firstly, yes, I will post in Mantis... this is for everybody to double-check... I'm testing SVN, have already found some buggy stuff:

1. Spin

Spin does not seem to work at all, if called in Create(). Tried multiple variations to test :?

If called outside Create(), it seems to be OK. However, using call-script in Create() doesn't work, so I have to invoke it and then use a repeating script with a timing function, which is rather inefficient for something I want to call exactly once.

Since I have fairly complex events called in Create() in PURE, it is a good test environment. If you don't have a copy, and are a Spring developer wanting to test this, PM me. Everything else seems to be working just fine, dunno why spin is borked.

Will post in Mantis, but that's kind've a biggie, think everybody should test.


2. StartMoving() Calls

I use direct access to a variable set to 0 or 1 by StartMoving() scripts, instead of using variants of MotionControl() for any Units I can get away with it. However, in SVN, this doesn't seem to work right- StartMoving doesn't seem to be getting called for at least one SlowUpdate, and it may be longer. HOWEVER! MotionControl scripts, which also rely on that on/off state, are working perfectly! Therefore, the state is changing, but StartMoving() is either not being called during that frame, or something else is borked.

Did somebody change that behavior in the COB interpreter, calling MotionControl directly? If so, you've just broken a lot of scripts, and not just in my project! I don't really mind, but please, don't do that without public discussion next time, k?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

3. Flamethrowers

Ok, so... er... did everything I patched in flameWeapon get done, or what? I can see that they can interact with trees now(awesome!). Anything else I should know about?

[correction] Groundbounce=0 doesn't work, flameWeapons still bounce even if set to 0. Ah well, at least they can set Trees on fire now...

4. Vertical-Launch Missiles

Is it just me, or do verti-launch missiles no longer strictly obey WeaponTimer?

[correction] Hrmm, now they obey it, but with more strictness / correctness than they seem to have before. KDR, was this one of the things you tweaked? No major problem, insofar as PURE is concerned, I only have one weapon that uses this... but it'll probably effect the alphabet-soup mods rather strongly.
Last edited by Argh on 04 Nov 2007, 16:47, edited 2 times in total.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

5. Beamlasers

Beamlasers now obey CollideFriendly / CollideFeature!

Great!
tombom
Posts: 1933
Joined: 18 Dec 2005, 20:21

Post by tombom »

Are you sure spin doesn't work? I just tried with Kernel Panic Division Zero and it looks like it's working, although I'm not certain because I'm not entirely sure about how BOS works.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Spin works, just not when called during Create(). Sorry, if that wasn't 100% clear.

For example, spin works just fine if called during StartMoving() (whereas, for whatever reason, variables that get turned on/off there don't seem to be working quite right now... grr), however, if you write a script that reads:

Code: Select all

Create()
{
  spin Piece around y-axis speed <15>;
}
Then it doesn't work...
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Wait... open mouth, insert shoe... strictly speaking, it does work, if I comment out everything else in my Create() script :oops:

So, I guess I'll need to do some more testing, and figure out what's actually causing this one... sorry...
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Aha! It's the RAND assignment to a local-var, I think... <does more testing>



Hrmm... this is truly weird.

This script should (and used to) result in slow, randomized revolutions of my Piece around the x-axis, when run during Create():

Code: Select all

RandomSeed2 = RAND(15,40);
spin ring around x-axis speed <1>*RandomSeed2;
Now, with everything else in Create(), it results in very fast rotations- almost as if during Create(), Spring hasn't initialized the angular constants yet. Yes, I've checked, and re-checked, my Scriptor settings...



Took out everything else in Create()... and now it acts normally. Very weird! It's almost like that local-var is not getting initialized properly, so it ends up with some bizarre, super-high number... yet, nothing else in the script ever refers to RandomSeed2, as you can see:

Code: Select all

Create(RandomSeed, RandomTurn, RandomSeed2)
{
	RandomSeed2 = RAND(25,40);
	
	hide base; 
	hide body; 
	hide ring; 
	hide storage; 
	hide support_l; 
	hide support_r; 
	hide miner_fx;

	RandomTurn = rand(1, 65535);
	turn base to y-axis RandomTurn now;

////////////////////////////////////////////////////START BUILD CYCLE
	RandomSeed = RAND(50,100);
	move body to y-axis [3000] now;

	while( get BUILD_PERCENT_LEFT )
	{
		spin centroid around y-axis speed <300> / get BUILD_PERCENT_LEFT;
		spin centroid around x-axis speed <300> / get BUILD_PERCENT_LEFT;		
		emit-sfx BUILDING_PROGRESSIVE from buildpoint_one;
		emit-sfx BUILDING_PROGRESSIVE from buildpoint_two;
		emit-sfx BUILDING_PROGRESSIVE from buildpoint_three;
		sleep RandomSeed;
	}

////////////////////////////////////////////////////DROP, FIRE, SMOKE	
	
	stop-spin centroid around y-axis;

	show base; 
	show body; 
	show ring; 
	show storage; 
	show support_l; 
	show support_r; 

	play-sound("Argh_BombDrop",50);

	move body to y-axis [32] speed [1500];
	wait-for-move body along y-axis;
	play-sound("Argh_PlasmaBomb",50);
	emit-sfx BUILDING_COMPLETE from buildflare1;
	emit-sfx BUILDING_COMPLETE from buildflare2;
	emit-sfx BUILDING_COMPLETE from buildflare3;
	emit-sfx BUILDING_COMPLETE from buildflare4;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare1;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare2;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare3;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare4;		
	sleep 150;			
	move body to y-axis [16] speed [50];
	wait-for-move body along y-axis;
	play-sound("Argh_PlasmaBomb",50);	
	emit-sfx BUILDING_COMPLETE from buildflare1;
	emit-sfx BUILDING_COMPLETE from buildflare2;
	emit-sfx BUILDING_COMPLETE from buildflare3;
	emit-sfx BUILDING_COMPLETE from buildflare4;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare1;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare2;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare3;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare4;		
	sleep 150;		
	move body to y-axis [0] speed [25];
	wait-for-move body along y-axis;
	play-sound("Argh_Clomp",50);	
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare1;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare2;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare3;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare4;		
/////////////////////////////////END BUILD CYCLE
	start-script SmokeUnit_GPL();
	start-script MinerFX();
	spin ring around x-axis speed <1>*RandomSeed2;

}
I guess the next step is to re-check, using a static-var... I hope that static-var works, because otherwise, we have a very serious problem here...
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Well, the good news is that it works... with a static-var. Which, for something like this, isn't a big deal, I'll just patch a few scripts. However, it does appear that local-vars aren't being initialized properly now- the first two values seem to work, but the third one doesn't... lemme see if it's the RANDs or just the fact that I'm using three values (I use a lot of local-vars, so this is a big deal to me).
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

It's not the RANDs, it's the third variable... and since, byte-code-wise, it's just "local-var 3", when compiled, that's a serious problem. I'm going to test reversing the order really quick, recompile, and test, to be 100% positive...
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Oh, now I am confused! When written this way, I get randomly-turned buildings, but instead of very, very slowly-turning Rings, they're all spinning fairly fast, at identical speeds! Which should be impossible.

Code: Select all

Create(RandomTurn, RandomSeed2, RandomSeed)
{
	RandomSeed2 = RAND(1,4);
	
	hide base; 
	hide body; 
	hide ring; 
	hide storage; 
	hide support_l; 
	hide support_r; 
	hide miner_fx;

	RandomTurn = RAND(1,65535);
	turn base to y-axis RandomTurn now;

////////////////////////////////////////////////////START BUILD CYCLE
	RandomSeed = RAND(50,100);
	move body to y-axis [3000] now;

	while( get BUILD_PERCENT_LEFT )
	{
		spin centroid around y-axis speed <300> / get BUILD_PERCENT_LEFT;
		spin centroid around x-axis speed <300> / get BUILD_PERCENT_LEFT;		
		emit-sfx BUILDING_PROGRESSIVE from buildpoint_one;
		emit-sfx BUILDING_PROGRESSIVE from buildpoint_two;
		emit-sfx BUILDING_PROGRESSIVE from buildpoint_three;
		sleep RandomSeed;
	}

////////////////////////////////////////////////////DROP, FIRE, SMOKE	
	
	stop-spin centroid around y-axis;

	show base; 
	show body; 
	show ring; 
	show storage; 
	show support_l; 
	show support_r; 

	play-sound("Argh_BombDrop",50);

	move body to y-axis [32] speed [1500];
	wait-for-move body along y-axis;
	play-sound("Argh_PlasmaBomb",50);
	emit-sfx BUILDING_COMPLETE from buildflare1;
	emit-sfx BUILDING_COMPLETE from buildflare2;
	emit-sfx BUILDING_COMPLETE from buildflare3;
	emit-sfx BUILDING_COMPLETE from buildflare4;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare1;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare2;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare3;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare4;		
	sleep 150;			
	move body to y-axis [16] speed [50];
	wait-for-move body along y-axis;
	play-sound("Argh_PlasmaBomb",50);	
	emit-sfx BUILDING_COMPLETE from buildflare1;
	emit-sfx BUILDING_COMPLETE from buildflare2;
	emit-sfx BUILDING_COMPLETE from buildflare3;
	emit-sfx BUILDING_COMPLETE from buildflare4;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare1;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare2;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare3;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare4;		
	sleep 150;		
	move body to y-axis [0] speed [25];
	wait-for-move body along y-axis;
	play-sound("Argh_Clomp",50);	
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare1;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare2;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare3;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare4;		
/////////////////////////////////END BUILD CYCLE
	start-script SmokeUnit_GPL();
	start-script MinerFX();
	spin ring around x-axis speed <1>*RandomSeed2;

}
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

This is getting even more interesting. This script results in no spinning of Ring at all, although the Turns and Moves are executing properly. Note that I changed the order of the local-vars again.

Code: Select all

Create(RandomSeed2, RandomTurn, RandomSeed)
{
	RandomSeed = RAND(50,100);
	RandomSeed2 = RAND(15,40);
	RandomTurn = RAND(1,65535);
	sleep 1;	
	
	hide base; 
	hide body; 
	hide ring; 
	hide storage; 
	hide support_l; 
	hide support_r; 
	hide miner_fx;

	turn base to y-axis RandomTurn now;

////////////////////////////////////////////////////START BUILD CYCLE
	move body to y-axis [3000] now;

	while( get BUILD_PERCENT_LEFT )
	{
		spin centroid around y-axis speed <300> / get BUILD_PERCENT_LEFT;
		spin centroid around x-axis speed <300> / get BUILD_PERCENT_LEFT;		
		emit-sfx BUILDING_PROGRESSIVE from buildpoint_one;
		emit-sfx BUILDING_PROGRESSIVE from buildpoint_two;
		emit-sfx BUILDING_PROGRESSIVE from buildpoint_three;
		sleep RandomSeed;
	}

////////////////////////////////////////////////////DROP, FIRE, SMOKE	
	
	stop-spin centroid around y-axis;

	show base; 
	show body; 
	show ring; 
	show storage; 
	show support_l; 
	show support_r; 

	play-sound("Argh_BombDrop",50);

	move body to y-axis [32] speed [1500];
	wait-for-move body along y-axis;
	play-sound("Argh_PlasmaBomb",50);
	emit-sfx BUILDING_COMPLETE from buildflare1;
	emit-sfx BUILDING_COMPLETE from buildflare2;
	emit-sfx BUILDING_COMPLETE from buildflare3;
	emit-sfx BUILDING_COMPLETE from buildflare4;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare1;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare2;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare3;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare4;		
	sleep 150;			
	move body to y-axis [16] speed [50];
	wait-for-move body along y-axis;
	play-sound("Argh_PlasmaBomb",50);	
	emit-sfx BUILDING_COMPLETE from buildflare1;
	emit-sfx BUILDING_COMPLETE from buildflare2;
	emit-sfx BUILDING_COMPLETE from buildflare3;
	emit-sfx BUILDING_COMPLETE from buildflare4;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare1;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare2;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare3;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare4;		
	sleep 150;		
	move body to y-axis [0] speed [25];
	wait-for-move body along y-axis;
	play-sound("Argh_Clomp",50);	
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare1;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare2;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare3;
	emit-sfx BUILDING_SMALL_COMPLETE from buildflare4;		
/////////////////////////////////END BUILD CYCLE
	start-script SmokeUnit_GPL();
	start-script MinerFX();
	spin ring around x-axis speed <1>*RandomSeed2;
}
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Oh, I guess this is the kicker:

The code that calls for Spin, that is relying on GET BUILD_PERCENT_LEFT works just fine.

So, it's not Spin that's broken. It's either RAND, which seems to be just fine, because it's working on the part that calls for TURN, just fine... or something is wrong with assigning values to local-vars. Hopefully, this is just limited to Create()... trust me, this wasn't happening before...
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

RAND is fine. I need to do more tests to make sure that multiple local-vars aren't broken anywhere but Create().
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

I'll post this in AI, too:

KAIK 0.13 doesn't know what to do with PURE yet :P

AAI plays PURE so badly, it's hilarious. Need to get it to Submarine soon, see if he'll fix it.

No NTAI build for SVN? Shame. Same for RAI... those guys need to open their source, it's the AI I've had to rely on for testing with random AIs, since KAIK and AAI fall flat on their faces...
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

Code: Select all

Create(RandomTurn, RandomSeed2, RandomSeed) 
{
Change that to

Code: Select all

Create()
{
var RandomTurn, RandomSeed2, RandomSeed;
...not sure why you're declaring local vars as non-existent parameters for Create(). Also, the variables are mislabled, as a random seed is a number that is used to create random numbers. Call them RandomNumber and RandomNumber2 :P
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Upon creating a parameter, it is supposed to be initialized with a value of 0. And you should be able to manipulate it, just like a local-var. That's because, insofar as the byte-code is concerned, a parameter for a given function and a local-var are both interchangeable, IIRC.

That's how it has always worked in BOS, if it's been changed, I'd like to know why someone thought that was a good idea.

Again, this code works PERFECTLY in 0.75b2, as it was written.

Now, that said... I'll go test it, written as suggested, and see what happens.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

I've tested it, and it still doesn't work correctly, when written as suggested. I get a uniform speed assigned to my Spin command, that should instead be looking at the value of RandomSeed2.
Last edited by Argh on 04 Nov 2007, 18:59, edited 1 time in total.
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

spin might be broken then, which would be my fault.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

I don't care whose fault it is, Peet. I'm not angry, just worried that I'm going to have re-write a lot of code in PURE.

What were you trying to do?
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

It was a minor edit to cobinstance.cpp, supposedly removing the default spin acceleration and instead instantly reaching full speed...either there was a miscommunication between myself and the dev who committed, or I'm simply doin' it wrong. I'll give you more info when I find the rev in which this occurred.
Post Reply

Return to “Engine”