Page 1 of 1

custom scanner range again

Posted: Sun Apr 04, 2010 8:44 pm
by Frame
seems with the AI trying to get as much distance between it and its target, very often these miss lose their targets, which is sort of pointless then..

For very large sluggish ships, this is even more true..

so i propose that scanner_range is yet again able to be set to larger than 25600 kms, and that custom value to be used.

Cheers Frame...

Posted: Sat Apr 10, 2010 11:36 am
by Frame
any takers ?

For the Player I can understand the need for a maximum range, however for the AI it is not Canon not having ships being able to target you beyond scanner range is I recall on the C64 being attacked by missiles when i attacked a ship beyond players scanner range..

as far as I can tell, it should be a trivial matter of changing functions in

Code: Select all

- (void) checkScanner
{
	Entity* scan;
	n_scanned_ships = 0;
	//
	scan = z_previous;	while ((scan)&&(scan->isShip == NO))	scan = scan->z_previous;	// skip non-ships
	while ((scan)&&(scan->position.z > position.z - scannerRange)&&(n_scanned_ships < MAX_SCAN_NUMBER))
	{
		if (scan->isShip)
		{
			distance2_scanned_ships[n_scanned_ships] = distance2(position, scan->position);
			if (distance2_scanned_ships[n_scanned_ships] < SCANNER_MAX_RANGE2)
				scanned_ships[n_scanned_ships++] = (ShipEntity*)scan;
		}
		scan = scan->z_previous;	while ((scan)&&(scan->isShip == NO))	scan = scan->z_previous;
	}
	//
	scan = z_next;	while ((scan)&&(scan->isShip == NO))	scan = scan->z_next;	// skip non-ships
	while ((scan)&&(scan->position.z < position.z + scannerRange)&&(n_scanned_ships < MAX_SCAN_NUMBER))
	{
		if (scan->isShip)
		{
			distance2_scanned_ships[n_scanned_ships] = distance2(position, scan->position);
			if (distance2_scanned_ships[n_scanned_ships] < SCANNER_MAX_RANGE2)
				scanned_ships[n_scanned_ships++] = (ShipEntity*)scan;
		}
		scan = scan->z_next;	while ((scan)&&(scan->isShip == NO))	scan = scan->z_next;	// skip non-ships
	}
	//
	scanned_ships[n_scanned_ships] = nil;	// terminate array
}
if this is a problem with a ship not picking the right target due to

Code: Select all

MAX_SCAN_NUMBER = 16;
I would suggest this number to be exponential in a fashion like this.. (i know this will not work, however for simplicity)

MAX_SCAN_NUMBER = (scannerRange/100)/16

which will equal 16 with a normal 25600 range
and if we set for example Thargoids Range to 51200 range
we get double that number namely 32, with the not so frequent Thargoids insurgencies into normal space I do not see that is a problem...

We even get the benefit that if some OXP ship has a lesser range like 12300 it only scans 8 ships at a time... which sort of make real life sense since these will sort of block your "Radar"

I will even try to make this work myself with no unforeseen side-effects. if someone would implement it into trunk.

Heck where do I Apply

Cheers Frame...

Posted: Mon Apr 12, 2010 7:49 am
by Eric Walch
In my opinion is "MAX_SCAN_NUMBER = 16; " correct behaviour. When it becomes crowded the ships starting to miss targets during a scan. In can be compensated by using a shorter scan range.
Whenever you do need a fail proof scan, you can always fall back on a custom JS scan.

I also don't see problems with the max scan range. And missiles do track targets beyond the scanner range. "interceptTarget" lookt at the scanrange but there is an exception in the code for scanClass CLASS_MISSILE, making they don't loose track of the target when the target flies out of its scanner range.

Posted: Mon Apr 12, 2010 4:59 pm
by Frame
Eric Walch wrote:
In my opinion is "MAX_SCAN_NUMBER = 16; " correct behaviour. When it becomes crowded the ships starting to miss targets during a scan. In can be compensated by using a shorter scan range.
Whenever you do need a fail proof scan, you can always fall back on a custom JS scan.

I also don't see problems with the max scan range. And missiles do track targets beyond the scanner range. "interceptTarget" lookt at the scanrange but there is an exception in the code for scanClass CLASS_MISSILE, making they don't loose track of the target when the target flies out of its scanner range.
But that does not answer my enquiry, at all.

Vanilla Oolite only have the thargoids having a large scanner range..
The thing is, that ships loose targets when a ship has travelled beyond 25600 km, something that happens all the time in combat with the current combat AI trying to get as much distance between it and its target...

its not acquiring targets I'm addressing, but ships loosing target lock and starts to idle or look for new targets...

I'm writing, that it is not canon behaviour having ships act like this...

I could On the Commodore 64 lock a target into my missile, even when it was beyond scanner range, fire the missile wait for the missile to hit.

As it is, its very unreliable..

I can easily write a js scanner, however I cannot lock that target with anything in the js coding, I can set the target to something beyond the scanner range, but it will instantly loose target because of the maximum scanner range...

I'm afraid I do not follow what you mean with ships loosing targets with "MAX_SCAN_NUMBER > 16;"

I have swamped the scanner with objects and ships and never seen the game loose track of a ship.

Cheers Frame...

Posted: Mon Apr 12, 2010 7:06 pm
by Eric Walch
Frame wrote:
Vanilla Oolite only have the thargoids having a large scanner range..
thargoids have a longer scanner range defined, but I am not sure if they ever were able to do anything with it. I think they always have had an effective range of 25600 like other ships. At least this is the case for oolite.
Frame wrote:
The thing is, that ships loose targets when a ship has travelled beyond 25600 km, something that happens all the time in combat with the current combat AI trying to get as much distance between it and its target...
That I also noticed recently. Last weak I added a code change to trunk to avoid that behaviour. (I am not satisfied with my fix because it currently affects to many ships) I will update the fix with a better one after some testing with a greater variation of ships. When you have some problem ships, please mail me the specs so I can run those also against my current fix.

Posted: Mon Apr 12, 2010 7:11 pm
by Thargoid
I had the same problem with the Thargoid scanner range - I've got some in TCAT (if I ever get around to finishing the damn thing) that make use of a longer scanner range, but only really by a script work-around to get over the combat target loss.

It does work fairly well, but it's a distinct work-around for something the canon says they should do by default.