[MOD] NoCargoDrones <-- need testers

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

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

bbeach
Posts: 100
Joined: Tue, 24. Feb 09, 03:47
x4

[MOD] NoCargoDrones <-- need testers

Post by bbeach »

This mod prohibits spawning cargo drones.

Trade times are calculated based on the number of drones on the trade ship and the amount of wares being transfered, but those drones are never actually spawned.

If you have no drones, the trade will still go through but would take twice as long to transfer cargo as if you had 1 drone.

I'm 99.9% sure this will keep the economy from locking down due to stuck freighters clogging stations (which is happening to many of us on 1.17).

I need people to test and see how it goes in the long term :). Please report any problems here.

If you try this on existing saves, it may take a while for the old functions to time out and things to start moving.

ALWAYS BACK UP YOUR SAVES BEFORE INSTALLING MODS.
Latest: https://dl.dropboxusercontent.com/u/800 ... es0.02.zip

Old:
https://dl.dropboxusercontent.com/u/800 ... es0.01.zip
------------------------

Also, while doing research for this mod, depressingly factions besides the players don't actually have or use money :( If anyone can find anything different please let me know. But in my savegame file the only <account> belongs to the player or subordinates.

99% of the time it took me to build this was trying to figure out how to add and deduct money from the NPC/faction accounts. Come to find out I'm pretty sure they don't exist. :(
Last edited by bbeach on Wed, 27. Nov 13, 17:34, edited 1 time in total.
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

Before you end up spending too much time on this.

I already have a wip that is very close from completion that fully fix the trading (including the drones but instead they work as they are supposed).

Right now im just optimising the trade a bit so that the economy can actually work in freeplay (seem we have way too many traders around for the production lol).
bbeach
Posts: 100
Joined: Tue, 24. Feb 09, 03:47
x4

Post by bbeach »

Cool! I still think this might be useful for some of the people having performance problems. Each one of those drones take an ai script to run (oos or not).
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

true that they are somewhat of a performance cost, but not that much honestly (and when oos there is no drones as can easily be seen if you jump in a system and rush to a trade in process).
bbeach
Posts: 100
Joined: Tue, 24. Feb 09, 03:47
x4

Post by bbeach »

Yeah but the ai script for them is still running, even though you can't see them.
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

no thats the thing, when the trade is oos, its basicly doing what your doing. There is no drone created or controlled (thats why you cant see them even if you go close after coming in a system).
bbeach
Posts: 100
Joined: Tue, 24. Feb 09, 03:47
x4

Post by bbeach »

The difference is that my script only runs 1 copy for the entire trade. Vanilla the move.dockat.drone runs for each of the drones needlessly.

I'm not saying it's a HUGE issue. But each script does take cpu cycles to instantiate. Combined with other performance tweeks it could help. :)
BlueWulv
Posts: 238
Joined: Sat, 7. Feb 04, 17:06
x4

Post by BlueWulv »

Ah, great news, I started yesterday with the same idea :D
No Drones - speed depends on amount of drones - even the doubled amount of time if there is no cargo drone :D

Well, I just started yesterday with modding X Rebirth (hey, I already had some knowledge: back in 2004 I wrote a small ai script xD) and was first trying to somehow fix the cargo drones not appearing issue but could not find a solution. I am looking forward to see Jey123456s solution.

My test case was the plot construction ship which only docked at stations and did nothing afterwards.
Could both of you see the same problems?
1. <execute_custom_trade> did nothing, script just stucks after the call
2. and a call of <detach_from_masstraffic object="this.ship" wait="true" /> did the same?

Do know what "masstraffic" does?
Last edited by BlueWulv on Wed, 27. Nov 13, 09:46, edited 1 time in total.
redshift690
Posts: 35
Joined: Tue, 26. Feb 13, 20:43
x4

Post by redshift690 »

I was at first very excited to see this, and will be testing it on a new save. But the last part of the OP is a bit disheartening to say the least. Thank you for the time you put into this. :)
User avatar
Fumblesneeze
Posts: 75
Joined: Tue, 26. Nov 13, 10:07
x3tc

Post by Fumblesneeze »

About that last part: it's true. Only the player faction has an account in the vanilla game, his employees have references to his account. Player Managers and Player Architects however can have their own accounts, I am looking into these things for my factions mod. ;)
bbeach
Posts: 100
Joined: Tue, 24. Feb 09, 03:47
x4

Post by bbeach »

We could add accounts to NPC factions and stations with or with out egosoft.

Making it actually run without the universe dying after x number of hours is another story.
csaba
Posts: 1256
Joined: Fri, 26. Aug 05, 22:39
x4

Post by csaba »

