Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Some bugs I found

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: 6579
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

Eric Walch wrote:
without a accuracy tag oolite just generates a random value for each missile. So they are not by definition worse. They even could be better.
This is not entirely correct. If the accuracy value is missing, an initial value of -100 is given to it. Then the program sets the value to 0, if it is a missile that the accuracy value is referring to. This is done by clamping the value in a range from 0 to 10. In our case, since the value is -100, it will be changed to 0. All this happens between lines 387-404 of the 1.71.2 source, ShipEntity.m. So, all missiles without an accuracy value set will have accuracy of 0 at creation time.
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 »

another_commander wrote:
All this happens between lines 387-404 of the 1.71.2 source, ShipEntity.m. So, all missiles without an accuracy value set will have accuracy of 0 at creation time.
You are right, it is changed with oolite 1.71. When I described accuracy for the wiki, (1.70 code) it was only used to randomise the pitch tolerance. This had only effect on the way it spiralled. This part of the code is still randomised when no accuracy is used. But now new lines are added for calculating accuracy. I assume this is now used for the target tracking itself.

Better change the code so that is generates a in-range random value when not defined or out of range.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6579
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

Eric Walch wrote:
Better change the code so that is generates a in-range random value when not defined or out of range.
I am not sure this would be the best thing to do. When I was doing the missile accuracy thing I thought about randomizing the accuracy value, but at the end decided against it, because I did not want to cause such changes to basic game behaviour. The idea is that the game feels and plays like previous versions if no accuracy is set. So, in my opinion, it is best left as is. But I guess it is a very easy change to make, if that is what the audience wants.
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 »

another_commander wrote:
So, in my opinion, it is best left as is. But I guess it is a very easy change to make, if that is what the audience wants.
If it is now just as dumb as it was, leave it this way. (Or only randomise it in the lower end of the range for some variation). An oxp like missiles & Bombs could create better ones if desired.

About the recent missile crashes on launch: could it be that the changes make it more likely the missile hits the launching ship? I changed the missile AI so it first does a 0.25 sec pause (were it flies just staight ahead at full speed) before it starts intercepting. I now only witnessed two miss-launches. But maybe it is just imagination that it improved.
User avatar
Cmdr Wyvern
---- E L I T E ----
---- E L I T E ----
Posts: 1649
Joined: Tue Apr 11, 2006 1:47 am
Location: Somewhere in the great starry void

Post by Cmdr Wyvern »

Like this?

Code: Select all

    GLOBAL = {
        ENTER = ("pauseAI: 0.30", "setSpeedFactorTo: 1.0", "setStateTo: ATTACK_SHIP"); 
        EXIT = (); 
        UPDATE = (); 
    }; 
In my quickie furball test, that's working well, seemed to have stopped the missile smacking launching ship bug, or at least reduced it. 8)

Good idea there, Eric. :)
Running Oolite buttery smooth & rock stable w/ tons of eyecandy oxps on:
ASUS Prime X370-A
Ryzen 5 1500X
16GB DDR4 3200MHZ
128GB NVMe M.2 SSD (Boot drive)
1TB Hybrid HDD (For software and games)
EVGA GTX-1070 SC
1080P Samsung large screen monitor
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 »

Cmdr Wyvern wrote:
Like this?

Code: Select all

    GLOBAL = {
        ENTER = ("pauseAI: 0.30", "setSpeedFactorTo: 1.0", "setStateTo: ATTACK_SHIP"); 
        EXIT = (); 
        UPDATE = (); 
    }; 
No this way the "performIntercept" will still be executed before the pause gets active. You must move the "setStateTo: ATTACK_SHIP" to the update event. This will ensure the pause. Pause is not immediately executed but only sets the next update event. (without a pause it is 0.125 seconds).

Code: Select all

    GLOBAL = {
        ENTER = ("pauseAI: 0.30", "setSpeedFactorTo: 1.0"); 
        EXIT = (); 
        UPDATE = ("setStateTo: ATTACK_SHIP"); 
    }; 
Im still not sure if I indeed see effect, but other may give their opinion if they do see it.
User avatar
Cmdr Wyvern
---- E L I T E ----
---- E L I T E ----
Posts: 1649
Joined: Tue Apr 11, 2006 1:47 am
Location: Somewhere in the great starry void

Post by Cmdr Wyvern »

Eric Walch wrote:

Code: Select all

    GLOBAL = {
        ENTER = ("pauseAI: 0.30", "setSpeedFactorTo: 1.0"); 
        EXIT = (); 
        UPDATE = ("setStateTo: ATTACK_SHIP"); 
    }; 
