Page 1 of 1

Containers L cannot be hit by AI crafts

Posted: Fri Jan 11, 2019 8:01 am
by Phoenix Leader
While I was playing Prologue, Mission #2 I experienced this problem: FRS Andrasta is not able to hit the type L containers.
I've uploaded a video: https://www.youtube.com/watch?v=TyGw8qo1IWI
This is not an issue related to the mission because I have the same problem in the Flight Simulator, skirmish mode.
I also tried to change craft and the X-Wing got the same result.
This has definitely something to do with the type L containers, not the fighters.

Re: Containers L cannot be hit by AI crafts

Posted: Fri Jan 11, 2019 1:13 pm
by JeremyaFr
Hello,
You can try this patch:

Code: Select all

; fix ContainerSphere not being hittable by AI
At offset 0119A6, replace 0F842F010000 with 909090909090.
Tell me if this works or not.

Re: Containers L cannot be hit by AI crafts

Posted: Fri Jan 11, 2019 5:22 pm
by Phoenix Leader
I tried to open XwingAlliance.exe with Resource Hacker, but I didn't find 0F842F010000.
Did I use the wrong software to open .exe?

I forgot to write I have DSUCP v2.5 installed.
I don't know in detail how it modifies XwingAlliance.exe.

Re: Containers L cannot be hit by AI crafts

Posted: Fri Jan 11, 2019 6:01 pm
by JeremyaFr
As an alternative, you can use XwaExePatcher and add this to patcher.xml:

Code: Select all

  <Patch Name ="fix ContainerSphere not being hittable by AI">
    <Item Offset="0119A6" From="0F842F010000" To="909090909090" />
  </Patch>

Re: Containers L cannot be hit by AI crafts

Posted: Fri Jan 11, 2019 6:39 pm
by Phoenix Leader
I downloaded the XwaExePatcher-1.0.11.zip (14.8 KB), extracted the files, opened patcher.xml with notepad and added the patch (of course before </ArrayOfPatch>); than I copied patcher.xml and pasted it to the X-Wing Alliance directory.

The problem is partially solved: some fighters, the Firespray for example, are now able to hit the containers type L, while others, the X-Wing for example, still miss the targets.

Is there anything I did wrong in the patch installation process?

Re: Containers L cannot be hit by AI crafts

Posted: Fri Jan 11, 2019 7:09 pm
by Darksaber
No, extract the XwaExePatcher-1.0.11.zip then add

Code: Select all

  <Patch Name ="fix ContainerSphere not being hittable by AI">
    <Item Offset="0119A6" From="0F842F010000" To="909090909090" />
  </Patch>
to the patcher.xml (you can open this with Notepad)

and yes before the </ArrayOfPatch>

Next goto you xwa Dir copy and paste the XwingAlliance.exe in to the XwaExePatcher-1.0.11 directory

next click on XwaExePatcherWindow.exe a window will open, scroll down to the bottom you will see the "fix ContainerSphere not being hittable by AI"

click "Apply" you have now applied the fix

Next Copy and paste the XwingAlliance.exe back to your XWA Dir, test the fix by playing the game

If you find the fix doesn't work repeat the above but click on "Restore to remove the "fix ContainerSphere not being hittable by AI".

Hope thats a little clearer :D

Re: Containers L cannot be hit by AI crafts

Posted: Fri Jan 11, 2019 7:13 pm
by JeremyaFr
Like I said, it's a try. The patch may not work.

Re: Containers L cannot be hit by AI crafts

Posted: Fri Jan 11, 2019 7:41 pm
by Darksaber
Ok I've done a test, without the patch, 6 container L (sphere) vs 6 x-wing, the xwings destroyed the spheres
Without Patch 6 Tie fighters again destroyed the sheres
Awings same result

Bwings, find it harder to hit the spheres and Firesprays couldn't hit a death star if it was right infront of them

Tried exactly the same with the patch and got the same result

Because the Ties, Awing and X-wings lasers are closer to centre the AI find it easy destroying the targets

Bwings and the Firspray there lasers are a fare bit off centre so the AI find it harder to hit anything

