[AL Plugin] Litcube's Phanon Corporation V1.21

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Thu, 20. Jun 13, 18:19

zanraptora wrote:They're X3's SPECTRE, and they do not expect you to Comm, they expect you to die.
:thumb_up:

User avatar
PlasticineDog
Posts: 40
Joined: Sun, 23. Jun 13, 22:40
x4

Post by PlasticineDog » Sun, 23. Jun 13, 22:53

I'm getting the same problem as a couple of people mentioned in the previous page. I've spotted two Tandicorp traders just sitting next to stations doing nothing. As the others said, shooting them doesn't help. Nor does closing down and reloading the game.

I hope there's a way to fix this short of reloading the entire script. I've already had them running for a couple of days and their military is just starting to build up, I wouldn't want to shut them down just as it's getting interesting.

Strangely enough - just before I started seeing this, I got a humongous lag spike which dropped me down to about 2 FPS. The lag stopped as soon as I entered a new sector. The spike happened at exactly the same time I got a new update from Tandi. It could be a coincidence. It could be that something else caused the lag, and then Phanon was broken due to the overly taxed CPU.

Apart from the little muck-up the script has been working perfectly.

EDIT: Alright. Here's the deal. I've been investigating the problem, and long story short - I think the source of the issue is that the AI is attempting to use the jumpdrive to jump into a Terran gate. Which, of course, it can't do. But it doesn't know that it can't do that, and gets stuck indefinitely. I have installed the TOA to jumpgate mod, and I'm going to see what happens. Unfortunately It seems I'm going to have to either restart Tandi or kill the freighters because they' don't realize that their destination gate has changed. (Assuming I'm even right here). I will reset them, let them build some freighters, and wait to see if the problem happens again.

