[SCRIPT] Phanon Corporation for X3AP+XRM 1.20

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

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

Post by Kadatherion » Fri, 6. Dec 13, 03:53

bluenog143 wrote: 1] Do I have to defeat a generation for the next one to spawn? If it isn't possible, what change do I need to make to the script so that the next generation will spawn when it's reached a certain point?
Yes you have to destroy a generation (blowing up their base) to trigger the countdown to the next one appearing. Not possible to have more generations at any one time, unless you completely rewrite it almost from scratch. There is only ONE Phanon corp, it gets tagged with a different name depending on the generation, but the (hidden) enemy race it uses is always the one and the same. And the same goes for the scripts and variables storing their assets.
bluenog143 wrote: 2] What change do I need to make to the script, so that when I defeat Phanon Corp (any generation) they are gone for good and won't respawn any more?
Errrr, no changes. If you don't want a new generation to spawn you can simply turn off the AL plugin at any time. But I guess you were reasoning around the idea of having multiple Phanon corps active at once, thus the need for them not respawning. Still, see point 1.

Lakz
Posts: 127
Joined: Tue, 19. Feb 13, 04:20

Post by Lakz » Fri, 6. Dec 13, 20:48

Could this script be responsible for lag?

I'm at day 6 (AP 3.1 with XRM), and the game suddenly became laggy to the point that it's barely playable. I tried to lower the graphic settings to the minimum, resetting the mission director, with no luck. I conclude that something must be bringing the CPU on its knees. I have an i5 running at 5.2GHZ though, and a GTX780 for graphics.

I have another savegame that's only a few hours younger, and everything is still smooth and playable.

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

Post by Kadatherion » Fri, 6. Dec 13, 21:23

I don't think so, Lakz, but we were very recently discussing this issue in the XRM thread. I experienced the same around day 5+ (but didn't really bother to test why, as I was already finished with the playthrough), and so did AcidWeb, who noticed a nasty pileup of al.xmrbounty.corescript.main.
Refer to the main XRM thread and look if you have the same AL pileup: if you have it too, then we can pretty much confirm that's the culprit and Paul will be able to look into it.

Lakz
Posts: 127
Joined: Tue, 19. Feb 13, 04:20

Post by Lakz » Fri, 6. Dec 13, 22:14

Kadatherion wrote:I don't think so, Lakz, but we were very recently discussing this issue in the XRM thread. I experienced the same around day 5+ (but didn't really bother to test why, as I was already finished with the playthrough), and so did AcidWeb, who noticed a nasty pileup of al.xmrbounty.corescript.main.
Refer to the main XRM thread and look if you have the same AL pileup: if you have it too, then we can pretty much confirm that's the culprit and Paul will be able to look into it.
Thanks for the pointers, I just read through the XRM thread, and looked at AcidWeb problems which lead me to find something interesting. I do have a bounty pileup in my earlier save, but it does not affect the game at all. However, in my laggy save, Phanon definitely seems to be the culprit.

Smooth save.
https://dl.dropboxusercontent.com/u/33428894/bounty.jpg

Laggy save.
https://dl.dropboxusercontent.com/u/33428894/phan.jpg

Is there any short term solution to remove that lag?

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

Post by Kadatherion » Fri, 6. Dec 13, 23:25

Well, you can try shutting down the tasks (highlight them and press del), and see if it helps. They are probably bound to stack up again soon anyway, and shutting them down does not necessarily mean you'll get back your fps, but it's worth a try.

In theory, properly disabling the Phanon plugin from the AL menu should clean everything up though (everything Phanon related, that is), so try that first.

The second screenshot is overall much worse anyway, look at that scrollbar! I gather in the laggy save you have both an xrm bounty pileup (as I see those repeating too) AND a Phanon one. No wonder then the CPU begins to cry blood tears, and maybe the two pileups might be related.
The true technicality of it is beyond my knowledge though, so if you could repeat your report in the XRM thread I'm sure it'd be very helpful to Paul.

P.S. What Phanon generation did you reach? In your case the Phanon pileup seemed to happen fairly suddenly given the two not so far apart save states, so maybe there's something wrong when a later Phanon gen spawns/works with lots of task forces and traders, while it's harmless in the early, less efficient generations.
(Then again it might be the xrm bounty pileup began to lag the engine, and before you could visually notice the impact, a cascade side effect of other AL plugins like Phanon lagging behind was generated).