Im still not sure if I indeed see effect, but other may give their opinion if they do see it.
This works! I'm seeing missiles leaping ahead of the launching ship before turning for the interception run, much like they did in v 1.65. Number of missiles hitting the launching ships: Zero.
Using this AI tweak, I'm calling the bug pretty much squished. 8)
Running Oolite buttery smooth & rock stable w/ tons of eyecandy oxps on:
ASUS Prime X370-A
Ryzen 5 1500X
16GB DDR4 3200MHZ
128GB NVMe M.2 SSD (Boot drive)
1TB Hybrid HDD (For software and games)
EVGA GTX-1070 SC
1080P Samsung large screen monitor
User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Post by Ramirez »

I'm due to update Missiles and Bombs soon (to implement the anti-missile system) so I can include this little fix in the replacement AI for the standard and ECM-hardened missiles that are contained in the OXP.
Download Resistance Commander plus many other exciting OXPs HERE
User avatar
Cmdr Wyvern
---- E L I T E ----
---- E L I T E ----
Posts: 1649
Joined: Tue Apr 11, 2006 1:47 am
Location: Somewhere in the great starry void

Post by Cmdr Wyvern »

I've got one for the M&B pack, Ramirez. The Military Missile, an advanced Navy hardhead, surplus version. I nicked the aram model from the Utura ship oxps, nicked the hud icon from the nuke, and have the price set at 375 at one tech level up from the hardhead, for testing. It seems to be working well, and as you can see it has a special feature which comes into play when ECM'd. :twisted:

EDIT: It's available_to_all set true.

milmissileAI:

Code: Select all

{
    GLOBAL = {
        ENTER = ("pauseAI: 0.30", "setSpeedFactorTo: 1.0"); 
        EXIT = (); 
        UPDATE = ("setStateTo: ATTACK_SHIP"); 
    }; 
    "ATTACK_SHIP" = {
        "DESIRED_RANGE_ACHIEVED" = ("setStateTo: DETONATE"); 
        ENTER = ("setDesiredRangeTo: 25.0", performIntercept); 
        EXIT = (); 
        "TARGET_DESTROYED" = ("setStateTo: CHECK_EXPLOSION"); 
        "TARGET_LOST" = ("setStateTo: EXPLODE"); 
        "GONE_BEYOND_RANGE" = ("setStateTo: EXPLODE"); 
        "ECM" = ("setStateTo: CHECK_EXPLOSION"); 
        UPDATE = ("setDesiredRangeTo: 40000.0", checkDistanceTravelled, "setDesiredRangeTo: 25.0", "pauseAI: 5.0"); 
    }; 
    DETONATE = {
        ENTER = ("setDesiredRangeTo: 600.0", dealEnergyDamageWithinDesiredRange, becomeExplosion); 
        EXIT = (); 
        UPDATE = (); 
    }; 
    EXPLODE = {
        ENTER = (becomeExplosion); 
        EXIT = (); 
        UPDATE = (); 
    }; 
    "CHECK_EXPLOSION" = {
        ENTER = ("rollD: 20"); 
        "ROLL_1" = ("setStateTo: LOOK_FOR_THARGOIDS"); 
        "ROLL_2" = ("setStateTo: EXPLODE"); 
        EXIT = (); 
        UPDATE = ("setStateTo: ATTACK_SHIP"); 
    }; 
    "LOOK_FOR_THARGOIDS" = {
	ENTER = ("setSpeedFactorTo: 1.0", "setDesiredRangeTo: 50000", "scanForNearestShipWithRole: thargoid");
        "TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP"); 
        "NOTHING_FOUND" = ("setStateTo: LOOK_FOR_RENEGADES"); 
	EXIT = ();
	UPDATE = ("setDesiredRangeTo: 40000", "scanForNearestShipWithRole: thargoid", "pauseAI: 1.0");
	};
    "LOOK_FOR_RENEGADES" = {
	ENTER = ("setSpeedFactorTo: 1.0", "setDesiredRangeTo: 50000", "scanForNearestShipWithRole: hardpirate");
        "TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP"); 
        "NOTHING_FOUND" = ("setStateTo: LOOK_FOR_PIRATES"); 
	EXIT = ();
	UPDATE = ("setDesiredRangeTo: 40000", "scanForNearestShipWithRole: hardpirate", "pauseAI: 1.0");
	};
    "LOOK_FOR_PIRATES" = {
	ENTER = ("setSpeedFactorTo: 1.0", "setDesiredRangeTo: 50000", "scanForNearestShipWithRole: pirate");
        "TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP"); 
        "NOTHING_FOUND" = ("setStateTo: LOOK_FOR_OFFENDERS"); 
	EXIT = ();
	UPDATE = ("setDesiredRangeTo: 40000", "scanForNearestShipWithRole: pirate", "pauseAI: 1.0");
	};
    "LOOK_FOR_OFFENDERS" = {
	ENTER = ("setSpeedFactorTo: 1.0", "setDesiredRangeTo: 50000", "scanForOffenders");
        "TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP"); 
        "NOTHING_FOUND" = ("setStateTo: EXPLODE"); 
	EXIT = ();
	UPDATE = ("setDesiredRangeTo: 40000", "scanForOffenders", "pauseAI: 1.0");
	};
}
shipdata:

