Page 2 of 2

Posted: Wed Oct 21, 2009 5:07 pm
by Eric Walch
Thargoid wrote:
Also as I said in the thread I'm sure I've seen the hired escorts and some other ships fly, dead-stop, tumble and then shoot off again at speed, which would be another manifestation of this kind of action.
Ill look at it. But according to the code a full dead stop is never possible. All movement goes over the function appluThrust:

Code: Select all

- (void) applyThrust:(double) delta_t
{
	GLfloat dt_thrust = thrust * delta_t;
	BOOL	canBurn = [self hasFuelInjection] && (fuel > MIN_FUEL);
	BOOL	isUsingAfterburner = (canBurn && (flightSpeed > maxFlightSpeed) && (desired_speed >= flightSpeed));
	float	max_available_speed = maxFlightSpeed;
	if (canBurn) max_available_speed *= [self afterburnerFactor];
	
	position = vector_add(position, vector_multiply_scalar(velocity, delta_t));
	
	if (thrust)
	{
		GLfloat velmag = magnitude(velocity);
		if (velmag)
		{
			GLfloat vscale = fmaxf((velmag - dt_thrust) / velmag, 0.0f);
			scale_vector(&velocity, vscale);
		}
	}

	if (behaviour == BEHAVIOUR_TUMBLE)  return;

	// check for speed
	if (desired_speed > max_available_speed)
		desired_speed = max_available_speed;

	if (flightSpeed > desired_speed)
	{
		[self decrease_flight_speed: dt_thrust];
		if (flightSpeed < desired_speed)   flightSpeed = desired_speed;
	}
	if (flightSpeed < desired_speed)
	{
		[self increase_flight_speed: dt_thrust];
		if (flightSpeed > desired_speed)   flightSpeed = desired_speed;
	}
	[self moveForward: delta_t*flightSpeed];

	// burn fuel at the appropriate rate
	if (isUsingAfterburner) // no fuelconsumption on slowdown
	{
		fuel_accumulator -= delta_t * AFTERBURNER_NPC_BURNRATE;
		while (fuel_accumulator < 0.0)
		{
			fuel--;
			fuel_accumulator += 1.0;
		}
	}
}
Tumble is even a special case that breaks of halfway. ............ you are right. Not a bug, but very intentionally.
After the break off halfway the code, the speed is decreased but also the [self moveForward: delta_t*flightSpeed]; makes that the actual ship is moved forward according to speed. performTumble is maybe mend as full stop as a very special effect :?: With any other behaviour it will slow down according the thrust settings.

Posted: Wed Oct 21, 2009 5:15 pm
by Thargoid
The mineswept missiles are dead-stopping, or at least achieving a very small distance once their AI's are set to the new one. They're certainly not flying for the ~8 seconds that a max speed/thrust calculation would suggest, presuming the speed is reduced by thrust value per second (and if it's any faster clock cycle that will mean almost any ship or missile with "normal" thrust levels will dead-stop).

Follow the sequence in the PM and you'll see what I mean (just be careful of the station, it's quite nasty if provoked :twisted: ). Something's not working to plan somewhere here.

And if performTumble at speed is supposed to stop, tumble then carry on, then all I can say is it looks extremely odd when a ship in flight (especially at high speed or under injectors) does it ;)