[MOD] Complex Cleaner v4.09 / Modular Complexes (TC 3.2 / AP 1.1)

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

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

User avatar
Black147
Posts: 94
Joined: Sun, 23. Jan 11, 14:45
x3ap

Post by Black147 »

That´s cool, I suppose I could change it to be created with race player and then immediately change it to owner=neutral. I´m unaware of anything else being messed up in my XTC game script- or modelwise, but I also think it´s something else affecting your script. Be it as it may, it´s a simple fix and if someone else runs into this weirdness, send me a PM.

Thanks Gazz.
User avatar
Black147
Posts: 94
Joined: Sun, 23. Jan 11, 14:45
x3ap

Post by Black147 »

Too messy to bother.
Agreed and this time I found the real culprit. And fix. :roll:

Culprit:Sector Take Over
If "populate sector" option is turned off all non player owned stations are destroyed immediately to prevent GOD (or whatever) spawning stations in your sector.

Fix:

Code: Select all

$Module.Holder = create station: type=$Module.Holder.Type owner={Neutral Race} addto=$Sector x=$New.X y=$New.Y z=$New.Z
 
$Module.Holder->set local variable: name='STO.marked' value=[TRUE]
 
$Module.Holder->set name to $Module.Holder.Name
The middle line needs to be added to plugin.gz.CmpClean.crunch to prevent immediate destruction of Gazz module holder by the STO script.
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

Version 4.09 released.

Newly built complexes are (hopefully =) no longer destroyed by the Sector Takeover script.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
Amargand
Posts: 1
Joined: Fri, 8. May 09, 23:12

Post by Amargand »

First of all, thank you for this outstanding mod. Used this with X3:R to great effect.

Now I've gotten X3: TC, updated it to 3.0, slapped the Bonus package on top and installed Xtended 1.1, added your factories from the mods TFaktories to the Tfaktories in the Xtended Archive and copied the rest over.

On game launch, I get the message that everything installed correctly (v 4.09)

So I got myself a tractor beam and tried to crunch my terran factories...about 70% were crunched, the rest was said to be in a complex even if they were not. But instead of getting 1 Solar Hub, one Silicon Hub and so on, I got 4 separated Solar hubs 3 Silicon Hubs (40,2,2 from 1 mine) and similar results for all the other station types.

Tried the same with my Argon stations in another sector. Some stations in XXL size, some smaller. Only 10% were crunched, the rest was said to be in a complex (which they were not).

Did I mess up the installation, or is this some bug related to Xtended?
Flaming Blastclaw
Posts: 153
Joined: Thu, 27. May 10, 20:19

Post by Flaming Blastclaw »

EDIT:
This mod works perfectly.
"It is better to be thought as a fool than to speak and remove all doubt".
Abraham Lincoln
Peter Hull
Posts: 100
Joined: Sun, 15. Feb 04, 22:55
x3tc

Post by Peter Hull »

Firstly thanks for a wonderful mod.

i'm running cc v409, merged with extended. mostly everythings working fine. However i have noticed that factories built using the drop command are ignored when the crunch command is used. :?
This can easily solved by having your TL collect the station and buiding it conventionally. however, the drop command is not much use except to empty your TL's hold.
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

What's wrong with the "ignored" factories?

Do they have ECells as a product or resource, do they try to produce at all?
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
glenmcd
Posts: 920
Joined: Sat, 16. Oct 10, 11:07
x3tc

unbalanced complexes

Post by glenmcd »

I haven't built a complex without using CC for some time now. I have continually had a problem with balancing the complex when it comes to silicon mines. I normally setup a mine on every ore and silicon asteroid in a sector, and plan the remainder of factories around these. I have read about the 1 to 4 percent shortfall in mineral production due to rounding of yields at crunch time. But even with this, I've ended up with several complexes that run out of silicon and are quite a pain to maintain.

So what I've taken to doing recently is to put all mines into a complex, and at that time note the true mineral production rates. Then I use complex calculator (the official Egosoft one) and input fake yields so that the production specified for mines is equal to what is actually possible from that sector. Once this is done, I save the link and call it something like "19M Mines only" with folder being sector name, so that I can use this on subsequent game starts.

It's quite a bit more work to do it this way, and I'm wondering whether there's
a complex calculator available that accounts for the losses incurred when CC is used. I could do more manual calculations to know better whether a complex can self sustain or not, but it's already quite a bit of work and so anything to streamline this a bit and possibly assist with avoiding mistakes would be welcome.