Code: Select all

	<key>military-missile</key>
	<dict>
		<key>accuracy</key>
		<integer>10</integer>
		<key>ai_type</key>
		<string>milmissileAI.plist</string>
		<key>bounty</key>
		<integer>0</integer>
		<key>cargo_type</key>
		<string>CARGO_NOT_CARGO</string>
		<key>energy_recharge_rate</key>
		<real>2.0</real>
		<key>exhaust</key>
		<array>
			<string>0.0 0.0 -3.5 2.0 2.0 4.0</string>
		</array>
		<key>forward_weapon_type</key>
		<string>WEAPON_NONE</string>
		<key>likely_cargo</key>
		<integer>0</integer>
		<key>max_cargo</key>
		<integer>0</integer>
		<key>max_energy</key>
		<real>10</real>
		<key>max_flight_pitch</key>
		<real>8</real>
		<key>max_flight_roll</key>
		<real>10</real>
		<key>max_flight_speed</key>
		<real>1000</real>
		<key>max_missiles</key>
		<integer>0</integer>
		<key>missiles</key>
		<integer>0</integer>
		<key>model</key>
		<string>aram.dat</string>
		<key>smooth</key>
		<true/>
		<key>name</key>
		<string>Military Missile</string>
		<key>roles</key>
		<string>missile EQ_MILITARY_MISSILE</string>
		<key>scanClass</key>
		<string>CLASS_MISSILE</string>
		<key>thrust</key>
		<real>260</real>
		<key>unpiloted</key>
		<true/>
		<key>weapon_energy</key>
		<real>6000</real>
		<key>scanner_range</key>
		<real>50000</real>
	</dict>
Running Oolite buttery smooth & rock stable w/ tons of eyecandy oxps on:
ASUS Prime X370-A
Ryzen 5 1500X
16GB DDR4 3200MHZ
128GB NVMe M.2 SSD (Boot drive)
1TB Hybrid HDD (For software and games)
EVGA GTX-1070 SC
1080P Samsung large screen monitor
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 »

Since 1.70 you can scan for a list of roles. That way you can pack 3 states into one:

Code: Select all

    "LOOK_FOR_THARGOIDS" = { 
   ENTER = ("scanForNearestShipWithAnyPrimaryRole: thargoid hardpirate pirate"); 
        "TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP"); 
        "NOTHING_FOUND" = ("setStateTo: LOOK_FOR_OFFENDERS"); 
   EXIT = (); 
   UPDATE = ("pauseAI: 1.0"); 
   }; 
Only scan on entering. The answers are evaluated on the update. It will always find something, or nothing. No need to scan again in the update, it will have an answer after the first scan.
User avatar
Cmdr Wyvern
---- E L I T E ----
---- E L I T E ----
Posts: 1649
Joined: Tue Apr 11, 2006 1:47 am
Location: Somewhere in the great starry void

Post by Cmdr Wyvern »

I didn't know that. It does make writing AIs easier, thanks. :)

Revised milmissileAI:

Code: Select all

