Flashers on missiles don't work in 1.72.2 - FIXED

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

I think you have nailed it Eric. Your analysis seems to be spot on. I will give a test with your OXP when I get home and if all OK the fix can go in (with full credit to you, of course).
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

same results however, i used an AI to spawn like this

Code: Select all

{
    "ON_HOLD" = {
    EXIT = ();
    UPDATE = ();
    };
    
    "SUMMON" = {        
        ENTER = (switchLightsOn, performIntercept); 
        EXIT = ();       
        UPDATE = ("spawn: EQ_FRAME_PHOTON_MISSILE 20","setStateTo: ON_HOLD"); 
    }; 
    
    GLOBAL = {
        ENTER = ("setSpeedFactorTo: 3.0", "pauseAI: 3.0","setStateTo: SUMMON"); 
        EXIT = (); 
        UPDATE = (); 
    }; 
}
so My secondary missile(the ones not launched, but spawned) by spawning its respective equiement (role) name, namely in my case)

EQ_FRAME_PHOTON_MISSILE

if Ido not do that, but rather call it by some other uniqe like Test_Photon like i used then isMissile will be false...

however now it is true since i spawned it calling its Equipment role

However, it does not inherit the owner ship from the missile that spawned it... so ship.owner is still false

It does also not inherit its target, which makes me sure that it is not even entering the function in where these heritages are set...

Now to test if this is also true for the same kind of missile fired by an NPC...

I tested it like this

Code: Select all

> this.mi = system.shipsWithPrimaryRole("EQ_MISSILE")
> this.mi = system.shipsWithPrimaryRole("EQ_MISSILE")
[Ship "Missile" ID: 322 position: (-2382.98, 9862.63, 167978) scanClass: CLASS_MISSILE status: STATUS_IN_FLIGHT],[Ship "Missile" ID: 323 position: (-2393.1, 9831.24, 168002) scanClass: CLASS_MISSILE status: STATUS_IN_FLIGHT]
> this.mi[0].owner
> this.mi[0].owner
[Ship "Fer-de-Lance" ID: 249 position: (-2488.02, 10286.8, 168016) scanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT]
> this.mi[0].spawn("EQ_FRAME_PHOTON_MISSILE")
> this.mi[0].spawn("EQ_FRAME_PHOTON_MISSILE")
[Ship "Photon Torpedo" ID: 324 position: (-2383.52, 9859.42, 167980) scanClass: CLASS_MISSILE status: STATUS_IN_FLIGHT]
> this.mi = system.shipsWithPrimaryRole("EQ_FRAME_PHOTON_MISSILE")
> this.mi = system.shipsWithPrimaryRole("EQ_FRAME_PHOTON_MISSILE")
[Ship "Photon Torpedo" ID: 324 position: (-2383.52, 9859.42, 167980) scanClass: CLASS_MISSILE status: STATUS_IN_FLIGHT]
> this.mi[0]
> this.mi[0]
[Ship "Photon Torpedo" ID: 324 position: (-2383.52, 9859.42, 167980) scanClass: CLASS_MISSILE status: STATUS_IN_FLIGHT]
> this.mi[0].owner
> this.mi[0].owner
[Ship "Fer-de-Lance" ID: 249 position: (-2488.02, 10286.8, 168016) scanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT]
Now to use the exact same procedure on one of the players missiles...

Code: Select all

> this.mi = system.shipsWithPrimaryRole("EQ_MISSILE")
> this.mi = system.shipsWithPrimaryRole("EQ_MISSILE")
[Ship "Missile" ID: 313 position: (4564.59, 4953.76, -13481.4) scanClass: CLASS_MISSILE status: STATUS_IN_FLIGHT]
> this.mi[0].owner
> this.mi[0].owner
[PlayerShip "Cobra Mark III" ID: 100 position: (4639.02, 5005.9, -13759.8) scanClass: CLASS_PLAYER status: STATUS_IN_FLIGHT]
> this.mi[0].spawn("EQ_FRAME_PHOTON_MISSILE")
> this.mi[0].spawn("EQ_FRAME_PHOTON_MISSILE")
[Ship "Photon Torpedo" ID: 314 position: (4564.77, 4953.21, -13482.3) scanClass: CLASS_MISSILE status: STATUS_IN_FLIGHT]
> this.mi = system.shipsWithPrimaryRole("EQ_FRAME_PHOTON_MISSILE")
> this.mi = system.shipsWithPrimaryRole("EQ_FRAME_PHOTON_MISSILE")
[Ship "Photon Torpedo" ID: 314 position: (4564.77, 4953.21, -13482.3) scanClass: CLASS_MISSILE status: STATUS_IN_FLIGHT]
> this.mi[0].owner
> this.mi[0].owner
null
> this.mi[0].isMissile
> this.mi[0].isMissile
true
> this.mi[0].target
> this.mi[0].target
null
As you can see, isMissile is true... however, the submunition missile does not inherit the ownership, when the owner of the launched missile is the player... IsMissile being true or not.... and it does also not inherit its target...

