[Work In Progress] Functional Trader + stable supply/demand (0.22 final WIP)

The place to discuss scripting and game modifications for X Rebirth.

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

User avatar
Frumph
Posts: 302
Joined: Wed, 20. Nov 13, 03:12
x4

Post by Frumph »

Can you do a check for <commander type="manager"/> on those that are 'managed' by something other then player and then avoid running the player scripts?

(or have a source job) ?
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

I dont know whats causing the problem for the mining ship yet. The controlentity thing was ****** up with my debug function (so i couldnt properly debug the save).
User avatar
pilakin
Posts: 235
Joined: Sat, 16. Feb 08, 23:44

Post by pilakin »

So after taking a nap, I looked into it again now. What's causing it is the line

Code: Select all

<do_if value="$homebase.cargo.{$currentware}.count" min="1">
That's the if-clause for basically the whole transfer cargo part. so if the station has zero amount of that ware in stock, this check will fail and the whole cargo transfer is basically skipped. Theres also a dev comment right above stating

Code: Select all

<!-- TODO: change to check resources instead of cargo, so we can deal with count = 0 cases; needs adding of KW_RESOURCES -->
I don't know why count = 0 is an issue. Maybe some devide by zero stuff. Anyway if I change the check to min="0" the ship starts unloading the ore like it should.
User avatar
pilakin
Posts: 235
Joined: Sat, 16. Feb 08, 23:44

Post by pilakin »

Joleoo wrote:Trade ships such as Rahanas and Scaldis do the same, they go out, buy the stuff, but when they return they dock, undock, dock, undock repeatedly forever until i manually command them to sell their wares.
can't confirm this. assigned a rahannas to a manager. it bought food, flew back home and transfered it to the homestation.

only one thing went somewhat wrong, though. it was a huge trade, over 50k food rations. the cargo lifters got force despawned while the trade was still going on.
Last edited by pilakin on Tue, 3. Dec 13, 22:03, edited 1 time in total.
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

the 75sec wait is only on the detach, the trade (which wait till all resources are transfered normally has 8times that).

Altho i did see a few occurrence where execute_trace did seem to end before the timeout and before all resources were transfered. Sadly, without proper documentation on the function, i cant really tell what exactly its supposed to wait for (since it obviously wait for something before exiting).

Still, i need to rewrite the interrupttime function in there to consider the wares volume and not count. That will be a lot more accurate.
User avatar
pilakin
Posts: 235
Joined: Sat, 16. Feb 08, 23:44

Post by pilakin »

yeah, you're right. the rahannas just did another trade, this time with only 5k food. the drones got despawend too soon again, though. this time somewaht after 20-30 sec.
flatbush71

Post by flatbush71 »

Ok, guys, I'm still building and getting things done on my version 22.
for starters, its far better to be out of zone while trading is going on, things get completed at a much faster rate.

Building stations in X-R is much slower than other versions of X
It takes a lot longer, but is working fine for me.
This includes Phase 2 ,3 & 4.

I just acquired my surface drones and will have a go at mining, as I have a crystal station already built.

The number one thing I see that's needed, is patience on the players part.
This is much more like playing chess rather than checkers.
If you want to play fast, it may not be for you.

Jey keep up the good work.
For me the game is mostly fixed,
as all I like to do is trade, build and manufacture.
spartanheyho
Posts: 162
Joined: Sun, 24. Nov 13, 16:06

Post by spartanheyho »

You using the fix on page 18 for construction ships and station building so traders go to your construction ships or is it working without this fix? I think I may have created a conflict with UFO as I gave my construction ship UFO type commands and THEN initiated construction of a station .... only for the ship to sit there with trade ports open to accept trades for hours and hours and nothing. Only alternative was either fix on page 18 (which seems to create big performance issues) or save game editor.
Pimpace
Posts: 268
Joined: Tue, 1. Jan 13, 15:48
x4

Post by Pimpace »

@Jey123456, Dude. My problem is that IMO trades take too much time... somewhere there is a delay which could be bug... or i donno, but it's wrong. Not even a clue what causes this. I've asked that cargo drones number can speed up the process. You've answered; yes they do. Ok, but even then there are more than enough cargo drones... between a ship dock and start to trade there is a "blackhole" time, and don't know what happening. Also when you see that all the cargo drones are in use, and see that all your cargo has been sold, between that moment and when commander report that trade is complete there another "blachole" in time because it can take several minutes.

Hope you got my point. Can you explain this, or there is a chance it may be fixed?

For me not bothers that cargo ships needs time to travel its destination, maneuvering to docks, etc. But when dock is empty (no another NPC in queue) and it takes eons while trade is starting, and also when all your goods has been sold (you see that cargo is at "0", so probably lifting cargo is over) and when trade finishes, it's also takes eons.

