Jump to content

(Question) How NPC trading with factories works?


Rinart73

Recommended Posts

I've got some nice idea, but I need help to understand how auto-trading with factories/mines works.

 

As I see, my steel factory trades with:

1. NPC ships on a trading routes (Steel Factory -> Servo Factory, Ore Mine -> Steel Factory)

2. Some random NPC ships that appear out of nowhere and buy/sell some stuff, from Ore to the Coal (and I don't have any Coal sources in a big radius. Only 2 trading posts that always has 0/X Coal).

 

I can't understand second case.

Is this some script that spawns random cargo ships? Or its a ships on the trading routes too, but I just can't see all routes?

Can somebody explain this to me and give an API hint. I need to track those guys :)

 

Also, how long can trade route be?

 

(Sorry for any mistakes, my English is kinda poor)

Link to comment
Share on other sites

Short answer: They're random scripts being spawned.

 

Long answer: At random a hauler is spawned, which will check all stations in the sector it's spawned in, pick one and pick a good, and then either buy it or deliver it. That's how you get Coal when Coal doesn't actually exist anywhere.

 

Complicated answer: data/scripts/sector/traders.lua

Link to comment
Share on other sites

Long answer: At random a hauler is spawned, which will check all stations in the sector it's spawned in, pick one and pick a good, and then either buy it or deliver it. That's how you get Coal when Coal doesn't actually exist anywhere.

 

Complicated answer: data/scripts/sector/traders.lua

Awesome, thanks for the answer.

 

Can I ask another question related to this theme?

 

For example we have a trade route from sector A (Ore Mine) to sector B (Steel Factory).

We enter a sector A and see that Ore Mine has 500 Ore in it.

We exit sector A and enter sector B. We stay here online for 9999 Hours. How will trade route act?

I mean, yes, it will deliver ore to the Steel Factory but until when? Until the end of time or until we will transport all 500 Ore from the sector A to the sector B?

 

What I'm trying to ask is: Does the traderoute affect goods on the factories that are placed in unloaded sectors if one end of the trade route is in the loaded sector?

Link to comment
Share on other sites

Nope. Neither affects the other really. Since the only traderoutes currently in existence are actual players.

 

NPCs don't trade, they just randomly buy and sell.

 

And if you, as a player, buy 500 somethings from a station, then jump out, those 500 somethings will never be replenished (unless you run a mod like OutOfSector Production)

 

From what I understand, all this is in the planning to do, but there are some mods that solve this issue.

 

The game itself however doesn't provide a reliable way for NPC traderoutes, or for that matter, PC traderoutes.

 

I wrote a mod that will run traderoutes within one sector (mainly because I have a sector with 30 of my factories/farms/etc in it), but it's impossible to do it across multiple sectors for now.

Link to comment
Share on other sites

Nope. Neither affects the other really. Since the only traderoutes currently in existence are actual players.

 

NPCs don't trade, they just randomly buy and sell.

 

Wait a second, so when "Improved Trading System" upgrade shows me some trading routes in the X sectors around.. this traderoutes are actually just telling me that I can buy and sell this goods myself? Trade routes between sectors are fake? Only trade routes that exist in one sector do something with the goods count on both ends?

 

As I think, its possible to simulate trading between factories out of sector (just like out of sector production mod does). But then we will soon have problem of overpopulated resources. So it needs to go somewhere.

 

As for the next "Alliance" update, as I understand devs want to keep all Alliance sectors in memory as long as one player of the Alliance online. Thats.. not very good idea, considering that game server tends to lag even with 3 sectors loaded. I mean, not everybody has a dedicated server to run the game.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...