Either the function is never entered when the player is doing the missile launching OR

near:self is treated different when the player is self, and thus is set to null since the missiled launched does have a target...

in short... either this is expected behaviour or it is a bug!!!
Bounty Scanner
Number 935
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

@Eric Walch

Code: Select all

this.ship.spawn("nukeSubMunition", 10)
will make isMissile = false

you need to give it an entry in equipment.plist and spawn it by that equipment role like EQ_MISSILE..

as you will note missiles primary roles are "EQ_MISSILE" or "EQ_HARDENED_MISSILE" or else theire property of isMissile will be false..

Cheers........
Bounty Scanner
Number 935
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

The submunitions fired by player bug has been fixed in SVN2187. This is what my log indicates after firing a nuke on the nav buoy:

Code: Select all

[nuke3]: Target & owner of submunition nr:0 [Ship "Navigation Buoy" ID: 209 position: (-54234.4, 21326.1, 440999) scanClass: CLASS_BUOY status: STATUS_IN_FLIGHT] [PlayerShip "Cobra Mark III" ID: 100 position: (-60733.6, 23881.7, 440583) scanClass: CLASS_PLAYER status: STATUS_IN_FLIGHT]
[script.javaScript.warning.206]: ----- JavaScript warning ("nuke3" 1.0): Entity.setPosition() is deprecated, use entity.position = foo instead.
[nuke3]: Target & owner of submunition nr:1 [Ship "Navigation Buoy" ID: 209 position: (-54234.4, 21326.1, 440999) scanClass: CLASS_BUOY status: STATUS_IN_FLIGHT] [PlayerShip "Cobra Mark III" ID: 100 position: (-60733.6, 23881.7, 440583) scanClass: CLASS_PLAYER status: STATUS_IN_FLIGHT]
[script.javaScript.warning.206]: ----- JavaScript warning ("nuke3" 1.0): Entity.setPosition() is deprecated, use entity.position = foo instead.
[nuke3]: Target & owner of submunition nr:2 [Ship "Navigation Buoy" ID: 209 position: (-54234.4, 21326.1, 440999) scanClass: CLASS_BUOY status: STATUS_IN_FLIGHT] [PlayerShip "Cobra Mark III" ID: 100 position: (-60733.6, 23881.7, 440583) scanClass: CLASS_PLAYER status: STATUS_IN_FLIGHT]
[script.javaScript.warning.206]: ----- JavaScript warning ("nuke3" 1.0): Entity.setPosition() is deprecated, use entity.position = foo instead.
[nuke3]: Target & owner of submunition nr:3 [Ship "Navigation Buoy" ID: 209 position: (-54234.4, 21326.1, 440999) scanClass: CLASS_BUOY status: STATUS_IN_FLIGHT] [PlayerShip "Cobra Mark III" ID: 100 position: (-60733.6, 23881.7, 440583) scanClass: CLASS_PLAYER status: STATUS_IN_FLIGHT]
[script.javaScript.warning.206]: ----- JavaScript warning ("nuke3" 1.0): Entity.setPosition() is deprecated, use entity.position = foo instead.
[nuke3]: Target & owner of submunition nr:4 [Ship "Navigation Buoy" ID: 209 position: (-54234.4, 21326.1, 440999) scanClass: CLASS_BUOY status: STATUS_IN_FLIGHT] [PlayerShip "Cobra Mark III" ID: 100 position: (-60733.6, 23881.7, 440583) scanClass: CLASS_PLAYER status: STATUS_IN_FLIGHT]
[script.javaScript.warning.206]: ----- JavaScript warning ("nuke3" 1.0): Entity.setPosition() is deprecated, use entity.position = foo instead.
[nuke3]: Target & owner of submunition nr:5 [Ship "Navigation Buoy" ID: 209 position: (-54234.4, 21326.1, 440999) scanClass: CLASS_BUOY status: STATUS_IN_FLIGHT] [PlayerShip "Cobra Mark III" ID: 100 position: (-60733.6, 23881.7, 440583) scanClass: CLASS_PLAYER status: STATUS_IN_FLIGHT]
[script.javaScript.warning.206]: ----- JavaScript warning ("nuke3" 1.0): Entity.setPosition() is deprecated, use entity.position = foo instead.
[nuke3]: Target & owner of submunition nr:6 [Ship "Navigation Buoy" ID: 209 position: (-54234.4, 21326.1, 440999) scanClass: CLASS_BUOY status: STATUS_IN_FLIGHT] [PlayerShip "Cobra Mark III" ID: 100 position: (-60733.6, 23881.7, 440583) scanClass: CLASS_PLAYER status: STATUS_IN_FLIGHT]
[script.javaScript.warning.206]: ----- JavaScript warning ("nuke3" 1.0): Entity.setPosition() is deprecated, use entity.position = foo instead.
[nuke3]: Target & owner of submunition nr:7 [Ship "Navigation Buoy" ID: 209 position: (-54234.4, 21326.1, 440999) scanClass: CLASS_BUOY status: STATUS_IN_FLIGHT] [PlayerShip "Cobra Mark III" ID: 100 position: (-60733.6, 23881.7, 440583) scanClass: CLASS_PLAYER status: STATUS_IN_FLIGHT]
[script.javaScript.warning.206]: ----- JavaScript warning ("nuke3" 1.0): Entity.setPosition() is deprecated, use entity.position = foo instead.
[nuke3]: Target & owner of submunition nr:8 [Ship "Navigation Buoy" ID: 209 position: (-54234.4, 21326.1, 440999) scanClass: CLASS_BUOY status: STATUS_IN_FLIGHT] [PlayerShip "Cobra Mark III" ID: 100 position: (-60733.6, 23881.7, 440583) scanClass: CLASS_PLAYER status: STATUS_IN_FLIGHT]
[script.javaScript.warning.206]: ----- JavaScript warning ("nuke3" 1.0): Entity.setPosition() is deprecated, use entity.position = foo instead.
[nuke3]: Target & owner of submunition nr:9 [Ship "Navigation Buoy" ID: 209 position: (-54234.4, 21326.1, 440999) scanClass: CLASS_BUOY status: STATUS_IN_FLIGHT] [PlayerShip "Cobra Mark III" ID: 100 position: (-60733.6, 23881.7, 440583) scanClass: CLASS_PLAYER status: STATUS_IN_FLIGHT]
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

