dcs-liberation / dcs_liberation

DCS World dynamic campaign.
GNU Lesser General Public License v3.0
712 stars 185 forks source link

Plane takeoff spawn starts in trees, explodes #2030

Closed LorenzoBoccaccia closed 1 year ago

LorenzoBoccaccia commented 2 years ago

Affected versions

Development build

Development build

https://github.com/dcs-liberation/dcs_liberation/actions/runs/1897885878

Description

image

SEAD WARLUS taking off crashes into trees, being placed off from the runway

it doesn't show up as taxing/startingin the liberation window

mission crop:

image

campaign save + nextturn mission in attachment.

Save game and other files

1.zip

walterroach commented 2 years ago

I ran the attached miz as well as one generated by the save file several times and the group you show exploding in Tacview successfully climbs away from the airport. If you re-run the .miz do you get the same result? My bet is my inability to reproduce is due to the DCS AI doing something differently on your run of the .miz.

The flight is intentionally not set to takeoff from the airport, as it's an in progress flight.

LorenzoBoccaccia commented 2 years ago

so I've tried and I can reproduce it, are you all on openbeta by any chance? I'm on stable.

image

e: I've tried switching but apparently there aren't changes. can it be I've not the f16 module, so it's using a different flight model? idk

DanAlbert commented 2 years ago

I doubt it's related, but FWIW Liberation doesn't support DCS stable. It's not possible for the game to support more than one release of DCS at a time.

walterroach commented 2 years ago

My testing was done on open beta, 2.7.10.19473

We might explore setting a floor (or increasing the floor if we have one) for low altitude limits on in progress flights. 30m is pretty spicy for the AI

DanAlbert commented 2 years ago

There is already a substantial floor: https://github.com/dcs-liberation/dcs_liberation/blob/980d8f3092be8d6a18f10f601238385160c3ebc0/game/missiongenerator/aircraft/flightgroupspawner.py#L34

walterroach commented 2 years ago

Something didn't work right on this flight then, will look into it further.

DanAlbert commented 2 years ago

I think when I added that floor I didn't actually have a save that I could use to verify, so it might just not work.

DanAlbert commented 1 year ago

This happens for any flight that is immediately engaged upon takeoff. That floor is only applied to MSL altitudes (because why would you have an AGL altitude where this is a problem?), and the combat flight state uses the previous state's altitude as the spawn altitude. The previous state was navigation from takeoff to hold, and 0 seconds into that journey, so it was at 0 AGL.

There's a bit of a wtf here as well: https://github.com/dcs-liberation/dcs_liberation/blob/207d56c2e97e19f294de978a05639ce28ebd5a80/game/ato/flightstate/navigating.py#L42-L52

This obviously has fairly nonsense behavior whenever one of the waypoints is AGL and the other is MSL, since we're lerping between two values with different units. There isn't really a great solution to this, since we can't know the MSL altitude of any AGL waypoint.

I'm going to try to get a save game that repros on a modern build so I can work on a patch. I can guess at a fix, but the code around here has changed a lot since the build this was reported against.

DanAlbert commented 1 year ago

2212 was a dup of this. No one spotted the dup, but #2212 was fixed by https://github.com/dcs-liberation/dcs_liberation/pull/2302, so this is also already fixed.