Author Topic: Static Pak40 CTD bug (Goodwood etc.) fixed  (Read 1098 times)

Offline Drawde

  • Jr. Member
  • **
  • Posts: 160
    • View Profile
Static Pak40 CTD bug (Goodwood etc.) fixed
« on: 17-04-2010, 21:04:21 »
There's an odd bug with the static version of the PaK 40 AT gun which causes the game to CTD (most of the time) when the gun is destroyed - but only in single-player mode. This causes frequent CTDs on maps like Goodwood and Totalise.
I've tracked this bug down to a line in the gun's AI data file (vehicles\land\DE\pak40_static\ai\objects.ai):

Quote
aiTemplate.create pak40_staticAI
aiTemplate.addType ITUnit
aiTemplate.addType ITBiological
aiTemplate.addType ITGround
aiTemplate.addType ITHasWreck

Just add "rem " to the beginning of the ITHasWreck line (or remove it entirely) and the problem should be fixed. For anyone who doesn't want to attempt changing the game files themselves, this fix will be included in the next version of my AI minimod (hopefully not too long in the future)
 
Note that I've no idea what the ITHasWreck value actually does (or why it crashes the game)! It has nothing to do with whether the vehicle/object leaves a wreck when destroyed or not (the Pak 40 does, whether this line is in the file or not). It may have something to do with whether the AI can use the wreck for cover?
Even stranger, the Pak 38 (which never CTDs when destroyed) has the ITHasWreck line, but no other static AT guns (other than the Pak 40) do ???

Offline djinn

  • Masterspammer
  • ****
  • Posts: 5.723
    • View Profile
Re: Static Pak40 CTD bug (Goodwood etc.) fixed
« Reply #1 on: 18-04-2010, 11:04:33 »
Drawde... Again... genius!!

Trying it now

EDIT: Tried it out over breakfast... Battle raged nicely till tanks engaged tanks... Not sure we had captured Cagney - did'nt check, but didn't see 88 action in the log... map still CTDed after some 10 - 15 minutes... :-(

Might be as CF said... bug of explosion may not be limited to PAK40
« Last Edit: 18-04-2010, 12:04:48 by djinn »

Offline Drawde

  • Jr. Member
  • **
  • Posts: 160
    • View Profile
Re: Static Pak40 CTD bug (Goodwood etc.) fixed
« Reply #2 on: 18-04-2010, 21:04:17 »
Have you tried disabling the AI for the PIAT? (set strength vs. all target types to 0.0). That's the other cause of the Goodwood CTD; it doesn't crop up when playing without my AI mod, as the default PIAT AI min/max range values make it nearly impossible for bots to use it. I'm going to try and fix this before the next AI mod release, but don't guarantee it (if I can't fix it soon enough, I'll just disable the PIAT AI as a temporary fix)

The other vehicle explosion CTDs seem to be semi-random; the static Pak40 is the only repeatable one I've found.

Offline cannonfodder

  • Full Member
  • ***
  • Posts: 1.228
    • View Profile
Re: Static Pak40 CTD bug (Goodwood etc.) fixed
« Reply #3 on: 19-04-2010, 11:04:09 »
Just tried a round with that line removed and the PIAT disabled, I only destroyed a couple of static Paks during the round, but...NO CTD! :)

Offline djinn

  • Masterspammer
  • ****
  • Posts: 5.723
    • View Profile
Re: Static Pak40 CTD bug (Goodwood etc.) fixed
« Reply #4 on: 19-04-2010, 11:04:28 »
Drawde, you are a genius!

Offline Gunnie

  • Developer
  • ******
  • Posts: 124
    • View Profile
Re: Static Pak40 CTD bug (Goodwood etc.) fixed
« Reply #5 on: 20-05-2010, 03:05:49 »
Most static objects do not require the line of code, "aiTemplate.addType ITHasWreck". Hmm... I wonder if WinterHilf, when he was creating alot of the missing ai templates, pulled the ai template from the moveable AT guns and reworked them. 

