[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

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.

zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal » Fri, 13. Dec 13, 22:32

Regarding Phanon Corps negative assets. I can't say for certain but I suspect it has something to do with the increased cost of ship upgrades in XRM. Since I've not used the mod in a non-XRM game so I can't be certain, But having watched them for some time, I am convinced that the only issue this is causing is for them to slow down producing. For example in my game I would get a message like:

"Credit worth: 2M, Liquid assets: 204M, Next purchase a TS class freighter. 0 traders, 4 fighters"

Well in XRM a TS class freighter fully kitted might be 3M-8M depending on upgrades purchased, cargo expansion, jump drive, docking computer, etc, so it is no surprise when the next balance statement comes in and they are negative so it reads like "credit work: -1.5M, Liquid assets: 204M, 1 trader, 4 fighters" or something to that effect.

Regarding the negative assets I take it to mean that they "borrowed from the parent corp" or more accurately a limitation of the script not taking into account XRMs higher prices. From all appearances it is working correctly, but because of XRMs inflated prices they may not be keeping enough assets on hand to do any actual trading. Its hard to say.. A small change to the purchasing logic to require significantly more funds before making a purchase could correct the flaw.

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

Post by Litcube » Fri, 13. Dec 13, 22:39

zanzal wrote:A small change to the purchasing logic to require significantly more funds before making a purchase could correct the flaw.

Not that this is my version, but what's then flaw exactly? Increasing the threshold for purchase won't increase their progression.

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

Post by DrBullwinkle » Fri, 13. Dec 13, 23:22

I am not sure it is a flaw. I just think that the term "Credit Worth" needs a definition. It is not a term that I have run into in my work with American banks and financial institutions, and Google does not have a definition for it (other than as being related to a Credit Score, which does not seem to fit the context for Phanon).

So maybe it is a Canadian term, or a Litcube term or something. Care to enlighten us, Litcube? What do you mean by "Credit Worth"? How do you calculate it?

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

Post by Litcube » Fri, 13. Dec 13, 23:42

DrBullwinkle wrote:Care to enlighten us, Litcube?

By *us*, do you mean you? It's the amount of ducks the corporation has. Mallards. Mallard ducks. The corporation's total amount of mallard ducks.

zanzal
Posts: 309
Joined: Sat, 15. Sep 12, 07:42
x3tc

Post by zanzal » Sat, 14. Dec 13, 01:08

Litcube wrote:
zanzal wrote:A small change to the purchasing logic to require significantly more funds before making a purchase could correct the flaw.
Not that this is my version, but what's then flaw exactly? Increasing the threshold for purchase won't increase their progression.
I made the following assumptions:

1. Credits worth = balance on hand for all AI transactions = similar to the players credits
2. Negative credits worth would imply that the AI could not conduct trading since it has no money to buy a good so that it could in turn sell it.
3. This should only be an issue if it actually has a trading fleet. Assuming it doesn't use its fighters for trading.
4. Since the AI gets periodic cash funding from Phanom it should be able to trade during some cycles, but if it is constantly overspending then in many cases it could be in 'waiting for a positive balance' mode.

All these were assumptions, I'm hesistant to look at the code since I actually want to play against Phanon and knowing about how it works may spoil surprises.

Given that the root cause of negative balance would appear to be expensive ship purchases or upgrades (2.5mil XRM jumpdrives and 800k docking computers is my guess), the best course of action might be to adjust the purchasing logic by subtracting 4-8 mil from the actual cash on hand for use in calculating when to make a purchase. This would ensure that Phanon traders could deal in high end items like weapons and missiles which also generate the largest profit per trade run. If any of my assumptions are wrong though this may not be a good change to make.

I wouldn't know what script to modify to try and implement a cash buffer. Though I could do it, but it'd take me many hours just to find it.. no telling what i'd mess up in the process of *fixing* it ;)

Post Reply

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