As credits cannot be generated (there are no banks :lol: ) and mineable resources seem to refill after a while it would be breaking the economy for factions to have accounts as after a while the economy grows bigger then the amount of credits in circulation while there is no inflation/deflation mechanics in the game.

Look at it as a resource based economy where credits are only an intermediary and the faction's wealth is only determined by the goods they produce.

No tax havens in X Rebirth where people only get rich by having accounts full with imaginary money they cycle in imaginary derivatives. :shock:

X got rid of Capitalism, good for them I say. :lol: (Probably not intentional by the Devs though)

I'll test this mod later today. Thank you for posting!
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

as it is right now, even if you have fully working trade ship, the production is nowhere near sufficient for the tradeship to have work to do xD.

To have good looking trading going on, it will probably require reducing the ammount of tradeship by quite a lot (i am still doing some experiments), but for instance, in my test, after the universe running for about 8 hours in freeplay (only albion) systems were filled with each of their freighters (zone with a food farm ended up with 15+ capital freighter waiting for food to be produced to sell it xD)

It was not that the trading didnt work in that case, the ships were all trying very very hard to find traderoute, but the supply was too low to support the fleet so most end up just waiting here, and when they moved, they only had 2000ish food ration out of their whole 200000 hull heh.


I'm doing some tests right now to let freighter temporarily abandon their job and go help whichever ressources need more moving when there is too many waiting for no ressources (so that if the problem is in the trading and not production, then it will fix it by spreading the workforce)

But if that doesnt help, ill have to have a look into increasing the supply on many things to allow for albion to actually function, otherwise you end up with most stations out of food and ressources.
darkone264
Posts: 100
Joined: Wed, 27. Nov 13, 10:54

Post by darkone264 »

after an hour with this mod on I am pretty sure npc trades are occuring however station info on their wares has not changed neither has the amount of cargo in the freighters ( only checked the ones currently docking not the ones in queue) since the trades appear to be occuring but the values are not being updated even if a trade completes the next freighter doesn't move into position this could be because the ofer to sell X number of goods is no longer valid and has been met by the ship before them so the freighter pile up is still occuring and creating trade orders to your ships since it is based on inaccurate info do not happen.

the evidence i have that trades are occuring is at shady vault yesterday when i went to buy a mining ship there were no drones availible after half an hourish drones became avalible so it seems to kind of work but..
BlueWulv
Posts: 238
Joined: Sat, 7. Feb 04, 17:06
x4

Post by BlueWulv »

Tested with my construction ship.

Sell 34k foodrations to NPC station
=> Trade will be executed
=> but player money will be reduced
=> cargo on my ship did not change (had 120k foodrations before and after)
=> the same offer of the stations reappears (stations buys 34k food with +18% base value)


EDIT:
Log

Code: Select all

[=ERROR=] Error in AI script trade.dotrade on entity 0xBD1E: Property lookup failed: $tradeoffer.buyer
* Expression: $tradeoffer.buyer
[General] ======================================
[General] ======================================
[=ERROR=] Error in AI script trade.dotrade on entity 0xBD1E: Property lookup failed: $tradeoffer.seller
* Expression: $tradeoffer.seller
[General] ======================================
[General] ======================================
[=ERROR=] Error in AI script trade.dotrade on entity 0xBD1E: Property lookup failed: $tradeoffer.ware
* Expression: '%1 %2 transfered no cargo with the seller.\n'.[$debugoutput, $tradepartner.knownname, $amount, $tradeoffer.ware]
[General] ======================================
[General] ======================================
[=ERROR=] Error in AI script trade.performtraderun on entity 0xBD1E: Property lookup failed: $tradeoffer.unbundle
* Expression: not $tradeoffer.unbundle
[General] ======================================
[General] ======================================
[=ERROR=] Error in AI script trade.dotrade on entity 0xF40: Evaluated value 'null' is not of type component
* Expression: $tradeoffer.buyerentity
[General] ======================================
[General] ======================================
[=ERROR=] Error in AI script trade.dotrade on entity 0xF40: Object is neither a Container, Storage Module, CollectableWare, Asteroid or Crate!
* Expression: $tradepartner
[General] ======================================
[General] ======================================
[=ERROR=] Error in AI script trade.dotrade on entity 0x4451: Property lookup failed: $tradeoffer.buyer
* Expression: $tradeoffer.buyer
[General] ======================================
[General] ======================================
[=ERROR=] Error in AI script trade.dotrade on entity 0x4451: Property lookup failed: $tradeoffer.seller
* Expression: $tradeoffer.seller
[General] ======================================
[General] ======================================
[=ERROR=] Error in AI script trade.dotrade on entity 0x4451: Property lookup failed: $tradeoffer.ware
* Expression: '%1 %2 transfered no cargo with the seller.\n'.[$debugoutput, $tradepartner.knownname, $amount, $tradeoffer.ware]
[General] ======================================
[General] ======================================
[=ERROR=] Error in AI script trade.performtraderun on entity 0x4451: Property lookup failed: $tradeoffer.unbundle
* Expression: not $tradeoffer.unbundle
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

