custom scanner range again

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

Post Reply
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

custom scanner range again

Post 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...
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 »

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...
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 »

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.
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 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...
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:
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.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post 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.
Post Reply