The submunitions fired by player bug has been fixed in SVN2187. This is what my log indicates after firing a nuke on the nav buoy:
Great. Good to hear that that is solved now.

Frame, the code A_C refered to was:

Code: Select all

	{
		spawned = [UNIVERSE spawnShipWithRole:role near:self];
		if (spawned != nil)
		{
			[spawned setTemperature:[self temperature] * EJECTA_TEMP_FACTOR];
			if (isMissile && [[spawned shipInfoDictionary] boolForKey:@"is_submunition"])
			{
				[spawned setOwner:[self owner]];
				[spawned addTarget:[self primaryTarget]];
				spawned->isMissile = YES;
			}
			[result addObject:spawned];
		}
	}
It always must set the owner when both "isMissile = YES" and the "is_submunition" key is present. The pressence of the key I can check. It is in shipdata and when spawned from a NPC owned missile the owner is set correct. With a player owned missile the owner is not set correct. This leaves only the isMissile being set wrong. In your case you check for isMissile for the spawn thing, not the parent. (NB isMissile, isMine and isWaepon as JS property are added in 1.73 and I can't check those properties with my 1.72)
This spawn function is called for every spawn command. And that this function is called correctly you see by that the result holds the spawned ships.

I am not interested if the submunition isMissile, only in the main missile. The subs don't need to be missiles. It might be mines or pieces of rock. However according the code they still should inherit the owner and target properties.

Browsing throught the shipEntity code I also see:

Code: Select all

- (BOOL)isMissile
{
	return [[self primaryRole] hasSuffix:@"MISSILE"];
}
This is probably also wrong. NPC ships launch 10% of their missiles with a primary role of plain "missile". So I think that to cover all instances the code should read as:

Code: Select all

- (BOOL)isMissile
{
	return [[self primaryRole] hasSuffix:@"MISSILE"] || [self hasPrimaryRole:@"missile"];
}
ps. none of this brings us further on the flasher subject though. :roll:
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

ahh I had not build revision 2187, thats why it did'nt work
however...

now i have build revision 2188.. and ownership of the submunition is correctly set however note this


Flashers stop working when the owner of the object/ship is the player


Since for my missiles when i set is_submunition to yes, the flashers simply stop working.

I would say it is safe to say that this has something todo with the code specificly checking for flashers and ownership. not knowing my way around the code yet, but i would go look for where the code decides to turn flashers on or off...
Bounty Scanner
Number 935
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

Frame, can you upload a test case somewhere so that I can have a chance to d/l and check?
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

another_commander wrote:
Frame, can you upload a test case somewhere so that I can have a chance to d/l and check?
yep cause i just made it so,..



download a showcase oxp here... http://www.box.net/shared/30nfpo0iec

buy the missiles as non submunition or submunition

go out and target a nav bouy or similar... the ones with flashers will stay still as they do not inherit the target or owner from the

The ones without flashers because they do not work because of the ownership and target is correctly inherited. they

will try get as close to the target as possible and prolly crash at sometime because they do not detonat or explode...
Bounty Scanner
Number 935
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

Frame wrote:
go out and target a nav bouy or similar... the ones with flashers will stay still as they do not inherit the target or owner from the

The ones without flashers because they do not work because of the ownership and target is correctly inherited. they

will try get as close to the target as possible and prolly crash at sometime because they do not detonat or explode...
Ehm... Didn't understand one bit. Can you please rephrase that?
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

another_commander wrote:
Frame wrote:
go out and target a nav bouy or similar... the ones with flashers will stay still as they do not inherit the target or owner from the

The ones without flashers because they do not work because of the ownership and target is correctly inherited. they

will try get as close to the target as possible and prolly crash at sometime because they do not detonat or explode...
Ehm... Didn't understand one bit. Can you please rephrase that?
sry i meant the ones with flashers (the missiles)

The missiles will stay still as they do not have a target... and so on...
Bounty Scanner
Number 935
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Frame wrote:

Flashers stop working when the owner of the object/ship is the player


Since for my missiles when i set is_submunition to yes, the flashers simply stop working.

I would say it is safe to say that this has something todo with the code specificly checking for flashers and ownership. not knowing my way around the code yet, but i would go look for where the code decides to turn flashers on or off...
Problem could be in ParticleEntity.m in function -drawSubEntity:

Code: Select all

	if (particle_type == PARTICLE_FLASHER && [self status] != STATUS_INACTIVE)
	{
		Vector		abspos = position;  // in control of it's own orientation
		int			view_dir = [UNIVERSE viewDirection];
		Entity		*last = nil;
		Entity		*father = my_owner;
		OOMatrix	r_mat;
		OOMatrix	temp_matrix;
		
		while ((father)&&(father != last))
		{
			r_mat = [father drawRotationMatrix];
			abspos = vector_add(OOVectorMultiplyMatrix(abspos, r_mat), [father position]);
			last = father;
			father = [father owner];
		}
I notice this part of the code has changed since 1.70 were flasers on subs never were drawn. It has improved but not enough. The while loop looks suspicious. It repeats until it finds the owner of the owner. It loops as long there in no owner left and father = nil. At that moment r_mat is the rotationmatrix of the main owner and abspos gets a position based on the players position and not the missile position.

Probably the loop must also check if the father is already a main entity.
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

You know, that falls in line with some of my observations...

When I was first working on the "photon torpedo", I put flashers on the sub entities... however they where not showing up...

however sometimes, by sheer luck, I noticed a flasher some distance away from the missile I had fired. it also looked stretched and 2dish as if some mathematical procedure had acted upon it and caused it to look like that...

I know it belonged to the missile because it was flying a parallel course to the missile I had fired following its every twitch and turn...
Bounty Scanner
Number 935
User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Post by Cmdr James »

Interesting point about the subentity drawing. I have looked into it and made a minor mod in trunk, not certain if it has fixed it -- the missiles described as working but no flashers both fly toward the target (and hit) and have lights on.

I am not too sure about the other missiles that dont work but do have flashers, I guess they are ok, as they deliberately do not inherit the target (so arent meant to work?)?

Also, the flashers dont flash, they are just on, is that expected?

EDIT: In fact, I think pretty much all parent (father) handling should be changed from [self owner] to [self parentEntity]
Capt. Slog
Dangerous
Dangerous
Posts: 84
Joined: Sun Apr 26, 2009 10:24 pm

Post by Capt. Slog »

Eric,
Think this might be my problem with Admiral hunting. Flashers broken - broken subentity definition "*FLASHER*, this will cause the entity not to exist?
User avatar
Frame
---- E L I T E ----
---- E L I T E ----
Posts: 1477
Joined: Fri Mar 30, 2007 8:32 am
Location: Witchspace

Post by Frame »

With my Limited knowledge of Objective C, i think im gonna tinker a bit with this...

just looking at it, just do not add up... looks wrong...
Bounty Scanner
Number 935
Post Reply