we dont know fully what happen in the execute_trade / custom_trade function. There could be parts of it we cant script (cant skip the drones for),

I can confirm that drones did show up with my version of the fix (still wip / not cleaned to be a proper installable mod but we could be looking at less than a day for it to be done depending on how busy work is today heh).



I finished my test on the whole economy thing, and there is definitly a lack of production going on xD. after letting the universe run for about 10 hours on a fresh freeplay universe and adding some extra debug to my traders output so that they list / buy anything if they cant find any of what they are looking for for too long.

Turn out... i had 98 capital freighters (and countless smaller ones), waiting for trades to open up, and a grand total of 8 trade offer of very small amount heh.

I'm hoping the only bottleneck is the basic resources (mining ice/mineral/gas etc), so i restarted a new universe with 8 times more of all mining ships (a little over 1500 mining ships haha. quite a sight in the start system and to watch them all rush to their mining location afterward haha, highway were filled to the brim !)


I will see after work today how its been and how the economy is. If its actually able to produce resources in qty sufficient to keep the freighters busy and the shipyard geared then ill start cleaning the code and make a proper mod out of it. The mod will probably be a total replace/rewrite since adding little replace everywhere for all those changes would be subject to break quite a lot from patches (and anyway, you'll need a new universe for it to really work).


My goal with the game, is to make it work like i expected it to work at release, thankfully the modding system give enough flexibility to actually achieve that !. But it also mean, i do not plan on giving all that much support to my mods outside of getting them to work for me. If i encounter a bug ill fix it but thats about it.

Once im done with trading, my next step will be to fix combat (capital ship combat especially), we have some great progress with the manual control and the defence officer rewrite available, but it still require too much player operation, and also only aim to fix the issue from the player point of view.

I want to follow the core concept of the game, where you dont need to order your ships around, and just need to tell them what you expect them to do, and the ai take care of the rest. I do not want to have to order my ship to escort / attack everytime i want it to fight.

If i tell him to defend, i expect him to go all gun+drones blazing on anything that attacked any of my properties. If i tell him to attack, i expect him to attack whatever enemies come within a certain range of him. But not just that, if the enemies are too strong for him and im not around, i expect him to retreat. And lots of other high expectations i had of the games that were greatly let down at release >< lol.

Its good that i like fixing bugs nearly as much as i like playing games and that the game give us the tools needed to fix them !
darkone264
Posts: 100
Joined: Wed, 27. Nov 13, 10:54

Post by darkone264 »

update npc traders are infact trading, trade offers and freighter cargo is not being updated went back to shady currently 1.5 hours after mod was installed and the drones are restocked including the ones I bought with my mining ship
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

so the update every 2hours ish does update everything. but forcing a cargo move between the objects doesnt cause said update to happen (which execute_trade does).
BlueWulv
Posts: 238
Joined: Sat, 7. Feb 04, 17:06
x4

Post by BlueWulv »

Ah, now the forum is buggy too (cannot click on reply, have to use quote)
Jey123456 wrote:we dont know fully what happen in the execute_trade / custom_trade function. There could be parts of it we cant script (cant skip the drones for),
Yeah, that really sucks and was the reason why I tried to fix the drones but failed to do so...

I am worried about the blocking <detach_from_masstraffic> calls too (there are several in the trade scripts). I don't know what they are good for but they totally block the script in my test case.
(blocking) Instruct object to detach from mass traffic, e.g. after executing a trade order - OK to call for ships that don't use mass traffic as well
Seems not ok to call ;)
Jey123456
Posts: 259
Joined: Sat, 23. Nov 13, 09:48
x4

Post by Jey123456 »

i would suggest leaving them there in your mod, but change the wait to false. when wait=false, it undock close to immediately

In my case, i fixed the drone using quite a set of various changes. Removed/reduced their collision (cant remove them completly without figuring out the xmf i think), improved their engine, added timeout to the calls, and a bit of code that even if a drone end up abandoned due to the timeout, it doesnt get stuck in the "isused" state.

Altho since my changes to the transport drones, i havent seen any actually glitch out and become unable to come back, even the complicated paths like the mining ship (where the drones need to actually turn to move the goods).

Detach from masstraffic with wait=true essentially wait for all the ship drones to be back home, and then continue (but it doesnt seem to always work properly, so i use a timeout interrupt as a failsafe)

Return to “X Rebirth - Scripts and Modding”