In anycase, I also noticed in many of the static ai templates that some of them are missing the line of code, "aiTemplate.addType ITUnit".  I do not know if this missing template would cause any issues or not, but I am adding to those tweaks that do not have it.

All I can say is good find! I will be incorporating these fixes into the current build of FH2.

Offline cannonfodder

  • Full Member
  • ***
  • Posts: 1.228
    • View Profile
Re: Static Pak40 CTD bug (Goodwood etc.) fixed
« Reply #6 on: 20-05-2010, 11:05:24 »
...I will be incorporating these fixes into the current build of FH2.
8)

Offline djinn

  • Masterspammer
  • ****
  • Posts: 5.723
    • View Profile
Re: Static Pak40 CTD bug (Goodwood etc.) fixed
« Reply #7 on: 20-05-2010, 12:05:11 »
Most static objects do not require the line of code, "aiTemplate.addType ITHasWreck". Hmm... I wonder if WinterHilf, when he was creating alot of the missing ai templates, pulled the ai template from the moveable AT guns and reworked them. 

In anycase, I also noticed in many of the static ai templates that some of them are missing the line of code, "aiTemplate.addType ITUnit".  I do not know if this missing template would cause any issues or not, but I am adding to those tweaks that do not have it.

All I can say is good find! I will be incorporating these fixes into the current build of FH2.

Since there is currently no dedicated SP dev, and Drawde's mod already tackles all the issues and more, can the devs find a way of at least taking his entire package and incorporating it into the current build

We always have early attempt to fix stuff, like the Stuka and AT gun, but since there is no clear direction in SP, the release always comes with a few fixes to problems of the last version, and alot of its own issues and alot of blah AI. The release after that may fix some of the new issues, but then add its own too

Drawde's mod fixes everything we've been able to put our finger on and AI is as good as its ever been in FH2.. and still improving.

So basically, I'd rather see the entire package incorporated in, than single fixes. Drawde, if you can include the files in such a way that it doesn't cause people to require backing up their originals i.e. entire zip files, alternate arty rather than current arty with raised perspective etc, the devs might find it easier porting it.

Offline Drawde

  • Jr. Member
  • **
  • Posts: 160
    • View Profile
Re: Static Pak40 CTD bug (Goodwood etc.) fixed
« Reply #8 on: 20-05-2010, 16:05:41 »
Most static objects do not require the line of code, "aiTemplate.addType ITHasWreck". Hmm... I wonder if WinterHilf, when he was creating alot of the missing ai templates, pulled the ai template from the moveable AT guns and reworked them. 

In anycase, I also noticed in many of the static ai templates that some of them are missing the line of code, "aiTemplate.addType ITUnit".  I do not know if this missing template would cause any issues or not, but I am adding to those tweaks that do not have it.

Thanks for the info - definitely helpful to know. Should mobile vehicle ai templates have the ITUnit line as well? Some have it and some don't.
On a similar subject, do you know what the "cover" setting in objects.ai does, and why some FH2 vehicles (particularly tanks) have these lines disabled or missing entirely? I'm guessing it relates to bots being able to take cover behind vehicles, and/or recognising enemies as being in cover when they're behind a vehicle.

Regarding Djinn's post, alternate SP-only artillery objects won't be in the next (2.26 compatible) version of my minimod, as I want to get it finished ASAP and doing this will require a lot more work and testing (since I'll have to modify the map object files for all the SP maps with artillery in). But it's definitely a priority for the next version after that.
The artillery viewpoint is the only major change in my minimod that isn't purely AI/bot-related, the only other non-AI change I can think of is tweaks to some weapon sound scripts (to fix the looping with the 2pdr and 88 sounds, and give more consistency to gunfire audibility distances for weapons of the same/similar type)

BTW, I noticed 2.26 has "AI" versions of some static guns, such as the Bofors; not sure how these differ from the standard versions, but the Bofors aiming bug definitely seems to have been fixed!