I don't think the patch works, I think its just the positioning of the lasers on the craft, the further away the lasers are from centre the hard AI craft find it to hit anything

So if your going to have a squardon of anything select a craft the has laser near the centre

Re: Containers L cannot be hit by AI crafts

Posted: Fri Jan 11, 2019 9:30 pm
by Justagai
Yes the issue does seem to be related to how the AI aim for the center of the target. With an unmodded XWA installation, some ships may have trouble hitting the container on the first pass but they will most likely destroy it on the second pass. Weird that this is happening with the upgraded container. Is it possible that the upgraded container is off center?

EDIT: There may be something hardcoded to compensate aim for the L container. I know in XvT there was specific hardcoding for certain containers and their hitbox since they weren't large enough to be considered for precision collision checking. Just a theory though.

Re: Containers L cannot be hit by AI crafts

Posted: Fri Jan 11, 2019 9:53 pm
by Darksaber
Justagai wrote:
Fri Jan 11, 2019 9:30 pm
Is it possible that the upgraded container is off center?
No I've checked them

I still believe its the positioning of the laser hardpoints, the further away the laser hardpoints are away from the centre of the craft, I think it makes it harder for an AI craft to aim, just look at the positioning of the laser hardpoint on the slave1 and Bwing, Then look at the positioning of of the laser hardpoints on say the Tie Fighter or Awing

It like having a gun in both hands, then stretching your arms out to the side and still trying to fire forward, your aim is going to be way off.

Re: Containers L cannot be hit by AI crafts

Posted: Sat Jan 12, 2019 5:14 am
by Phoenix Leader
Thanks for the replies.
So this seems to be an AI related issue and solving it could require editing AI behavior, which means essentially cheating.
Firesprays couldn't hit a death star if it was right in front of them
LOL
I knew Emon is getting old.

Re: Containers L cannot be hit by AI crafts

Posted: Sat Jan 12, 2019 9:29 pm
by Bman
I noticed a similar issue a few years ago when I had a corvette try to clear a mine field, but it shot right through the mines without damaging them.

Re: Containers L cannot be hit by AI crafts

Posted: Sun Jan 13, 2019 6:30 am
by keiranhalcyon7
I did some filming, and as far as I can tell, the AIs don't use laser convergence. I think, if they did, it would resolve the issue.

Re: Containers L cannot be hit by AI crafts

Posted: Sun Jan 13, 2019 11:14 am
by Phoenix Leader
Strange, the laser convergence system is turned on by default.
Shouldn't the AI be using the auto-setting?

Re: Containers L cannot be hit by AI crafts

Posted: Sun Jan 13, 2019 11:47 pm
by Justagai
I was going to post "Not all ships have convergence systems" but I wanted to see how the AI is acting with a ship that does have convergence. I have uploaded a video with me spectating the AI.

https://1drv.ms/v/s!AoEpIrw6LOkUjcYCwwp1D4tUm7qd4Q

keiranhalcyon7 is correct, the AI don't use convergence. As a matter of fact, they will turn it off if its on which I find interesting.

Re: Containers L cannot be hit by AI crafts

Posted: Mon Jan 14, 2019 5:23 pm
by JeremyaFr
Hello,
The code that defines gun convergence for AI crafts looks like this:

Code: Select all

    s_pXwaCurrentCraft->LasersConvergence = LasersConvergence_Off;

    if( s_XwaObjects[s_V0x07CA1A0.ObjectIndex].ShipCategory == ShipCategory_Starfighter || s_XwaObjects[s_V0x07CA1A0.ObjectIndex].ModelIndex == ModelIndex_051_0_38_EscortShuttle )
    {
        switch( s_XwaObjects[esp18].ShipCategory )
        {
        case ShipCategory_Starfighter:
        case ShipCategory_Transport:
        case ShipCategory_UtilityVehicle:
        case ShipCategory_Mine:
        case ShipCategory_Satellite:
        case ShipCategory_Droid:
        case ShipCategory_Armament:
            if( s_ExeCraftTable[s_pXwaCurrentCraft->CraftIndex].GunConvergence == GunConvergence_Manual )
            {
                s_pXwaCurrentCraft->LasersConvergence = LasersConvergence_Medium;
            }
            else if( s_ExeCraftTable[s_pXwaCurrentCraft->CraftIndex].GunConvergence == GunConvergence_Auto )
            {
                s_pXwaCurrentCraft->LasersConvergence = LasersConvergence_On;
            }

            break;
        }
    }
