Aircraft crashing very slowly

Aircraft crashing very slowly

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Aircraft crashing very slowly

Post by Warlord Zsinj »

http://www.imperialwinter.com/vid/broken_crashing.wmv
(grumble grumble wmv etc etc)

I'm not sure why my aircraft that handle ok normally seem to crash in slow motion, and do not maintain their current direction, but rather just lose all forward momentum and turn towards the ground. KDR mentioned that from 077 aircraft were going to take momentum into account when crashing, but they don't seem to do that.

Here is the flight fbi data of the bomber unit you see crashing in the movie. I'll note that this happens to pretty much all our aircraft, who have variations on the following:

Code: Select all

	canmove=1;
	maxvelocity=4.8;
	acceleration=1;
	brakerate=0.1;
	turnrate=100;

	maxAcc=.18;
	maxRudder=.004;
	maxElevator=.006;
	maxAileron=.005;
Our aircraft used to handle like utter morons, I arrived at flight statistics you see above after lots of testing - they seem to handle much better now, but have this strange crashing bug (as well as still occasionally flying into the ground on an attack run, and occasionally flying off the map into infinity...).

(As a side note, it'd be nice to get access to the smoke effect used during crashing so we can stick it on other things, it's quite nice)
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Aircraft crashing very slowly

Post by Forboding Angel »

It's a side effect of maxacc

you have to use maxacc to make your aircraft handle in some form of believeable manner, but then you get this crashing bug. What you may wanna so is script it so that your aircraft just asplode. This is a pretty old bug.
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: Aircraft crashing very slowly

Post by yuritch »

I seem to remember the momentun thing was not about crashing aircraft (which are still units), but about corpses 'inheriting' momentum from units that spawned them. Haven't tested that with air units yet, previously (as in 0.76) plane corpses would just slowly fall down, now they may behave differently.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Aircraft crashing very slowly

Post by Tobi »

I did notice that ground units' corpses inherit momentum from the units they're created of since 0.77.

This looks pretty silly for ground units TBH (because corpses generally don't look like they can drive as fast as brand new units :-)), but I suppose it makes it look right for planes.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Aircraft crashing very slowly

Post by Kloot »

I originally added that inherit-momentum logic with ships and aircraft in
mind, but for tank wrecks I felt it looked semi-acceptable too (though a
bit more drag wouldn't hurt). Bots OTOH definitely need extra loving. ;)
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Re: Aircraft crashing very slowly

Post by Warlord Zsinj »

Is there a tag I need to set for them to inherit momentum? Because as you can see in the vid, they are currently not doing so.

I will probably have to turn off crashing until it's fixed, but that sucks, because crashing is one of the coolest parts of Spring aircombat, imo.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Aircraft crashing very slowly

Post by Argh »

I think that Aircraft speeds are getting set to zero when they enter Killed().
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Aircraft crashing very slowly

Post by KDR_11k »

Killed isn't called until they hit the ground. A crashing plane slows down but I don't know what defines how much.

BTW Forb, you don't have to script it anymore, canCrash=0; makes the plane always die when its HP is depleted.

Drag formula (seems to apply to crashing too):

Code: Select all

		float drag = 1.0f / (maxSpeed / GAME_SPEED * 1.1f / maxAcc);
Jasper1984
Posts: 196
Joined: 25 Jan 2008, 20:04

Re: Aircraft crashing very slowly

Post by Jasper1984 »

Tobi wrote:This looks pretty silly for ground units TBH (because corpses generally don't look like they can drive as fast as brand new units :-)), but I suppose it makes it look right for planes.
The units can't magically lose their momentum! They have a lot of drag, and slow down quickly. Looks cool to me! Edit: i mean physical objects.
Last edited by Jasper1984 on 15 Oct 2008, 02:29, edited 1 time in total.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Aircraft crashing very slowly

Post by lurker »

Jasper1984 wrote:The units can't magically lose their momentum!
Except that the 76b2 code actually did set the momentum to 0 in some dying units.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Aircraft crashing very slowly

Post by Kloot »

Warlord Zsinj wrote:Is there a tag I need to set for them to inherit momentum?
No, the inheritance is automatic. However, it only applies to wrecks,
not to aircraft that enter the crashing state (and hence aren't truly
dead yet). Yours is a different issue.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Aircraft crashing very slowly

Post by AF »

KDR made an svn commit which added a new tag:
Author: KDR_11k
Date: 2008-10-13 10:44:39 +0200 (Mon, 13 Oct 2008)
New Revision: 6690

Modified:
trunk/rts/Sim/MoveTypes/AirMoveType.cpp
trunk/rts/Sim/MoveTypes/AirMoveType.h
trunk/rts/Sim/Units/UnitDef.h
trunk/rts/Sim/Units/UnitDefHandler.cpp
trunk/rts/Sim/Units/UnitLoader.cpp
Log:
*added crashDrag tag (float, default 0.005) to fighter/bomber planes, when the plane is crashing it uses this drag instead of the automatically calculated drag it uses when flying. The calculated drag is no longer used when crashing, even if no crashDrag tag is present in the unit fbi.

The default drag seems to be pretty much equal to the drag seen on TA-like planes that crash properly, the only deviations I've seen was when planes would crash super slowly because they have a maxAcc tag and I don't think anyone actually wanted that behaviour.

Realistically I think all the mods can just ignore the tag and use the default (which seems to be the most desired behaviour) but the tag is provided anyway in case a mod has any special plans.
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Re: Aircraft crashing very slowly

Post by Warlord Zsinj »

Kloot, I understand, thanks for clearing it up.

KDR:
Image
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Aircraft crashing very slowly

Post by Forboding Angel »

KDR_11k wrote:Killed isn't called until they hit the ground. A crashing plane slows down but I don't know what defines how much.

BTW Forb, you don't have to script it anymore, canCrash=0; makes the plane always die when its HP is depleted.

Drag formula (seems to apply to crashing too):

Code: Select all

		float drag = 1.0f / (maxSpeed / GAME_SPEED * 1.1f / maxAcc);

Oops, sorry. :oops:
Post Reply

Return to “Engine”