I think the problem has been solved. I've run the script for roughly 8 hours or so. I don't think that's long enough to be absolutely certain, but using cheats to put satellites in every sector, and the SEWN plugin, I tracked all of Tandi's traders and I watched them jump in and out of Terran space several times without error. Interestingly, though, they seem to know how to deal with the Albion gates. (which don't get converted to jumpgates by the conversion mod) They jump into the nearest gate they can find, and fly the rest of the way. I've only seen this once, though.

Over a day after installing the TOA mod and not a single trader has gotten stuck.

fisher 2000
Posts: 185
Joined: Sat, 20. Jun 09, 16:13
x3ap

Post by fisher 2000 » Sun, 7. Jul 13, 03:25

I am also having the same problem where ships are stationary in space, they have orders and destinations but there speed is 0 and they stay still ... Forver...... I'm running x3AP: 3.0

User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube » Sun, 7. Jul 13, 14:48

Hrm. This could be why I've never seen the error. I haven't had TOAs in my game since forever.

Teladidrone
Posts: 644
Joined: Tue, 24. Aug 04, 11:41
x3tc

Post by Teladidrone » Mon, 8. Jul 13, 11:31

What actually happens if one nukes the last "level"/company?

User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube » Mon, 8. Jul 13, 14:53

You "win"!

fisher 2000
Posts: 185
Joined: Sat, 20. Jun 09, 16:13
x3ap

Post by fisher 2000 » Mon, 8. Jul 13, 15:55

Glad the problems been identified, will there be a solution availible in the near future or shall I download the TOA to jumpgate mod ?

Phezzan
Posts: 79
Joined: Mon, 12. Nov 07, 05:48
xr

Post by Phezzan » Wed, 23. Oct 13, 02:55

I've hit a problem - and hopefully found a solution

al.LitQB.PhanCorp.Task.Sortie is completely destroying fps.

I'm certain it has something to do with a mod, as it occurs whenever I am 'within range' of Tandi HQ and no one would miss such a bug.

I 'solved' it with a 'wait 100 ms' right after the loop (Start:)
Here's the modified loop

Code: Select all

= [THIS]-> call script 'al.LitQB.PhanCorp.RenameCorpObj' : Object=[THIS] TypePrefix='Sortie Response'

$Class = [THIS]-> get object class
$HQ = get global variable: name='PhanonCorp.HQ'

$HelpSector = $HelpObject-> get sector


= [THIS]-> call script 'al.LitQB.PhanCorp.AddWareToShip' : Ware={Energy Cells} Amount=1500
= [THIS]-> call script '!move.jumptosector' : targetsector=$HelpSector jumptoo=[FALSE]


Start:
= wait 100 ms
$Enemy = [THIS]-> find nearest enemy ship in range: class=null

while not $Enemy
= [THIS]-> follow object $HelpObject with precision 10000 m : timeout=10000 ms
$Distance = get distance between [THIS] and $HelpObject
do if $Distance < 15000
break
$Enemy = [THIS]-> find nearest enemy ship in range: class=null
end

skip if $Enemy
goto label WaitAround:

$Fighters = [THIS]-> get ship array from sector/ship/station
$FighterCount = size of array $Fighters
$Pos = [THIS]-> get position as array
while $FighterCount
dec $FighterCount
$FighterCurrent = $Fighters[$FighterCount]
START $FighterCurrent-> call script '!fight.attack.enemiesrange.land' : station=[THIS] range=30000 arefpos=$Pos noidle=[TRUE]
end

= [THIS]-> call script '!fight.attack.object' : victim=$Enemy follow=[FALSE] onlyShields=[FALSE]
goto label Start:
Question:
What I'd like to know is whether this script is working properly - what is it supposed to do.
The Tandi bombers and M1 started attacking me, so I doubt that is the issue.
I remember some fighters after I added the wait, but not before.

Investigation:
Apparently '!fight.attack.object' is exiting immediately (for something) so I will start looking there.
Only one instance of this script was showing in the 'running' dialog - so perhaps it is only a problem on one type of object.

My 'guess' is that Tandi HQ is the problem
- it can't 'attack.object', so it would immediately return
- there's only one, which matches the number of running scripts.

I'm guessing the original cause of the problem is the performance enhanced vanilla scripts I think I installed (long long ago).

I'll be diffing the vanilla script to find out.

User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube » Wed, 23. Oct 13, 15:23

Yup. I do think I remember running into a bug on one of my own scripts eons ago that involved fight.obj kicking out early.

I have a habit of not including wait in some of my loops despite best practices expressed on this forum. The reason being, I need to know there's unexpected behavior. That comes in the form of a lockup.

Your assessment is correct, I believe. Fight is kicking out early, and due to the absence of the wait, it's locking. Your fix is fine.

This particular script is called when a factory is attacked and Phanon is called in to investigate. It sends an M1 with fighters.

_Skywalker_
Posts: 34
Joined: Tue, 16. Oct 07, 09:44

Post by _Skywalker_ » Thu, 28. Nov 13, 19:02

Umm... noob's question. Is it compatible with Albion Prelude? I see only "normal" and "X3TC" download versions. If yes then where should I put it? into x3TC folder or Addon folder?

Thanks in advance
May the force be with you

User avatar
ubuntufreakdragon
Posts: 5195
Joined: Thu, 23. Jun 11, 14:57
x4

Post by ubuntufreakdragon » Sat, 30. Nov 13, 15:28

There seams to be a bug in X3AP with this AIplugin when using !move.jumptostation by one of the Phanonship if the nearest "Gate" is a jumpbeacon, the script frezzes completly at this point.
Other race ships normaly needs relation friend to the owner of the beacon to use it, you may need to white your own jumptostation.
a renamed copy of all needed vanilla X3TC jump scripts should be enough, these scripts should be:
!move.jump.xml
!jumptogate.nearest.xml
!move.jumptostation.xml
My X3 Mods

XRebirth, things left to patch:
In General; On Firing NPC's; In De Vries; Out Of Zone; And the Antiwishlist

User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube » Sat, 14. Dec 13, 22:46

1.22 - No restart req:
- Massive increase in performance with two scripts. All main tick cycles now last no longer than 2 sec (even at 1000 Phanon Corp ships).
- Rewrote some of the asset notification message.

User avatar
PromX
Posts: 122
Joined: Thu, 21. Feb 08, 23:39
x4

Post by PromX » Sat, 14. Dec 13, 23:24

I guess that this new version is not going to give those update benefits to XRM with Phanon compatibility patch?

Kadatherion
Posts: 1021
Joined: Fri, 25. Nov 05, 16:05
x4

Post by Kadatherion » Sun, 15. Dec 13, 16:08

I updated inbetween generations, so that might be the cause, but I just noticed something strange as soon as the new one popped out:

[ external image ]

The initial fund grant turns out as a null value. However it looks like they settle in fine anyway, as they did indeed spawn with what seems an adequate number of cap ships and bombers - for the current level - in their home sector.

User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube » Sun, 15. Dec 13, 16:11

Uh oh. What generation were you on?

Kadatherion
Posts: 1021
Joined: Fri, 25. Nov 05, 16:05
x4

Post by Kadatherion » Sun, 15. Dec 13, 16:19

It's the Megax, so I was between the fifth and the sixth generation. I had already beaten the previous one (Omicron Ltd) a few hours before updating to the new version.

I'll edit the T file to make the generations respawn much faster and cheat through them a bit to confirm if the problem is there even at other levels and/or after resetting the plugin from the beginning.


EDIT: The issue does indeed represents itself on further generations, and even by resetting the AL plugin so that the Phanon restarts from the beginning. The asset reports turn out bugged as well, as you can see here (the report from the Megax in my current game)

[ external image ]

and here (after restarting the plugin)

[ external image ]

What's been shown is my actual game clock.
Last edited by Kadatherion on Sun, 15. Dec 13, 16:35, edited 1 time in total.

User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube » Sun, 15. Dec 13, 16:34

Or just run al.LitQB.PhanCorp.SpyReport. Click the Money line.

Kadatherion
Posts: 1021
Joined: Fri, 25. Nov 05, 16:05
x4

Post by Kadatherion » Sun, 15. Dec 13, 16:42

Manually running the spy report script gives me this (taken with the Megax generation just after it being spawn), and clicking on the money line adds ~5 million credits per click.

Interesting enough, the TL row shows the sector where the Phanon spawns rather than the actual number of TLs they have.

User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube » Sun, 15. Dec 13, 16:44

Yup, that's all expected. It's a debug tool.

Kadatherion
Posts: 1021
Joined: Fri, 25. Nov 05, 16:05
x4

Post by Kadatherion » Sun, 15. Dec 13, 17:47

Not sure if it might help or save you some time, but here is a screen of the debug report taken in the same conditions (right after the spawning of the Megax generation), with the old 1.21 scripts (and the t file reverted to its defaults for the timers).

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”