How could we speed up this process?

you order for a trade -> trader starts to go, navigate, gets its dest. (it could take time as it needs) -> dock initiated -> start trading immediately (no delay at all) -> with x cargo drones it takes time as it needs -> then immediately report is made, trade is complete.

Hmm?
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

the delay between docking and the drones starting moving should be pretty small (were looking at a few seconds here). But yes, trading is slow by design in the game. Most of the time is spent in the 2 core trading functions and since its unknown what they do exactly, we cant replace them with script to remove the time without probably losing stuff in the process.

<execute_trade> and <detach_from_masstraffic>

Detach is a little more obvious since well, all it does is detach the capital ship from the masstraffic on the port. but execute_trade seem to do quite a few things that we dont know about (update station trades qty, cargo etc)
User avatar
pilakin
Posts: 235
Joined: Sat, 16. Feb 08, 23:44

Post by pilakin »

The "black holes" you're describing sound like the parking/unparking maneuvers.
User avatar
pilakin
Posts: 235
Joined: Sat, 16. Feb 08, 23:44

Post by pilakin »

The "black holes" you're describing sound like the parking/unparking maneuvers.
Pimpace
Posts: 268
Joined: Tue, 1. Jan 13, 15:48
x4

Post by Pimpace »

pilakin wrote:The "black holes" you're describing sound like the parking/unparking maneuvers.
No. It's not. When a cargo ship arrives, stands next to docking bay. Then backwards closing to it. Now this is the point when taking eons when commander says: starting trading. Also after this I think the time spent here is much more than should be, especially if you got enough cargo drones. Either way if you wait for this we reach another "blackhole" because at this time you see the changes of your cargo and reaches the exact amount you bought. But trading isn't over still. Here you must wait again but nothing happens. After this commander says trading complete and here you can see, your credits changing.

So as I see there are several step when some looping happens, and these delays the whole trading process a lot. :(
bbeach
Posts: 100
Joined: Tue, 24. Feb 09, 03:47
x4

Post by bbeach »

Pimpace wrote:
pilakin wrote:The "black holes" you're describing sound like the parking/unparking maneuvers.
No. It's not. When a cargo ship arrives, stands next to docking bay. Then backwards closing to it. Now this is the point when taking eons when commander says: starting trading. Also after this I think the time spent here is much more than should be, especially if you got enough cargo drones. Either way if you wait for this we reach another "blackhole" because at this time you see the changes of your cargo and reaches the exact amount you bought. But trading isn't over still. Here you must wait again but nothing happens. After this commander says trading complete and here you can see, your credits changing.

So as I see there are several step when some looping happens, and these delays the whole trading process a lot. :(
"Realism/Immersion" the captain is waiting for traffic control to clear them to unpark or any plethora of other things that large cargo ships have to deal with after offloading cargo. Things not being instantaneous help give that feeling that the world is alive and doesn't revolve around you.

"Gameplay/Design" It's expected that you will be running around doing other things while your freight ships are moving cargo.
winscale
Posts: 21
Joined: Sat, 15. Nov 08, 08:07

Post by winscale »

Jey123456, any update on when you will finish making it in a MOD? not that i am rushing you are anything :)
Endeavour79
Posts: 287
Joined: Fri, 29. Nov 13, 23:14
x4

Can't load savegame

Post by Endeavour79 »

Just installed v0.22 but can't play with it.
I mean I can't continue with my ast savegame.
The game crashes when loading at 100%.

Uploaded the save for your reference..

https://www.dropbox.com/s/wdr7170b3jin8lw/quicksave.zip

Cheers, End
winscale
Posts: 21
Joined: Sat, 15. Nov 08, 08:07

Re: Can't load savegame

Post by winscale »

Endeavour79 wrote:Just installed v0.22 but can't play with it.
I mean I can't continue with my ast savegame.
The game crashes when loading at 100%.

Uploaded the save for your reference..

https://www.dropbox.com/s/wdr7170b3jin8lw/quicksave.zip

Cheers, End
You really have to start a new game I believe.
aukai501
Posts: 80
Joined: Wed, 2. Oct 13, 12:52
x3ap

Post by aukai501 »

Have you add this( -prefersinglefiles ) into your launch option?

User avatar
hourheroyes
Posts: 346
Joined: Mon, 9. Apr 12, 05:14
x4

Post by hourheroyes »

When I add -prefersinglefiles my game starts and it sounds like it's running alright but I get no visuals. Only black screen. Anyone know whats up with thaT?
laminblake
Posts: 210
Joined: Sat, 18. Sep 10, 07:07

Post by laminblake »

Egosoft should hire you or at least pay you for your work lol

Return to “X Rebirth - Scripts and Modding”