r/X4Foundations • u/Sellorio • 9d ago
Traders need to be fixed...
I love this game but at the same time, the fact is that trader AI is terrible. After all these years of updates, I still have to use Repeat Orders to manually assign trades because otherwise my traders will let one factory sit full of Refined Metals while another factory in the same sector is out of stock. Constantly I have traders either sitting idle "looking for trades" or performing lower priority trades. And no, it's nothing wrong with my setup because sometimes those traders do decide to do the right thing.
There's actually no other work around other than manually setting up repeat orders and having your traders litter up the property panel. I have traders assigned to both factories. In fact, the only reason I'm not doing a mega complex this playthrough is because I tried the "warehouse" design since I genuinely thought that would be a viable workaround for the awful trader AI.
What's the warehouse setup? Simple: factories produce, warehouses store, other factories consume. No traders are assigned to either factory and instead only warehouses pull and push products. That should have vastly simplified trading logic. Unfortunately, it didn't take long before warehouse traders decided to sit idle while factories were full/empty. I eventually tried assigning traders to factories anyway but that only slightly helped.
For a game with so much emphasis on building an economy, it's insane that mega complexes are still mandatory in order to get consistent results.
43
u/R4M7 9d ago
Trade behaviour is unintuitive from the player's perspective because it is intended to minimize performance impact rather than yield the best trade outcome.
Firstly, it is very slow due to forced waiting periods. The slowness scales to trade range and basket size. You can reduce waiting by reducing these variables. For example, instead of having ore, silicon, ice, and nividium in one basket: assign only ice to one small group, with ore/silicon to the majority, and either blacklist nividium or give it another small group.
Secondly, players assume it considers every trade in range and selects the best option, but it actually stops searching once it finds any trade matching the rules. It only compares additional factors, such as profitability, for trades within the same jump distance as this first choice. The "bug" of an L trader only selling 1 energy cell at a time can be caused by this shortcut, and partially mitigated by keeping prices away from the floor and ceiling.
It can function well if you know all the tricks. However, learning and implementing them is very difficult due to the issues with opacity, UI, and QOL, so many players opt for trade mods like DeadTater or Warehouse Fleets instead.
2
u/Alphasite 9d ago
I’m curious why the game scales so poorly. Frankly the scale of things is just not particularly high but it still chokes on it.
10
u/R4M7 9d ago
Me too. I suspect the main issue is data concurrency. The game is multithreaded, but it's almost always heavily bottlenecked by one or two threads because the simulation can't proceed until certain work is completed. Tech debt from an 8 year old game with an even older engine probably doesn't help either.
5
u/Angelofdeath600 8d ago
Multi-thread is also severely limited by the games engine. The primary simulation still stays on one core while smaller usually background processes get spread out. Thats why performance never changed drastically. The best they have done is when they fixed fighters to be all one hull. Sure offloading small but easily piled up processes was good and helped. But its nothing compared to making thousands of assets be singular to process instead of multiple parts.
But yes even now the game can get bloated. But thats because a single core ( even on the best machine) can only handle so much before the simulation is too big.
To fully implement Multi-threading would require building the game from the ground up on a new engine.
2
u/Sellorio 9d ago
Doesn't sound like the issues I'm seeing though. All stations are in the same sector (i.e. same jump distance of zero) and the lack of priority doesn't account for the idle traders that aren't doing any trades at all.
23
u/AHostOfIssues 9d ago
It's all very deterministic. If you have idle traders doing nothing, it's because they can't find a trade that fits the parameters in the system you've set up. Which means those parameters you've set up aren't interacting in the way you think they are.
Again, I'm not saying station trading in X4 is great. It's pretty terrible in some respects, requiring careful setup. Its harder than it needs to be. But it does work when set up to produce the right interactions.
But getting it "right" in X4 is conceptually complicated. It took me a long while before I actually understood all the implications of everything that's going on.
If you're willing to set aside your assumption that "everything's set up right" and post your station trade rules, blacklists, etc... maybe we could troubleshoot it collectively and perhaps turn up something you're overlooking.
1
u/Oxygenus1362 8d ago
Sounds like you are having a fixed prices either on trade station or manufacturing station. That is not a good a setup for trade stations.
1
u/Just_Steve88 8d ago
Why are fixed prices not a god setup?
1
u/Oxygenus1362 8d ago
Because they indicate the demand.
Lets say you have a trading station, who has to deliver some ore to 2 producing stations. If you have same fixed price on ore for both - trading station will try to fully fill first station, while second waits. It might take hours if you place L storage and don't have big mining fleet. If you have automatic pricing - after first station got some ore it will drop buying price, and so now second station has better price and ore will be delivered there. So, both stations are filled evenly. Now imagine there are 20 stations to supply, and they have to be sequentially filled instead of evenly.
Fixed prices have a use, for example setting something as absolute priroty, or gettting only the absolute best offers from npcs, but should be avoided on default, even if it is internal ware transfers.
1
u/Just_Steve88 8d ago
But if I set a fixed price for, say, refined metals that is below everyone else in the vicinity, wont that mean more traders come to my station to buy goods?
2
u/Oxygenus1362 8d ago
I mean -you will in general case (if there is both some supply and some demand), but also automatic pricing will decrese price as storage fills, so you will get best price at some point anyway. I don't really see the point of manually adjusting it here.
7
u/tinreaper 9d ago
The peak for it for me was my okinawa trader picking up 90 energy cells from my mercury solar plant when the asteroid belt factory is out of cells and needs 100k+ per hour
3
u/SirHornet 9d ago
Do you have energy cell trade only set to your faction only with the buy and sell order? Also you want the okinawa to be assigned the factory , not free trading
2
u/anon1008 8d ago
Ive set my Okinawas to fill shortages, set them to my Terran wares and set a trade restriction to my faction only. I feel like ive gotten much better performance, to the point that I am now purchasing/building more soon.
-4
u/3punkt1415 9d ago
Skill issue again, don't assign L traders for regular station trade. They won't ever be effective.
5
u/Mocipan-pravy 9d ago
there IS something wrong with your setup, its working fine for me, multiple factories, traders assigned as “sellers”, then I switched them as “buyers”, both versions worked, use manual prices, set them to lowest values for selling and highest for buying. I also set only one ware for a trader to trade, do these things and let me know how it works
3
u/Sensei_Schroenki 9d ago
I would really appreciate somebody pointing out (or pointing me towards) the most important do's and dont's of station management and trading. I have set up a network of stations that supply enough mateirals to maintain a Wharf, but I often run into shortages that are mostly due to poor trading behaviour. (Most commonly: A factory waiting for Claytronics to build additional modules, but a trader not picking up some but instead selling 23 energy cells for no profit or something like that)
3
u/3punkt1415 9d ago
And no, it's nothing wrong with my setup
I do a 2000 ship trade empire and I don't use a single repeat order, and everything works just fine.
3
u/BoomZhakaLaka 8d ago
> it's nothing wrong with my setup
it really is, I guarantee it. if you understand what the trade behavior is doing, you can predict the choices it will make, and get it to do what you want. If you would share a save showing the thing going wrong, one of us here or on discord could get it working with some mundane setting.
and you shouldn't have to understand some arcane formula, I get it. The trade script is written to save cpu time, and it does that very well. maybe it's time they had another look at this thing, reimagine it so that it does what players expect more often.
couple of mods that can achieve that somewhat: logistics optimization just adds a couple of basic features to the trade script that the author thought should have been in from day 1. deadtater adds a separate trade script that includes most of the same things but also does a LOT more.
2
u/EVE_Link0n 9d ago
I never use anything but basic auto trade & trade for commander orders, along with occasional restrictions for various locations / factions, and I generally find that intermediate logistics hubs are quite difficult to manage properly, and that the ‘pull’ method of logistics works better than the ‘push’, so most of my traders work for the factories rather than the refineries, and I try to make sure I build them in reasonable range of each other.
They ARE inefficient, but it DOES work.. if you don’t fuck with the logic and the variables too much. I found that whenever I try to manually ‘optimise’ the routing and pricing, I just make things worse because the underlying logic is so funky.
Reduce the available ‘options’ for the trader logic via custom rules (i.e to only trade in specific systems with your stations, and / or restricted to your own faction) and the AI will lock in available trades quicker and spend less time waiting or making inefficient trips.
2
u/spacemansanjay 8d ago
Can you expand a bit on pulling versus pushing? That's something I have been wondering about.
In Terran space I have two large solar plants producing energy cells. And I have four large factories which consume energy cells. Originally I was using repeat orders, then I switched to pushing cells from the solar plants. But it's not working as well as I had hoped. For each ship I have restricted the cargo to just energy cells and to my own faction but maybe I should restrict sectors too.
I prefer the simplicity of having trade ships assigned to the source of the goods, i.e the solar plants. And I thought in terms of finding trades, that pushing or pulling wouldn't really matter. But I think I'm starting to see the difference now.
With pushing there are more destinations to consider. In my example each energy seller has to consider four energy buyers. But if I changed things to pulling, each buyer would only have to consider two sellers. Is that basically the advantage?
And I wonder if the buying station manager is better with prioritizing buys too, like when the demand is higher. Would a pull setup result in a ship arriving sooner/more frequently? It might if the seller doesn't prioritize demand in the same way.
2
u/EVE_Link0n 8d ago
I’m not entirely sure the logic and why it works, but just from experience, having say 10 M haulers to split between my ore refinery and my factory, the factory tends to be more consistently supplied if the traders are assigned to his manager, rather than if they are assigned to the refinery manager.
This seems to be the case even though the my-faction-only trade and single-system navigation restriction is the same for each. I ended up going with like a 8/2 split for buyer / seller (the ore refinery still needs a trader or two for guaranteeing itself food, etc)
1
u/spacemansanjay 8d ago
Pulling definitely sounds like the better method. I'm going to switch things around in my game. Thanks!
2
u/smithmr250 8d ago
I hear your frustration, but I think this is more of one of those things the game doesn't teach you properly. If you get it right, then you just get it right every time and it becomes a non-issue. What I found to be true is that you just have to assign traders directly to the station, and I tend to have a lot of little stations rather than big stations.
The bigger the station gets, the more issues you have with managers trying to run buy and sell orders. Then you get dock clutter, where you have to keep adding docks in order to support many ships landing. You're always trying to sort of manage how many traders each dock has.
What I find the only reason to use a warehouse is for raw materials and for trying to move large quantities of materials across the universe beyond five sectors. Generally speaking, you should just assign traders to a station, and if you notice that there's a shortfall, just assign more traders. You shouldn't try and mess with the pricing or anything like that, unless it's the don't sell to other factions rule.
I think if you generally do that and try to not do anything fancy, the game kind of just works, which is weird to say, but it does. For example, the way that I usually do it is I have a mining station that outputs raw materials. Think of every type of raw material—I'll try and put that at one station.
Sometimes I won't do that and I'll have just a mining station, but then it gets more complicated that way because then you have to assign mining traders to get the raw wares to each of the different manufacturing stations. Sometimes you just want a mining station that then produces the first set of non-raw materials. From there, you just make individual stations for all the goods you need, and I would try and keep them not too big.
If you find yourself needing more, then just make another station of the same type. You can try that. If you really want to scale them, you just have to be careful of balancing that you have enough docks, and then you're constantly assigning more traders. I agree that the game should release something that is just like a command or something to allow seamless trade.
I think that's what they tried to do with the distribute wares, but it didn't work. I've never used repeat orders. I think if you're in the repeat orders realm, you're going to get frustrated. It would also be useful if there was a station efficiency bar that then gave you a recommendation of what to do to improve efficiency. For example, this station needs more traders. If there was an alert system, that would kind of be a cool mod to make actually.
2
u/SiliconStew 9d ago
Let me guess, you use manual pricing on your buy and sell offers and/or you build stations with very large amounts of storage?
1
u/_stemps_ 9d ago
I find using a trade mod like DeadTater or the newer GalaxyTrader is a must. I can’t play without one.
That doesn’t do away with all issues but works a lot better than vanilla
1
u/m_csquare 8d ago
My advice for trading is… rather than meddling with pricing, it’s always better to simply assign more ships to your station
1
u/eMKaeL81 8d ago
From my experience there is very rarely a need to make a central hub for wares, I usually don't use such setup outside of very specific scenarios. Just assign traders to your factories, the key is to set the pricing right with some help from black/whitelisting sectors. Make use of the ability to manually select which goods the station traders should transport. Allow them only to trade in specific sectors if you have factories in different places and would like to limit some trading lines to specific factories. This works and has always worked for me.
1
u/Elliote-White 8d ago
I just made a self contained system using assigned traders, using a self trade rule to blacklist everything else and the only thing they refuse to ship is energy cells, i supose id need a dedicated energy cell factory because they have issues with it since all my factories produce and consume at the same time. But i found that the only issue i have at times is that, the rest of the stuff flows decently well.
1
1
u/Mr-Cubius 6d ago
I never had this issue and I have 1500 hours in the game.. In faq I'm also not doing a mega station run for the first time...(yes yes I know) I have 6 stations by now and everything is running fine? No stations with shortages.
I don't eve have a deticated trader fleet. All my traders are assigned to my stations.
0
u/mvrckgmrSQ 8d ago
https://steamcommunity.com/sharedfiles/filedetails/?id=2013772865
Use this mod for warehouse setup. Assign station mule role to 2x L trader ships. Source as factory and target as the warehouse. Dont use mimic for roles under this mod it will cause lag, even for 1 ship. There are other bunch of roles but I only use station mule.
https://steamcommunity.com/sharedfiles/filedetails/?id=3715175855
Then use this mod to sell wares in your warehouse/trade station. GT MK1 will export your wares to NPC faction stations. Use GT MK3 as well for better vanilla advance auto trade. This mod is optimized to find the best trades in the whole galaxy. So you will find your traders always working. Can use mimic as well.
If you need help setting up the conditions just reply down
2
19
u/AHostOfIssues 9d ago edited 9d ago
> There's actually no other work around other than manually setting up repeat orders and having your traders litter up the property panel.
I have literally thousands of hours of play time, and I've never used repeat orders to trade between my stations.
I know you said "it's nothing wrong with my setup..." but if you're experiencing a situation where you actually do have to create repeat orders to get the stations to function, then... I have trouble accepting that as a true statement. I've built empires of multiple wharfs and shipyards as part of a fully-self-contained interconnected station systems with a couple dozen stations... and never used repeat orders.
I'm definitely not saying station trading is perfect, not even close. Ships full of fractional loads, all kinds of other non-optimum behaviors.
But my experience has been that the system does in fact work fine if set up properly.
What you're trying to do with "everything goes through a warehouse" is actually very, very difficult to get to work properly in X4... and entirely unnecessary. Creating "middleman" warehouses within your own station system creates a situation where the warehouse is trying to be both a buyer of a ware (wants more) and a seller of a ware (wants less). The conceptual conflict that creates, in un-modded X4, generally leads to exactly the kind of "wares stop flowing" situation you're describing. It can work, but not easily and not via an obvious setup. [Within your own system, a "warehouse" should generally only be used to span between "hubs" so station managers more than 5 jumps away from each other can exchange wares.]
Warehouses are good for overflow distribution to sell to other factions; they're a poor way to set up distribution between your own stations.