Ben Leskey | Blog

Autodrive into a crater fix

2023-02-08 #cdda #debugging #software

A pickup truck fallen into a crater in Cataclysm: Dark Days Ahead

In my current Cataclysm: Dark Days Ahead playthrough, I ran into a problem with the autodrive feature: it'd drive me straight into a crater and crash the vehicle.

This seemed like a straightforward fix, so I checked out the master branch and set about debugging. Autodrive definitely has the capability to avoid certain terrain, so I guessed it was just a mistake in how it was calculating ledge traps or open air terrain.

Sure enough, it was just an error in how the vehicle was being considered as "able to drive over air". With the existing logic, autodrive thought every vehicle could fly. The fix was simple: only consider helicopters (the only flying vehicle) that have enough rotor power as flyable.

I have a pull request fixing this issue ready to be merged.