As you can see, the AI doesn't use gun convergence when shooting to containers.

You can enable gun convergence for AI craft with this patch:

Code: Select all

  <Patch Name ="fix gun convergence for AI">
    <Item Offset="0A6C09" From="7407" To="EB07" />
    <Item Offset="0A77E4" From="0303" To="0202" />
  </Patch>
The first item removes the ship category/model index filter for the current craft.
The second item enables gun convergence when shooting at people and container

With the patch, the code will look like that:

Code: Select all

    s_pXwaCurrentCraft->LasersConvergence = LasersConvergence_Off;

        switch( s_XwaObjects[esp18].ShipCategory )
        {
        case ShipCategory_Starfighter:
        case ShipCategory_Transport:
        case ShipCategory_UtilityVehicle:
        case ShipCategory_Mine:
        case ShipCategory_Satellite:
        case ShipCategory_People:
        case ShipCategory_Container:
        case ShipCategory_Droid:
        case ShipCategory_Armament:
            if( s_ExeCraftTable[s_pXwaCurrentCraft->CraftIndex].GunConvergence == GunConvergence_Manual )
            {
                s_pXwaCurrentCraft->LasersConvergence = LasersConvergence_Medium;
            }
            else if( s_ExeCraftTable[s_pXwaCurrentCraft->CraftIndex].GunConvergence == GunConvergence_Auto )
            {
                s_pXwaCurrentCraft->LasersConvergence = LasersConvergence_On;
            }

            break;
        }

Re: Containers L cannot be hit by AI crafts

Posted: Mon Jan 14, 2019 5:59 pm
by keiranhalcyon7
Confirmed, both the Firespray and the B-Wing have no trouble hitting the containers with this patch applied. I also threw in some zero-g Stormtroopers, which they also had no trouble with.

EDIT: Although now I realize that zero-g Stormtroopers are in the droid category, not the people category, and as such, the AIs always used convergence against them, and never had any trouble hitting them. I guess clones are closer to droids than to people? Anyway, I couldn't actually find anything with ship type: people in MXvTED with which to test that part of the change.

So s_V0x07CA1A0 appears to be a data structure for the current craft, and esp18 is the ObjectIndex for the target craft. I'm curious, is s_pXwaCurrentCraft just a pointer to s_V0x07CA1A0?

Re: Containers L cannot be hit by AI crafts

Posted: Mon Jan 14, 2019 6:54 pm
by JeremyaFr
It seems that the people category is never used.

s_V0x07CA1A0 is a data structure used by the AI code. esp18 is the object index of the target craft. s_pXwaCurrentCraft is not a pointer to s_V0x07CA1A0. It is a pointer to a structure that contains data related to a craft.

Re: Containers L cannot be hit by AI crafts

Posted: Mon Jan 14, 2019 7:20 pm
by keiranhalcyon7
Hmm, thanks, Jeremy. And congrats on post 1000!

Re: Containers L cannot be hit by AI crafts

Posted: Mon Jan 14, 2019 7:21 pm
by Darksaber
If I apply this to the DSUCP and XWACP, is this going to bugger up any missions???

Re: Containers L cannot be hit by AI crafts

Posted: Mon Jan 14, 2019 8:00 pm
by Justagai
JeremyaFr wrote:
Mon Jan 14, 2019 5:23 pm
Hello,
The code that defines gun convergence for AI crafts looks like this:

