[Work In Progress] Functional Trader + stable supply/demand (0.22 final WIP)
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
-
- Posts: 259
- Joined: Sat, 23. Nov 13, 09:48
[Work In Progress] Functional Trader + stable supply/demand (0.22 final WIP)
As i mentioned in some other posts, ive been working on fixing the game in general, first was the engineer and now the trading / economy.
I have already fixed just about every trading issues i could find (cargo drone going crazy, trade ship getting stuck, mining ship getting stuck etc etc), altho it is not in the form of a mod yet, due to the large amount of changes and the fact i worked with full files to ease the work
But those fix revealed a much larger issue. The supply and demand in Albion (freeplay) is out of wack to say the least. If you let the universe run for a few hours, you end up with every station starving, and all freighters unable to find work because no station is able to produce much of anything (there is some small production going on, but ridiculously small, the kind that only use 10% of one large freighter to move).
This cause a major problem, that is even more gamebreaking than the tradenetwork not working. With the trader fixed, you cannot do any trades anymore since there is no supply available anywhere heh (npc take it all, and the demand is way higher than the supply)
I am currently running some tests / experiments to fix that, and get a proper trading network going on, not too much supply, not too much demand, in some form of self balancing system.
Stuff like station eating more when they have too much food (people are swimming in food so they waste a lot) which in turn will stabilize the food supply/demand and a similar system for energy.
Most other material have an outlet already, and that is the shipyard. The shipyard will take it upon itself to make ships whenever its not busy.
The shipyard bring another problem, there is essentially no ship dieing, so you end up with even more traders all around the place. This is due to the lack of proper "attacks", you see a xenon destroyer now and then, but it generally end up outnumbered and killed too easily. But i do not plan on fixing that part before the trading is actually working enough to get some supply / demand that player can use to trade as well.
For those interested in trying it out. While i did not make a mod of it yet, i can provide a work in progress archive of what i use to work on.
To use it, you will need to add "-prefersinglefiles" without the quotes to your launch options otherwise, many things will not load properly. I also strongly suggest you backup your save file, as there is a chance it will **** it up (altho ideally you should start a new game but well, the fix should work on an existing game).
http://www.jeypc.com/dl/tradeship_fix_wip_0.08.zip to download. Extract it in the root of your X Rebirth folder. To uninstall, delete the aiscripts, index ,assets/props and assets/units then restart your game.
Keep in mind, this is a very raw WIP version, it include a lot of changes that did nothing, and debug value (shouldn't spam your error logs tho, since they need a debugging tag set on the pilot in most cases)
Feel free to reuse/modify/ whatever the code. Credits would be apreciated, but are not required.
The WIP only include the trader fixes currently. I am still analysing the economy so there is no changes on that side currently.
http://www.jeypc.com/dl/tradeship_fix_wip_0.15.zip to download. (delete the old pck files first they were renamed to xml in 0.15)
* Most likely not save compatible with 0.08, use at your own risk. (start a new universe)
- include close to perfectly working (in my tests), non players trade ai the last remaining bug is when drones refuse to appear, but the worst scenario is 11min15sec of waiting before they undock and resume their merry way
- AI will also use their booster a lot more (will be separated in another mod once in mod release, but highly recommended to use with it as it reduce by a lot the time the ai waste in a zone).
- some wares production and cost were changed to help keep the economy stable (wares.xml included in the mod is not a diff, and include every wares for ease of editing).
- Fully rewritten custom.findfreetraderun to buy things that another station wants (so that it actually trades instead of stockpiling).
http://www.jeypc.com/dl/tradeship_fix_wip_0.20.zip
- construction ships are now given a special attention by tradeships.
-- Large freighters and XL will take the construction ship deal in priority if its able to satisfy at least 5% of its storage capacity and make a proffit (no matter if the proffit is better than stations or not and the specific ware is picked at random from what the freighter trade).
-- Small and Medium tradeships will take any offer no matter how small, from the construction ship, so long as it turn a proffit. They also do not use the reservation system (so quite a few will rush to you with random wares your ship request).
-- In my test, it took about 45mins before the first traders showed up (at which point, a shit ton showed up shortly after xD), altho that will entirely depend on the state of the economy in your universe
*** as with all my other WIP, this is not garanteed to be safe compatible with either vanilla or the other versions, it is strongly recommended you use it on a fresh universe to avoid issues.
*** The proper mod release version will ensure to function over a vanilla 1.18 altho the process to uninstall it might be slightly complicated due to the numerous changes involved in the save and command structures.
http://www.jeypc.com/dl/tradeship_fix_wip_0.22.zip
* each trader now have a watcher that keep an eye on them, if they stop moving / executing trades attempt (frozen in whatever state) for more than 20 minutes, they get a force reset done on them, which should keep everything moving quite nicely (freezes are pretty rare now, since most are either handled by my changes with interrupts, or fixed with 1.18 beta), but well, a few still happen, and until i catch them all, that at least, let the universe run (and in debug, give me info on where the ai was frozen).
* player trade should now be fully functional. Altho still need some esthetic work (some dock are hard to reach using collision, so if they cant get to the park withing acceptable time (5mins once the docking actually start), they disable the collision and just get to the destination.
** fixed the docking, the notification and 3 different case of trading getting stuck.
- As with all my other WIP there is no garantee the save will be compatible, altho an universe from 0.20 should since most changes in between are compatible or player trade related (which you can generally reset easily by removing / adding to your squad).
version 0.22 will most likely be the final WIP release. Everything should work at an acceptable level (minus a small bug where a trader with no tradenpc cannot accept ai reservation, but there is manual fix you can do about that on page 18 ).
Once the mod is completed, it should also (in theory, could end up being impossible depending on how much i can cheat around the problem xD) be able to be "uninstalled" from a save by installing, and then removing the mod once its released
I have already fixed just about every trading issues i could find (cargo drone going crazy, trade ship getting stuck, mining ship getting stuck etc etc), altho it is not in the form of a mod yet, due to the large amount of changes and the fact i worked with full files to ease the work
But those fix revealed a much larger issue. The supply and demand in Albion (freeplay) is out of wack to say the least. If you let the universe run for a few hours, you end up with every station starving, and all freighters unable to find work because no station is able to produce much of anything (there is some small production going on, but ridiculously small, the kind that only use 10% of one large freighter to move).
This cause a major problem, that is even more gamebreaking than the tradenetwork not working. With the trader fixed, you cannot do any trades anymore since there is no supply available anywhere heh (npc take it all, and the demand is way higher than the supply)
I am currently running some tests / experiments to fix that, and get a proper trading network going on, not too much supply, not too much demand, in some form of self balancing system.
Stuff like station eating more when they have too much food (people are swimming in food so they waste a lot) which in turn will stabilize the food supply/demand and a similar system for energy.
Most other material have an outlet already, and that is the shipyard. The shipyard will take it upon itself to make ships whenever its not busy.
The shipyard bring another problem, there is essentially no ship dieing, so you end up with even more traders all around the place. This is due to the lack of proper "attacks", you see a xenon destroyer now and then, but it generally end up outnumbered and killed too easily. But i do not plan on fixing that part before the trading is actually working enough to get some supply / demand that player can use to trade as well.
For those interested in trying it out. While i did not make a mod of it yet, i can provide a work in progress archive of what i use to work on.
To use it, you will need to add "-prefersinglefiles" without the quotes to your launch options otherwise, many things will not load properly. I also strongly suggest you backup your save file, as there is a chance it will **** it up (altho ideally you should start a new game but well, the fix should work on an existing game).
http://www.jeypc.com/dl/tradeship_fix_wip_0.08.zip to download. Extract it in the root of your X Rebirth folder. To uninstall, delete the aiscripts, index ,assets/props and assets/units then restart your game.
Keep in mind, this is a very raw WIP version, it include a lot of changes that did nothing, and debug value (shouldn't spam your error logs tho, since they need a debugging tag set on the pilot in most cases)
Feel free to reuse/modify/ whatever the code. Credits would be apreciated, but are not required.
The WIP only include the trader fixes currently. I am still analysing the economy so there is no changes on that side currently.
http://www.jeypc.com/dl/tradeship_fix_wip_0.15.zip to download. (delete the old pck files first they were renamed to xml in 0.15)
* Most likely not save compatible with 0.08, use at your own risk. (start a new universe)
- include close to perfectly working (in my tests), non players trade ai the last remaining bug is when drones refuse to appear, but the worst scenario is 11min15sec of waiting before they undock and resume their merry way
- AI will also use their booster a lot more (will be separated in another mod once in mod release, but highly recommended to use with it as it reduce by a lot the time the ai waste in a zone).
- some wares production and cost were changed to help keep the economy stable (wares.xml included in the mod is not a diff, and include every wares for ease of editing).
- Fully rewritten custom.findfreetraderun to buy things that another station wants (so that it actually trades instead of stockpiling).
http://www.jeypc.com/dl/tradeship_fix_wip_0.20.zip
- construction ships are now given a special attention by tradeships.
-- Large freighters and XL will take the construction ship deal in priority if its able to satisfy at least 5% of its storage capacity and make a proffit (no matter if the proffit is better than stations or not and the specific ware is picked at random from what the freighter trade).
-- Small and Medium tradeships will take any offer no matter how small, from the construction ship, so long as it turn a proffit. They also do not use the reservation system (so quite a few will rush to you with random wares your ship request).
-- In my test, it took about 45mins before the first traders showed up (at which point, a shit ton showed up shortly after xD), altho that will entirely depend on the state of the economy in your universe
*** as with all my other WIP, this is not garanteed to be safe compatible with either vanilla or the other versions, it is strongly recommended you use it on a fresh universe to avoid issues.
*** The proper mod release version will ensure to function over a vanilla 1.18 altho the process to uninstall it might be slightly complicated due to the numerous changes involved in the save and command structures.
http://www.jeypc.com/dl/tradeship_fix_wip_0.22.zip
* each trader now have a watcher that keep an eye on them, if they stop moving / executing trades attempt (frozen in whatever state) for more than 20 minutes, they get a force reset done on them, which should keep everything moving quite nicely (freezes are pretty rare now, since most are either handled by my changes with interrupts, or fixed with 1.18 beta), but well, a few still happen, and until i catch them all, that at least, let the universe run (and in debug, give me info on where the ai was frozen).
* player trade should now be fully functional. Altho still need some esthetic work (some dock are hard to reach using collision, so if they cant get to the park withing acceptable time (5mins once the docking actually start), they disable the collision and just get to the destination.
** fixed the docking, the notification and 3 different case of trading getting stuck.
- As with all my other WIP there is no garantee the save will be compatible, altho an universe from 0.20 should since most changes in between are compatible or player trade related (which you can generally reset easily by removing / adding to your squad).
version 0.22 will most likely be the final WIP release. Everything should work at an acceptable level (minus a small bug where a trader with no tradenpc cannot accept ai reservation, but there is manual fix you can do about that on page 18 ).
Once the mod is completed, it should also (in theory, could end up being impossible depending on how much i can cheat around the problem xD) be able to be "uninstalled" from a save by installing, and then removing the mod once its released
Last edited by Jey123456 on Mon, 2. Dec 13, 11:22, edited 9 times in total.
-
- Posts: 1278
- Joined: Sun, 7. Dec 03, 12:03
-
- Posts: 259
- Joined: Sat, 23. Nov 13, 09:48
if you mean the cargo drone moving the wares from the ship to the station and from station to the ship, yes it fix them.
Altho there is still one case where they wont display, its if a trade was started out of system, and then you come in the system and go look at the ship. There wont be any drone, but once the transaction time is past (a few minutes depending on how many wares), it will undock and go around its day.
The transaction when oos, are instant and then the ship just wait for the duration, so it look a bit weird when you catch it on the act.
and a "standalone" version of that is by no mean a small task xD. you essentially need all the files in the zip to achieve the functional traders (with a few exceptions). Each of those files have a few dozen changes at least.
I plan on making it in a mod that can be toggled on and off, once im done fixing the economy as a whole.
youll see if you try it out, that this fix is no good, sure the traders work, for a while, but then there is no ressources left to move around and production die out.
With it running on an universe for a few hours, youll find it nearly impossible to find anything to buy for your tradeship to make you some money either (hence why it wont be standalone
)
The mod for it will come, but it will be a few more days, so in the meantime, people who want to play with working tradeship, can use the WIP version.
Altho there is still one case where they wont display, its if a trade was started out of system, and then you come in the system and go look at the ship. There wont be any drone, but once the transaction time is past (a few minutes depending on how many wares), it will undock and go around its day.
The transaction when oos, are instant and then the ship just wait for the duration, so it look a bit weird when you catch it on the act.
and a "standalone" version of that is by no mean a small task xD. you essentially need all the files in the zip to achieve the functional traders (with a few exceptions). Each of those files have a few dozen changes at least.
I plan on making it in a mod that can be toggled on and off, once im done fixing the economy as a whole.
youll see if you try it out, that this fix is no good, sure the traders work, for a while, but then there is no ressources left to move around and production die out.
With it running on an universe for a few hours, youll find it nearly impossible to find anything to buy for your tradeship to make you some money either (hence why it wont be standalone

The mod for it will come, but it will be a few more days, so in the meantime, people who want to play with working tradeship, can use the WIP version.
-
- Posts: 238
- Joined: Sat, 7. Feb 04, 17:06
-
- Posts: 1256
- Joined: Fri, 26. Aug 05, 22:39
-
- Posts: 259
- Joined: Sat, 23. Nov 13, 09:48
If you meant, on the shipyard, then yes it does, partially. It will show drones so long as some are available, but the shipyard eat drones like candy when it build new ships to send in the wild (ill have a look at that as well, to limit the building to only when there is spare material, so that at least some kind of minimum is kept for the player to use heh).swatti wrote:Does this fix the trade-drones not showing up on NPCs? Standalone version of that would be welcome till Ego fixes them.
And there is the underlying issue that, once the initial supply of drones from the production bases is drained, the production is nowhere near strong enough to keep up, so your lucky if you see even 10 drones at the shipyard heh. (thats the part im working to fix now, but its a bit more complicated than fixing the drone production lol)
-
- Posts: 39
- Joined: Mon, 25. Nov 13, 16:16
-
- Posts: 238
- Joined: Sat, 7. Feb 04, 17:06
-
- Posts: 259
- Joined: Sat, 23. Nov 13, 09:48
-
- Posts: 1256
- Joined: Fri, 26. Aug 05, 22:39
Might help if the AI could build stations instead and prioritize that over ship building. Would make more sense for them to build stations as their economy is starving.Jey123456 wrote:The shipyard bring another problem, there is essentially no ship dieing, so you end up with even more traders all around the place. This is due to the lack of proper "attacks", you see a xenon destroyer now and then, but it generally end up outnumbered and killed too easily. But i do not plan on fixing that part before the trading is actually working enough to get some supply / demand that player can use to trade as well.
Just a thought.
-
- Posts: 259
- Joined: Sat, 23. Nov 13, 09:48
its still a bit too early in my tests to be sure, but it doesnt seem like more station would fix it, since whats lacking most apparently, are the raw resources (mining) , in my run with increased miners qty (bad solution, way too laggy, but faster for testing than changing the mining code to mine better / faster
) it seem that the economy is doing much better. But its still a bit too early to properly compare

-
- Posts: 75
- Joined: Tue, 26. Nov 13, 10:07
Concerning the xml-diff, there is this tool:
https://mega.co.nz/#!TFEDGRQB!Z0dUv3OHL ... pGL1pYs-ik
It does generate xml diffs, but not in the required format. But I think it would definitely help when trying to convert the mod files later. (If anyone wants the source you can get it from here: http://msdn.microsoft.com/en-us/library/aa302294.aspx)
Hopefully Ego releases some mod tools soon-ish, like their diff-patch library, so we don't have to reverse engineer everything.
https://mega.co.nz/#!TFEDGRQB!Z0dUv3OHL ... pGL1pYs-ik
It does generate xml diffs, but not in the required format. But I think it would definitely help when trying to convert the mod files later. (If anyone wants the source you can get it from here: http://msdn.microsoft.com/en-us/library/aa302294.aspx)
Hopefully Ego releases some mod tools soon-ish, like their diff-patch library, so we don't have to reverse engineer everything.
-
- Posts: 259
- Joined: Sat, 23. Nov 13, 09:48
i do have a diff tool already, but thats not my worry, im much more worried in the fact that any change around the file could break it hence why it will probably be full file change even tho its a bunch of small change around (well, not full rewrite, but scriptname change for most, and only a few small diff in the trade.ship etc).
But thats the last step, first i need to get it in a shape that i find good enough to be worth making a mod off. Only reason i released the wip is because i know some people don't want to wait the few days needed for me to finish it completely, before playing around with it, hence why i made it available.
But thats the last step, first i need to get it in a shape that i find good enough to be worth making a mod off. Only reason i released the wip is because i know some people don't want to wait the few days needed for me to finish it completely, before playing around with it, hence why i made it available.
-
- Posts: 39
- Joined: Mon, 25. Nov 13, 16:16
-
- Posts: 716
- Joined: Tue, 20. Jun 06, 02:29
What about instead of actually fixing the economy (which might be quite a lot of work) you do a bit of a 'cheat' and dynamically stabilize the economy.
Basically, have an engine checking on what's needed to keep the economy moving and then simply inject wares into the game. I'd probably do it by spawning a cargo ship jumping into a system, selling its goods (and immediately jumping to the front of the line) and then jumping out or something similar.
Yeah, it's cheap, but it'd only be intended as a patch until something that actually fixes the economy is developed.
Basically, have an engine checking on what's needed to keep the economy moving and then simply inject wares into the game. I'd probably do it by spawning a cargo ship jumping into a system, selling its goods (and immediately jumping to the front of the line) and then jumping out or something similar.
Yeah, it's cheap, but it'd only be intended as a patch until something that actually fixes the economy is developed.
-
- Posts: 1256
- Joined: Fri, 26. Aug 05, 22:39
report:
I can confirm it's working with old save files.
Ship dock, unload via cargolifters then undock without hiccups
Credits received, wares removed from the ship and added to the station.
The sudden CPU load after loading an old save makes me believe that the rest of the universe also realized that siesta is over.
Minor bug that the "Task complete" report stays on the small monitor on the right after the first deal and will not allow players to see something like basic ship info when clicking on a ship. Might be specific to my system.
I can confirm it's working with old save files.
Ship dock, unload via cargolifters then undock without hiccups
Credits received, wares removed from the ship and added to the station.
The sudden CPU load after loading an old save makes me believe that the rest of the universe also realized that siesta is over.
Minor bug that the "Task complete" report stays on the small monitor on the right after the first deal and will not allow players to see something like basic ship info when clicking on a ship. Might be specific to my system.
-
- Posts: 49
- Joined: Tue, 1. Jul 08, 20:10
-
- Posts: 21
- Joined: Sun, 24. Nov 13, 15:11
-
- Posts: 259
- Joined: Sat, 23. Nov 13, 09:48
because in freeplay, you dont have galaxy wide yet
. only albion and im not sure how trader will react to a jump gate. Altho enabling it is somewhat simple, if you want to test it yourself, open aiscripts/trade.ship.pck in a text editor (its just the xml renamed)
and add
<do_if value="this.ship.isclass.ship_l or this.ship.isclass.ship_xl">
<set_value name="$range" exact="this.ship.galaxy" />
</do_if>
just before line 94 (before <run_script name="$traderunscript">), this will force all large freighters (capital ships) to consider the whole galaxy, be warned that this will probably cause quite a bit of lag since i didnt smooth the code yet (its easier to debug when things happen quickly even if it mean more lag).
you can always undo it by changing the galaxy back to cluster or sector.

and add
<do_if value="this.ship.isclass.ship_l or this.ship.isclass.ship_xl">
<set_value name="$range" exact="this.ship.galaxy" />
</do_if>
just before line 94 (before <run_script name="$traderunscript">), this will force all large freighters (capital ships) to consider the whole galaxy, be warned that this will probably cause quite a bit of lag since i didnt smooth the code yet (its easier to debug when things happen quickly even if it mean more lag).
you can always undo it by changing the galaxy back to cluster or sector.