Lakz
Posts: 127
Joined: Tue, 19. Feb 13, 04:20

Post by Lakz » Fri, 6. Dec 13, 23:43

I went down the list and manually shut down a bunch of tasks, and the lag went away! So at least now we know what's killing the CPU. However, it's tedious and tasks seem to come back rather rapidly.

I tried to deactivate Phanon Corp in the AL menu, but it makes my game freeze right after hearing a weird "air blowing" sound.

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

Post by Kadatherion » Fri, 6. Dec 13, 23:56

Ewww, if the game even freezes on disabling the plugin, then I believe the save is pretty much lost (the "wooosh" sound is normal, it's meant as a signal that the deactivating process had run). Try doing it again AFTER manually shutting down the global tasks (if you haven't already): if it freezes because it's overloaded, this way it might get the job done without issues, and that would prevent the Phanon tasks from regenerating.

The previous save wasn't that old, so you could start again from there, but still it was already showing the xrm pileup, so I'm afraid it could likely lead to the same results, sooner or later.
One thing you could do before throwing in the towel is reload that still not laggy game and let it go for a few hours in seta (without the Phanon script, obviously). If it doesn't get worse then it might be worth to keep playing, while if it does indeed lead to a performance drop, you'll know it's a lost cause and you shouldn't waste any more time on it.

Lakz
Posts: 127
Joined: Tue, 19. Feb 13, 04:20

Post by Lakz » Sat, 7. Dec 13, 00:23

Sadly I think you're right, and I'm pretty bummed out because a lot happened between those two saves. This is what I did :

I killed EVERY single task (I'm not even sure it's safe to do), but the game runs beautifully, and after a few minutes on SETA there's no sign of new buildup. There's however no guarantee that things won't go south again. AND, the game still crashes if I try to turn the Phanon Corp plugin off. So, even if I fix it by killing the tasks (and eventually having to do it again later on), something is definitely broken.

On the earlier savegame, I can turn the Phanon plugin off with no issue.

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

Post by DrBullwinkle » Sat, 7. Dec 13, 00:52

Which generation did you reach in Phanon?