{
    GLOBAL = {
        ENTER = ("pauseAI: 0.30", "setSpeedFactorTo: 1.0"); 
        EXIT = (); 
        UPDATE = ("setStateTo: ATTACK_SHIP"); 
    }; 
    "ATTACK_SHIP" = {
        "DESIRED_RANGE_ACHIEVED" = ("setStateTo: DETONATE"); 
        ENTER = ("setDesiredRangeTo: 25.0", performIntercept); 
        EXIT = (); 
        "TARGET_DESTROYED" = ("setStateTo: CHECK_EXPLOSION"); 
        "TARGET_LOST" = ("setStateTo: EXPLODE"); 
        "GONE_BEYOND_RANGE" = ("setStateTo: EXPLODE"); 
        "ECM" = ("setStateTo: CHECK_EXPLOSION"); 
        UPDATE = ("setDesiredRangeTo: 40000.0", checkDistanceTravelled, "setDesiredRangeTo: 25.0", "pauseAI: 5.0"); 
    }; 
    DETONATE = {
        ENTER = ("setDesiredRangeTo: 600.0", dealEnergyDamageWithinDesiredRange, becomeExplosion); 
        EXIT = (); 
        UPDATE = (); 
    }; 
    EXPLODE = {
        ENTER = (becomeExplosion); 
        EXIT = (); 
        UPDATE = (); 
    }; 
    "CHECK_EXPLOSION" = {
        ENTER = ("rollD: 20"); 
        "ROLL_1" = ("setStateTo: LOOK_FOR_AGGRESSORS"); 
        "ROLL_2" = ("setStateTo: EXPLODE"); 
        EXIT = (); 
        UPDATE = ("setStateTo: ATTACK_SHIP"); 
    }; 
    "LOOK_FOR_AGGRESSORS" = {
	ENTER = ("setSpeedFactorTo: 1.0", "setDesiredRangeTo: 50000", "scanForNearestShipWithAnyPrimaryRole: thargoid hardpirate pirate");
        "TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP"); 
        "NOTHING_FOUND" = ("setStateTo: LOOK_FOR_OFFENDERS"); 
	EXIT = ();
	UPDATE = ("setDesiredRangeTo: 40000", "pauseAI: 1.0");
	}; 
    "LOOK_FOR_OFFENDERS" = {
	ENTER = ("setSpeedFactorTo: 1.0", "setDesiredRangeTo: 50000", "scanForOffenders");
        "TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP"); 
        "NOTHING_FOUND" = ("setStateTo: EXPLODE"); 
	EXIT = ();
	UPDATE = ("setDesiredRangeTo: 40000", "pauseAI: 1.0");
	};
}
Running Oolite buttery smooth & rock stable w/ tons of eyecandy oxps on:
ASUS Prime X370-A
Ryzen 5 1500X
16GB DDR4 3200MHZ
128GB NVMe M.2 SSD (Boot drive)
1TB Hybrid HDD (For software and games)
EVGA GTX-1070 SC
1080P Samsung large screen monitor
User avatar
Ramirez
---- E L I T E ----
---- E L I T E ----
Posts: 628
Joined: Mon Nov 07, 2005 9:52 am
Location: London, UK

Post by Ramirez »

Eric Walch wrote:
Since 1.70 you can scan for a list of roles. That way you can pack 3 states into one:
That's very useful. The anti-thargoid missile in M&B used the simple scanForThargoid command, which meant it could find Thargoids but not the Thargon fighters, which is what I had meant it do in the first place (i.e. you fire the missile at the Thargoid, it launches a group of fighters in response, and then the missile splits into four warheads to take them out). I never got around to improving this, so I'll aim to fix that as well.
Download Resistance Commander plus many other exciting OXPs HERE
User avatar
wild turkey
Average
Average
Posts: 9
Joined: Thu Jul 10, 2008 3:12 am

Post by wild turkey »

Cmdr Wyvern wrote:
Eric Walch wrote:

Code: Select all

    GLOBAL = {
        ENTER = ("pauseAI: 0.30", "setSpeedFactorTo: 1.0"); 
        EXIT = (); 
        UPDATE = ("setStateTo: ATTACK_SHIP"); 
    }; 
Im still not sure if I indeed see effect, but other may give their opinion if they do see it.
This works! I'm seeing missiles leaping ahead of the launching ship before turning for the interception run, much like they did in v 1.65. Number of missiles hitting the launching ships: Zero.
Using this AI tweak, I'm calling the bug pretty much squished. 8)
Cool! So how do I implement it? :)
Regards,
WT
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 »

wild turkey wrote:
Cool! So how do I implement it? :)
When it works it probably will be implemented in future. However, it is still not fool-proof. I still get collisions on launch. (gave the missiles a script for easier logging).
User avatar
Cmdr Wyvern
---- E L I T E ----
---- E L I T E ----
Posts: 1649
Joined: Tue Apr 11, 2006 1:47 am
Location: Somewhere in the great starry void

Post by Cmdr Wyvern »

Ramirez wrote:
That's very useful. The anti-thargoid missile in M&B used the simple scanForThargoid command, which meant it could find Thargoids but not the Thargon fighters, which is what I had meant it do in the first place (i.e. you fire the missile at the Thargoid, it launches a group of fighters in response, and then the missile splits into four warheads to take them out). I never got around to improving this, so I'll aim to fix that as well.
Hey Ramirez, something I noticed that you probably didn't know.
You only get kill credits for lethal hits with single-stage missiles. The spawned warheads in MIRVs don't award kill cred when they make lethal hits.
Running Oolite buttery smooth & rock stable w/ tons of eyecandy oxps on:
ASUS Prime X370-A
Ryzen 5 1500X
16GB DDR4 3200MHZ
128GB NVMe M.2 SSD (Boot drive)
1TB Hybrid HDD (For software and games)
EVGA GTX-1070 SC
1080P Samsung large screen monitor
Post Reply