Also, I'm wondering whether this problem can actually be resolved in CC. Gazz, you mentioned "Half a mine" isn't possible, but it is possible to add a factory producing some minimum number of mineral products, using an appropriately long cycle time? I'm not far enough into scripting to know whether this is even possible. Even with my above correction method, it still isn't precise, and even if you understate silicon output for complex calculator, it means that EC usage for the mines will be understated also, possibling leading to the complex running out of ECs. Okay, I can overestimate on ECs, but this can very easily make the difference between ability to have an extra CIG factory or not. Going the other way makes the difference between having to purchase, train and deploy an extra CAG to make up the shortfalls. And across dozens of complexes running continuously in the background, this can make quite a difference.

TIA.
Peter Hull
Posts: 100
Joined: Sun, 15. Feb 04, 22:55
x3tc

Post by Peter Hull »

Gazz wrote:What's wrong with the "ignored" factories?

Do they have ECells as a product or resource, do they try to produce at all?
The factories seem to work ok, with normal product and recources, they just wont join the complex with the crunch command.
JrK
Posts: 218
Joined: Wed, 20. May 09, 17:01
x3tc

Post by JrK »

Today when trying to crunch a 1Mj shield complex in Cloudbase South East the CC crunching just deleted my Ore Mine M. The mine was there before on an asteroid, but after the crunch it is gone but no ore factory shows up in the module container. :( I'm using SRM and CC, but no other scripts which affect factories. Does anyone have any idea what is up or how to fix this? Thanks in advance. :)
God is in the rain.
glenmcd
Posts: 920
Joined: Sat, 16. Oct 10, 11:07
x3tc

Post by glenmcd »

JrK wrote:Today when trying to crunch a 1Mj shield complex in Cloudbase South East the CC crunching just deleted my Ore Mine M. The mine was there before on an asteroid, but after the crunch it is gone but no ore factory shows up in the module container. :( I'm using SRM and CC, but no other scripts which affect factories. Does anyone have any idea what is up or how to fix this? Thanks in advance. :)
That happens to me if I build a silicon mine on an ore asteroid, or vice versa. I actually wanted to do this one time, coz I know you can get a little bit of silicon out of an ore asteroid and that's all I needed to balance the complex. CC gave an error message for me, but a rather confusing one. At this point all you can do is reload I think.
JrK
Posts: 218
Joined: Wed, 20. May 09, 17:01
x3tc

Post by JrK »

Pretty sure I used the right mine though. But I'll keep my eye out for future builds.
God is in the rain.
HotSake
Posts: 472
Joined: Sun, 3. Jan 10, 22:15
x3tc

Post by HotSake »

Just a reminder: if it's too late to rebuild, you can always cheat an asteroid and mine back into the sector.
glenmcd
Posts: 920
Joined: Sat, 16. Oct 10, 11:07
x3tc

Post by glenmcd »

HotSake wrote:Just a reminder: if it's too late to rebuild, you can always cheat an asteroid and mine back into the sector.
Thanks. But I eventually worked out the real reason for the shortfall. I hadn't "discovered" all asteroids in the sector. There's no way that I can see of counting the number of mines in your complex after you've crunched. You could go searching, but in some sectors you may be searching forever and for nothing. Instead of missing an asteroid / mine, it could be that the rounding effect that CC does on mines during crunch, won't supply your complex with sufficient silicon to survive in a closed loop. Because I haven't been able to work out ahead of time how much silicon is really going to be produced using CC, I instead opted for:

1. Make absolutely certain that I've discovered all asteroids as per spec in Complex Calculator. To this end, I am using a script that automatically discovers all asteroids, within 60 seconds of entering a sector. This itself is getting into "cheat" territory.
2. Build all mines. Not some. All. On all asteroids. One extra problem, because you can no longer use the profit$ from a small plex to pay for the mines you need in a larger plex. This is no small problem.
3. Crunch into a complex of mines-only.
4. See how much silicon / ore is ACTUALLY being produced, and use complex calculator to work out how the remainder of the closed loop complex is going to look.

If you're not using CC, the figures would be predictable, all mines countable, and if there is any mistake you can always add an extra later. You can't "just" add a 1-yield silicon mine later with CC, because it will round it down to zero. Maybe a 3 or even a 5 will do the same? I haven't tested this extensively, but I did sufficient tests to confirm that if you do two seperate crunches with mines instead of one, you normally lose even more to "rounding". That then forces you to only do one crunch for all silicon mines, and perhaps one crunch for ore mines. Or one for all. But if there's any mistake at any point in this entire process, all of the calculations that you had done for building a megaplex using all / most silicon in a sector, will no longer be valid.

I used to find out only after many hours of game time, during which the plex would keep running out of silicon. Now, I find out how much smaller I have to make the plex, after crunching all available mines.

To prevent the above problems, Complex Cleaner either needs to do accurate mineral output calculations and suitable FACTs, or if it *has* to round, that it rounds up. Some might see this as an opportunity for cheating. Crunch one mine at a time and end up with twice as much silicon as the sector normally can provide. No. Somehow the information for which mines and their yields that went into the FACTs, need to stay with the FACTs, and upon re-crunch, a new over-all rounding up is done, eliminating the cheating aspect. This would of course consume more energy compared to specs calcualte in Complex Calculator, but even this is only a problem if you place 100% consumption demands on silicon in the plex. Otherwise, EC usage will reduce when the silicon product storage bins are full.

But the core problem here isn't reduced silicon output. It's that it is impossible to accurately design a closed loop complex using the "Complex Calculator". If you use Complex Cleaner, any plex using a mine needs the special steps outlined above. What's probably worse is that if you want to use maximum silicon in a sector at *any* time, you need to make that decision before crunching mines for first time in that sector. If you decide that you'd like the option of using max silicon in this sector, you have to build all mines now, and of course have the required funding to do so.

So just from one tiny "gotya" in Complex Cleaner, it dramatically changes plex building for anyone aspiring to make large complexes. With almost all sectors, the limiting factors for how much of any ware you can produce, are silicon production and credits to purchase the factories/forges/mines. This provides a compelling reason to spend the time to balance your megaplex design finely, which in turns allows for max product. A 4 percent reduction in silicon means on average, 4 percent less end products. That of course is acceptable when you consider the wonderful advantages that Complex Cleaner offers. But for me, it's hard to accept having to wait until I see actual mineral production rates when all mines in a sector are crunched, before I can evn start the plex design stage.

I'd like to offer some suitable solutions for this, but the fact is that I am not knowledgable of all the restrictions that Complex Cleaner faces. Our developer states that rounding is necessary. I say that rounding becomes much more of a problem than is immediately noticable. I just hope that progress can be made in some direction.

There's just two more things that need solving in CC before I'd consider it ready for signing by Egosoft:

1. You can see which mines and their yields) make up the mineral FACTs.
2. The cost of CCKs is somehow made equal to what it would be in vanilla.

I dont' know how to solve either. And I can get by without these. But it's quite obvious how much of an advantage to all, having Complex Cleaner become signed would be. If it was signed, I have no doubt whatsoever that it would be a part of the normal X distribution, perhaps in with CAG, CLS, turbo etc. I think Egosoft would "jump" on this very quickly, because it offers an excellent workaround to the majority of frame-rate problems. Major marketing boost. More credit$ :D
HotSake
Posts: 472
Joined: Sun, 3. Jan 10, 22:15
x3tc

Post by HotSake »

Hmm. What if a CC module kept the exact mineral output of the mines that went into it stored as a local variable, consistent with the calculator, and always rounded up if it couldn't give this exact yield? This would result in, at best, a tiny increase in mineral output. Upon recrunching, this local variable plus the yields of the new mines would be added, a new accurate count stored, and then rounded up for use in the module. Essentially, the module would remember how much output it's supposed to have, and would use this value instead of its actual output when calculating the new output during a recrunch. This would prevent compound rounding errors by only rounding once no matter how many crunches occur, and the rounding up would prevent shortfalls in a module planned for 100% mineral use. The error would small in any event, and would never harm the player.

Let's be honest: if someone wants to cheat, they will. We need to design for standard use and not worry about leaving opportunities to cheat. Making 100 separate CC modules to take advantage of the rounding error in this tweaked system is certainly possible, but there are much easier ways to give yourself extra minerals.
Glimpse
Posts: 141
Joined: Thu, 29. Apr 10, 14:05
x4

Post by Glimpse »

Peter Hull wrote:Firstly thanks for a wonderful mod.

i'm running cc v409, merged with extended. mostly everythings working fine. However i have noticed that factories built using the drop command are ignored when the crunch command is used. :?
This can easily solved by having your TL collect the station and buiding it conventionally. however, the drop command is not much use except to empty your TL's hold.
I can confirm this one.Using XTC v1.1 and CC 4.09 merged. I manually have to build(and stare at revolutionary revolving station scenes!) stations and then crunch them.Otherwise it seems crunch assumes they are all in a complex or something.

And my game just froze when I tried to relocate the module box which was in the middle of the sector where I'd hate to see it.And I hadn't saved it.No big deal though.I'll just stick my nose in some other scripts in the meantime ;)

Edit: I think I've found the culprit.Which is the check for XTC variable on stations.Disabling it through the script did fix the inability to crunch dropped stations.

Located at line 118 in script plugin.gz.cmpClean.crunch

Well I believe there was a reason for that check,but at this time I have to disable it for now :(

Edit2: Oh man.Freezing issues are consistent now. :/ And how happy I was when I had 7 200 Energy Cell Factories in a tiny place.I don't think that freezing has anything to do with relocating since it happens after fixed amount of time.I'll try to pin it.

Edit3: While I still cannot determine what is causing the freezes,I've found that reverting to the old savegame I had fixed the freezes.I'll keep playing around and see what is going on.But still a big cheers for saving us all from the evils of tubed complexes and low framerates!
builder680
Posts: 1315
Joined: Mon, 14. Feb 11, 03:58
x4

Post by builder680 »

Trying this mod out...

I want to crunch a complex, but the command does not show up under "Custom."

I have a Tractor Beam on board both my Vidar, and my Albatross, but neither ship has the Command to "Crunch," whether or not I have my complex targeted.

What silly thing am I doing wrong?

Also, I see in the post above mine that Glimpse is having freezes from using this mod. Is that the case for everyone?

--------------------------------------

found the answer to first question:

"Unlike most scripts CC uses a delayed installation.
It will install not on the first but the second time you load a game.
Without that X3 would crash on installation in some cases. "

Doh!

But, is the freezing a common occurrence?
Brian5001
Posts: 15
Joined: Wed, 9. Dec 09, 03:37
x4

Post by Brian5001 »

Gazz, if you could setup the mod to not actually "crunch" multiple mines into one (and thus doing away with the need for rounding), would you please do so and upload it as a separate version? After all, you'll only have probably a maximum of 50 mines per sector anyways, so why compress them into a single 'rounded' mine?

Sure, it will probably affect your fps a bit, but I think the trade-off would be much more tolerable than the 'loss of much profitsss', or in this case, minerals.

-EDIT- Just realized it would still be an issue with the Super Tractor and similar scripts, but I'd prefer to get every last bit out of my mines that can be gotten, since one of the few resources that actually has a production ceiling, is the ore/silicon mines, since there are only a set number of asteroids.
glenmcd
Posts: 920
Joined: Sat, 16. Oct 10, 11:07
x3tc

Post by glenmcd »

Brian5001 wrote:Gazz, if you could setup the mod to not actually "crunch" multiple mines into one (and thus doing away with the need for rounding), would you please do so and upload it as a separate version? After all, you'll only have probably a maximum of 50 mines per sector anyways, so why compress them into a single 'rounded' mine?

Sure, it will probably affect your fps a bit, but I think the trade-off would be much more tolerable than the 'loss of much profitsss', or in this case, minerals.

-EDIT- Just realized it would still be an issue with the Super Tractor and similar scripts, but I'd prefer to get every last bit out of my mines that can be gotten, since one of the few resources that actually has a production ceiling, is the ore/silicon mines, since there are only a set number of asteroids.
I'll second that motion! One way to achieve this (change to CC required) is to relate FACT capacities not to numbers like 1,2,5,10 etc, but to all prime numbers: 1,2,3,5,7,11,13,17... This will provide zero rounding for the absolute minimum number of resulting FACTs. If it works for mines, it can also work for factories. Would require more FACT sizes on offer in CC but I've got a feeling that this isn't a big deal. I'm just a player though not a developer.
Brian5001
Posts: 15
Joined: Wed, 9. Dec 09, 03:37
x4

Post by Brian5001 »

actually, I'm kind of curious about what would happen if I merely changed the formula to one that merely adds the values of all ore/silicon/ice qualities, and have the production timer/amount produced, reflected in the outcome...

I'm going to mess with this and test the results to see if these assumptions are accurate. I believe that the mine outputs (time/amt) are directly related to the quality, and that if the quality's of multiple mines are simply added together, they would give the same overall output levels as the mines would achieve separately.

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