Code: Select all

    s_pXwaCurrentCraft->LasersConvergence = LasersConvergence_Off;

    if( s_XwaObjects[s_V0x07CA1A0.ObjectIndex].ShipCategory == ShipCategory_Starfighter || s_XwaObjects[s_V0x07CA1A0.ObjectIndex].ModelIndex == ModelIndex_051_0_38_EscortShuttle )
    {
        switch( s_XwaObjects[esp18].ShipCategory )
        {
        case ShipCategory_Starfighter:
        case ShipCategory_Transport:
        case ShipCategory_UtilityVehicle:
        case ShipCategory_Mine:
        case ShipCategory_Satellite:
        case ShipCategory_Droid:
        case ShipCategory_Armament:
            if( s_ExeCraftTable[s_pXwaCurrentCraft->CraftIndex].GunConvergence == GunConvergence_Manual )
            {
                s_pXwaCurrentCraft->LasersConvergence = LasersConvergence_Medium;
            }
            else if( s_ExeCraftTable[s_pXwaCurrentCraft->CraftIndex].GunConvergence == GunConvergence_Auto )
            {
                s_pXwaCurrentCraft->LasersConvergence = LasersConvergence_On;
            }

            break;
        }
    }
As you can see, the AI doesn't use gun convergence when shooting to containers.

You can enable gun convergence for AI craft with this patch:

Code: Select all

  <Patch Name ="fix gun convergence for AI">
    <Item Offset="0A6C09" From="7407" To="EB07" />
    <Item Offset="0A77E4" From="0303" To="0202" />
  </Patch>
The first item removes the ship category/model index filter for the current craft.
The second item enables gun convergence when shooting at people and container

With the patch, the code will look like that:

Code: Select all

    s_pXwaCurrentCraft->LasersConvergence = LasersConvergence_Off;

        switch( s_XwaObjects[esp18].ShipCategory )
        {
        case ShipCategory_Starfighter:
        case ShipCategory_Transport:
        case ShipCategory_UtilityVehicle:
        case ShipCategory_Mine:
        case ShipCategory_Satellite:
        case ShipCategory_People:
        case ShipCategory_Container:
        case ShipCategory_Droid:
        case ShipCategory_Armament:
            if( s_ExeCraftTable[s_pXwaCurrentCraft->CraftIndex].GunConvergence == GunConvergence_Manual )
            {
                s_pXwaCurrentCraft->LasersConvergence = LasersConvergence_Medium;
            }
            else if( s_ExeCraftTable[s_pXwaCurrentCraft->CraftIndex].GunConvergence == GunConvergence_Auto )
            {
                s_pXwaCurrentCraft->LasersConvergence = LasersConvergence_On;
            }

            break;
        }
This is very good stuff! I'll add this to the database.
Darksaber wrote:
Mon Jan 14, 2019 7:21 pm
If I apply this to the DSUCP and XWACP, is this going to bugger up any missions???
Maybe? For example, enemy craft that are attacking friendly small containers would be more difficult. But it also works in reverse.

Re: Containers L cannot be hit by AI crafts

Posted: Mon Jan 14, 2019 8:07 pm
by Darksaber
Justagai wrote:
Mon Jan 14, 2019 8:00 pm
Maybe? For example, enemy craft that are attacking friendly small containers would be more difficult. But it also works in reverse.
Ok thanks, I'll probably leave it out then :)

Re: Containers L cannot be hit by AI crafts

Posted: Tue Jan 15, 2019 9:37 am
by Phoenix Leader
Maybe? For example, enemy craft that are attacking friendly small containers would be more difficult. But it also works in reverse.
There is only 1 mission where enemy fighters attack friendly containers: B2M1 where TIE Experimental M1 attack type B containers, but they aren't small.

As for the opposite situation, there are no mission where friendly fighters attack enemy containers, unless you order them to do so.

Re: Containers L cannot be hit by AI crafts

Posted: Tue Mar 31, 2020 1:47 pm
by Mark_Farlander
Hello pilots,
I've applied the "fix gun convergence for AI" patch with XwaExePatcherWindow (XwaExePatcher-1.0.25) and now Firesprays can hit small objects such as Containers G that they couldn't hit before, but with the patch another issue has come: the gun turret on YT-1300 in B0M2 moves without input from player.
This happens regardless of the fact the Sabra is performing the "Follow Targets" order or not, therefore it cannot be a mission problem, but this only happens in areas where such order is present at any time, therefore it "seems" a mission problem.
I'm puzzled.