I'm running the OK Trader 1.7.0 version in my Litcube Universe. In the beginning i had five OKT running without any performance issues whatsoever, but now being 2 days into the game the traders cause unbearable lag - i even had a lockup when trying to use the OK traders to resupply my dock (dockware manager). Especially when on time acceleration one can see when one of the trader calculates and starts a new run theres a lag spike.
Does anybody else have this happen to them ? Might it be caused by having satellites in all sectors non-threat sectors?
I have about 50 (most of them fully upgraded to level 25) UTs going about their business. As opposed to what many are saying, the vanilla UTs seem to work just fine to me for universal trading purposes, they run when attacked, they buy and drop fighter drones, they make good profit and almost never get stuck (one in 10 traders may get stuck in the first few trade runs/levels but it depends on the sector anyway). Maybe XTC has improved their algorithm and I haven't had fresh experience with real vanilla UT :)
In any case, I expect that once I have my first complex I'll be at the mercy of my UTs to have its products sold and have it stocked with resources. I assume that even if I assign a homebase to the complex for the UTs, their logic won't change and the only way to get my stations supplied would be to buy and start more UTs.
That's where your and other people's scripts come into play. CAG is incompatible with XTC (requires some patching), Improved MK3s is also incompatible (although listed as compatible on the XTC 2.0 compatibility list thread). Your script seems to have been developed and tested with XTC so it seems like the ideal candidate for station trading support needs.
Do I need to do something special to get it working properly on an existing game? Will it "just work" if I start enabling it for existing UTs (most of them fully upgraded like I said)? Will the OK trader profitability work with the XTC statistics center where it displays each trader's profit?
To operate as free traders / UT you'll need to clear the homebase setting before enabling the OK trade command. With a homebase set the ship will trade a configurable set of wares for its homebase, prioritizing the ware to trade by stock levels, whereas the free traders prioritize by profit. Free traders also have an economy boost (eco mode) toggle where the free trader will prioritize trading with non-producing factories.
I haven't coded explicit support for the XTC statistics center so wouldn't expect that to work. Though there's a chance if it's implemented generically by hooking a buy/sell event that the center may recognize their trades.
OK traders in free trader mode track their profit and report this in the OK trade menu. There's one global counter that shows a balance for all traders, and one local counter for the trader itself. Both can be reset to zero.
Do be aware that if the trader needs to initially buy any equipment the trader's balance may go in the red before it earns enough to go back into profit.
I haven't played X for many months, please let me know if anything is broken.
So now I'm spending all the money my UTs are making on building an army instead. Ships at least are mobile :)
I'll let you know how it works when I decide to bite the bullet.
also setting things like m1 and m2 to ok traders causes massive lag i dont think the script knows how to use them properly . stick to haulers lolShimrod wrote:Check if OK's debug mode is enabled in its menu, the logging causes massive lag.
Good to hear it works (for a while) with LU, I haven't tried it yet.
So now I have a single Caiman homebased OK Trader doing all the supplying for the equipment dock, it works beautifully (although it doesn't seem to know to do multiple buys per trade run, it only buys one type of goods in a trade run which again is very inefficient with military shields because you normally get only one or two of those and still have lots of room left in the cargo hold).
Seeing how that worked pretty well I started converting my 11 Caiman dedicated traders of a personal tech producing complex hub. In this case, the vanilla supply commands worked OK (compared to the equipment dock) because I only had a few goods to sell and distributing the goods to sell among the 11 homebased Caimans works reasonably well. But I now converted them to OK traders and it seems they are doing a much better job, making more profit than before.
Finally, I started converting some of my 75 fully upgraded UTs to free OK Traders (non-economy support mode). They also seem to be making some profit although it seemed rather slow (about 3 mil credits for 20 OK Traders in about 30 minutes of gaming, I think the UTs made more). It's likely that the free roaming OK traders aren't as efficient because they compete along with the remaining UT traders to make profit since there is no "communication" between the 2 scripts and they don't avoid repeating trade runs.
Anyway, overall it seems like a VERY well written script, really impressed, high quality work.
Now the bad part:
- OK traders do not register at all in the Xtended statistics pages
- they are not listed on the "list all traders" page
- they don't have a category on the "list traders of certain type" page
- they don't show profit stats in the "configuration" page of xtended (additional commands section of the ship)
I'll try to look into this problems. Especially the "list all traders" and "list traders by type" would be very useful for me. Fixing the profit tracking would be nice too. I know OK traders have their own profit tracking but it's much better to get a listing of all traders and the profit value for each like Xtended does, rather than going through all of the 70+ traders and checking each one's profit in the OK trader menu.
Let me know if you are interested in those fixes :)
Code: Select all
Loading C:\Program Files (x86)\EGOSOFT\X3 Terran Conflict\scripts\glen.trade.ok.menu.xml... Load failed! Error while loading file: C:\Program Files (x86)\EGOSOFT\X3 Terran Conflict\scripts\glen.trade.ok.menu.xml: Error on line 701 - Unknown command ID '1579' Load failed
EDIT: I used the game SE to load that script and take a look at it. I now know that the balance of each OK trader is saved in the state array (a local variable named 'glen.ok.trader') at index position 7. I also see that it can either be an array (for large value support) or a simple integer. I've started changing the Xtended code to support OK traders. Made some progress so far on the ship detail page.
The trader's local balance is in a local variable:
Code: Select all
053 $State.Balance = 7 470 | $State = array alloc : size = 30 471 | [THIS] -> set local variable : name = 'glen.trade.ok' value = $State 480 | $State [ $State.Balance ] = 0
The global balance is in a global:
Code: Select all
035 $Config.Global.Balance = 18 106 | $Config = array alloc : size = 100 107 | set global variable : name = 'glen.trade.ok' value = $Config 124 | $tmp = create new array , arguments = 0 , 0 , null , null , null 125 | $Config [ $Config.Global.Balance ] = $tmp
Beware that this value is an array containing a pair of signed integers. The first element idx counts billions (1,000,000,000), and idx is the remainder. Ref:
BigInt.Add: - Add or subtract from a bigint (i.e the array)
BigInt.Format: - Format the bigint as a string, comma separated
Format.Balance - Format the value in green or red depending on positive/negative.
Originally the value was just a single integer, which is why you may see some compatibility logic that tests whether it's an int or an array here and there.
Actually, since I don't need to modify your code (I only needed to read it to understand where the profit was recorded, etc) I won't need to recompile your scripts and so probably won't need AP. I also can't use X-Studio v1 because it asks for admin password (what's up with that?) and X-Studio v2 has some bug where it can't load Twares.pck (already known to the author, waiting for a fix).
Thanks for the heads up that it's always an array and the conditional code was for backward compatibility, this might explain why when trying to use the profit value (array) as it is in the Xtended detail ship display the game hangs. Since Xtended doesn't have BigInt support for per-trader profit (and I think it wants an integer not a string) I may just get the second value of the array and if it wraps... well, bad luck :) Anyway, this is per-trader profit so much less likely to overflow.
Just for browsing the scripts you might get away with just opening the files in a web browser, with x2script.xsl in the same folder. Though its possible the TC scripts\x2script.xsl doesn't understand AP.
Agree on the wrap around, not a big problem. I think I did the 64 bit enhancement just for the challenge of it, I wish I had that much spare time on my hands nowadays
(buying AP is not the issue, buying from Steam is the issue, I bought X3/TC in one form or another about 3 times already, and I promise, if anyone is listening, that I will buy AP 5 times and gift 4 of them on this forum if it ever gets to be DRM free on GOG!)
BTW, I did notice significant stuttering in my game yesterday, about the time I started having a large number (>50) of free OK Traders. Almost everything I do (like slowly turning in an M7) stutters every second or so. My machine is pretty good (Nvidia GTX 780, i5 3570k OC-ed to 4.4Ghz).
I have a bunch of other scripts (SEWN which is configured to check for enemies every 20 minutes, dockware manager, Ship Browser) but it only started to stutter last night so I'm somewhat confident this is OK Trader related. In the worst case I may have to give up using OK Traders for free roaming traders and just use them homebased as a CAG replacement. The built-in UTs are very decent in my game (almost never get themselves killed, probably because I'm not enemies with the pirates) but was looking to turn in a larger profit if OK Traders are better :)
I looked a bit at the code and it's doing a bunch of random sleeps between steps in the trader scripting logic, I may try to boost those values up and see if it helps. If not, an alternative would be to use a single "queue" (sorted chronologically) of events that need to be processed at a certain time and have a single script/loop read and process them for all traders (so each trader logic becomes a state machine) instead of a script instance/loop per trader doing sleeps.
Did you remember testing/running with many (>50) free roaming OK traders?
- - change the Xtended Mod ship statistics page to show OK trader profit
- change the statistics center to also list OK traders in the "list of all traders" page
- changed the "list traders of a given type" page to have a subsection, "list all of OK Traders" where you can see just the OK traders you have
Download it here.
- - changed scripts/plugin.XTC.STC.Ship.det.xml to show OK trader profit in the ship detail page
- changed scripts/plugin.XTC.STC.Ships.xml to include OK trader profit if an OK trader ship is in the given list of displayed ships
- changed scripts/plugin.XTC.HK.08.StatisticCenter.xml to consider OK traders as a trader ship and to add the additional "list all of OK traders" specific trader type
- changed t/7212-L044.xml to add text for the new submenu entry, I used text ID 690 that shortly followed the existing submenu entries and was available
Yes the waits at the following points are a good place to try tuning.
Code: Select all
Note that economy boost mode uses its own method which lacks wait calls. I never used a lot of these, I expect I'd need optimized.
Code: Select all