Tip: If you are getting AL pileups, then stop using SETA.
  • (There is too much to do in building your empire anyway -- you don't really need SETA.)

Lakz
Posts: 127
Joined: Tue, 19. Feb 13, 04:20

Post by Lakz » Sat, 7. Dec 13, 01:04

It's the first generation, I didn't even bother worrying about them yet, as they're not a threat to my current operations.

I use SETA for navigation. There's no way I can not use it while flying through a 90km sector with a heavy M2 :)

I started over with the healthy savegame. So far I don't see any Phanon related task, and no lag. Should I do a preventive strike and kill all these al.xrmbounty.corescripts.main tasks piling up? What are these "tasks" anyway?

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

Post by DrBullwinkle » Sat, 7. Dec 13, 01:17

Artificial Life tasks repeat themselves on a timer. If the timer "ticks" before the task is complete, then two versions of the task will be on the global tasks list.

If you are getting AL pileups with Phanon during the first generation, then there is something very different between your game and every game I have ever played with Phanon. I have hundreds of hours of Phanon with no pileups in my games.

The only clue that you have suggested so far is heavy use of SETA. I almost never use SETA. Like maybe once a month. There is too much other stuff to do in the game.

If you cannot resist leaning on the SETA button, at least try turning down the SETA rate.

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

Post by Kadatherion » Sat, 7. Dec 13, 01:26

Hmmm, in my case I got up to the last Phanon gen with no particular issues, as my performance did degrade slowly throughout the days, I didn't experience a fairly sudden drop like you (and I was able to turn the plugin off, although it didn't really make a difference).
The first generations should be thoroughly playtested (being the first that everyone plays), even though not as much in this XRM compliant version (but Teleth hasn't really revolutionized the code, so it should make little difference), so I'd wager the Phanon pileup is a symptom more than the original cause.

As for the bounty tasks, Paul mentioned they should be fairly simple and lightweight, as they only manage the bounties data. The really heavy plugin would be the core one that handles weapon dealers, research stations and various other fancy things. I suppose if you turn off the bounty feature from the AL plugin menu they won't be able to come back.

And while SETA does indeed make things worse in such instances (it's strongly recommended to not go past 6x in XRM, btw), there's no way a 5.2 GHz CPU should get this affected if things were working as intended. Me, with an old and cheap 2,9GHz AMD I'm asking for trouble when setaing too much, especially in XRM, but him?
I also did play XRM+Phanon to the death several times back in TC, with an even worse rig and still using seta fairly extensively (10x, even), never had such an issue. Though there was no fancy bounty system at the time, iirc... :roll:

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

Post by DrBullwinkle » Sat, 7. Dec 13, 01:36

It doesn't matter how fast the cpu is... the game is capable of consuming all of the cycles under some circumstances.

The 100% cure for AL pileups is to add a simple mutex check in the Timer event. It is only a few lines of code.
  • Set a global variable at the beginning of the Timer event.
  • Clear the var at all exit points.
  • Do not run the Timer event if the var is already set.

Lakz
Posts: 127
Joined: Tue, 19. Feb 13, 04:20

Post by Lakz » Sat, 7. Dec 13, 03:01

My two cents, after a fair bit of testing... Phanon tasks kicked in at precisely 6 days and 19 hours, just like it did in the previous savegame. Past the 19 hours mark, the plugin will crash the game if I try to turn it off.

Somehing is definitely wrong with my Phanon Corp plugin. I'll try to reinstall it.

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

Post by Kadatherion » Sat, 7. Dec 13, 03:35

Lakz wrote:Phanon tasks kicked in at precisely 6 days and 19 hours, just like it did in the previous savegame. Past the 19 hours mark, the plugin will crash the game if I try to turn it off.
Was there something scheduled to happen at that moment (as far as you can tell)? One of the periodic asset reports, for instance?

Lakz
Posts: 127
Joined: Tue, 19. Feb 13, 04:20

Post by Lakz » Sat, 7. Dec 13, 03:41

Kadatherion wrote:Was there something scheduled to happen at that moment (as far as you can tell)? One of the periodic asset reports, for instance?
Not that I know of. As a matter of fact, I never received any of those asset report messages since I installed the script.
Last edited by Lakz on Sat, 7. Dec 13, 04:21, edited 1 time in total.

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

Post by Litcube » Sat, 7. Dec 13, 03:48

Lakz wrote:
Kadatherion wrote:Was there something scheduled to happen at that moment (as far as you can tell)? One of the periodic asset reports, for instance?
Not that I know of. As a matter of fact, I never received any of those asset report messages since I install the script.
Then something is really, really not right.

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

Post by Kadatherion » Sat, 7. Dec 13, 04:03

Eeeyup, maybe we did get ahead of ourselves and the issue is more banally a faulty installation/conflict?

If Phanon was working correctly, you should have received a message such as this every 4 hours (this screen was taken with Litcube's original version, but it still is mostly the same here too).

Lakz
Posts: 127
Joined: Tue, 19. Feb 13, 04:20

Post by Lakz » Sat, 7. Dec 13, 16:52

I had the morning to do a bit more testing. I still run in the same issue.

- I turned the plugin off and remove the script altogether.
- I re-downloaded PhanonCorpV1.21.zip and Phanon_XRM_1.2
- Installed the original script in the AP directory, pasted the XRM version over it.
- Went back in game, turned the plugin on.

I get the initial message, they set base in some empty sector and I get progression reports in the message log. Their assets attack mine, I attack theirs. All good thus far, but after a few hours, the tasks will suddenly start to pileup again and turning the plugin off will crash the game.

I'm clueless.

Bejla
Posts: 176
Joined: Fri, 22. Jun 12, 08:47
x3ap

Post by Bejla » Tue, 10. Dec 13, 21:21

Hello

Got a little Problem.
I run AP, XRM and IR2 and some other little scripts.
Everything works fine so far, only the Phanon Corp have problems with the start Money.

The Phanon have always some millions on the negative side.
Vashire start with something like this.
Credit worth: -19.587.263
Liquid assets: 786.652.712

Sure, after some hours they earn some money, but that take realy long.
Now after severals hours they have the rank bankrupt.
1 TS and still -1.5 millions.

Is there a way to increase the credit worth of the Phanon corp so they could expand faster?

Any help would be nice.

Post Reply

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