[UPDATED on Feb. 24] Development info on Xai.TMK1 v2.0

The place to discuss scripting and game modifications for X²: The Threat.

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

mr_south
Posts: 35
Joined: Wed, 31. Dec 03, 19:00
x2

[UPDATED on Feb. 24] Development info on Xai.TMK1 v2.0

Post by mr_south »

[UPDATED on Feb.24/2004] It's been quite a while since I posted on this forum. It's time for some progress report. Updated information since last post are in blue, and important notes are in red.

As I proposed in another thread,
(http://www.egosoft.com/x2/forum/viewtop ... c&start=15)
we would like give out some info on our latest factory trading script development: Xai Corp. Trande Command Software MK1 v2.0,

Goal:
To create a smarter factory auto-trading software, with high performance, more features and easier management. Did we say smarter? :wink:

Current Status:
A runnable alpha version is done. We are now doing internal testing, and working towards the frist beta version. Also, the name has been changed back to MK1 since the functionalities are the same as Xai.TMK1 v1.x. (Which means, we may have something else in mind for Xai.TMK2? :wink: )

Implemented new features:
. CENTRALIZED script! The software is now running on a factory, not on individual ships. It will control all ships that belong to it. This is the major difference from all other existing scripts out there (as far as we know). Basicly almost all other new features are based on this new structure. (Hehe, I just can't say enough of it... :P )
. No more all ships racing to the same place to buy/sell the same thing! They will spread out and go to the best dealer, the second best dealer, and so on...
. After a ship bought resource, it may continue to buy from other sellers (same resource or not) if the factory is not very "hungry", and there's still rooms in the cargo bay.
. After a ship sold product, it may go to buy resource immediately, without going home first. If it does decide to go home, it may change its mind on the way back if a good seller has just been found.
. Factory ships can now completely avoid a list of dangerous sectors, not even flyby them. (Using our new Xai.lib.Fly library to replace all stock fly commands.)
. Resources already bought and on the way home are also counted when calculating urgency.
. Buy just enough the resources that the factory can store. (to prevent overflow.)
. Factory will automatically take over the control if it finds a new ship in the home-sector with homebase set to it; on the other hand, it will release the control when a ship has homebase set to another factory.
. Dynamic Menu. (Using our new Xai Corp. Dynamic Menu Template. Alot more new Xai Corp. Products or updates will use this technology, so you will know what it looks like soon enough :wink:)


Implementing new features:
. Advanced money management, which will take the current status of the factory into account.
. Re-evaluate situation periodicaly, e.g. while on the way to a buyer, if that one is no longer valid, ship will go to new buyer.
. Smarter and faster way to find buyer/seller.


Possible new features: (we are still investigating these, so no guarantee if they will be in the final release)
. Detect and report shortage/overflow, and possibly dynamic price adjustment if the player allows.
. Possible integration with ship auto-trader (Start auto-trading if the factory doesn't need the ship for the moment, and recall them back when it is needed. We tend to agree on invoking a third-party software instead of using our own. There are alot successful ship auto-trader out there, and we would like to focus on factory auto-trading only.)
. Comprehensive report including statistical data.
. Factory chain handling.

. And more...

Again, we are still investigating these features, some of them are quite possible to do, but some of them are not. Even we decide to add them, they may still come with different version instead of all at once.

OK, please post if you have any suggestions, ideas or comments. We would like to hear from anybody to improve our software. Thanks.
Last edited by mr_south on Wed, 25. Feb 04, 05:46, edited 3 times in total.
ShadowTek
Posts: 480
Joined: Sat, 20. Dec 03, 19:05
x2

Post by ShadowTek »

Dame sound incredible, I havent tried any vertion yet as I find teldi's auto trader essentual (makes me more money than my factorys do) but have always wanted to use FATE, now that your includeing a auto trader, I will be definetly switching to this awsome new vertion. I hope it comes out soon :D
Proud member of the PHPBB Network!
Feel free to upload or download X2 Mods!!
janonol
Posts: 194
Joined: Fri, 26. Sep 03, 06:32
x3

Post by janonol »

sounds great. If you need testers I'm sure you'll have lots of people willing (like me).

looking forward to it.
User avatar
Burianek
Posts: 2981
Joined: Mon, 29. Dec 03, 03:29
x3tc

Post by Burianek »

Sorry for the cross post, here's an idea for some logic that may help with periodic checking for better prices on the way to a target factory. I think you could implement it so that only one check needs to be made once per system entered. Hopefully this won't degrade system performance too much.

I'm sorry in advance if some of the logic isn't codable, I'm not a scripter and I have no idea if any of this is implementable:

Upon entering a system, the transport makes a check to see if there are other factories selling the target product both:
1. cheaper than the current target factory and,
2. closer than or same number of jumps away as the current target

Solves two problems:
1. hopefully only one check per system per transport won't affect performance.
2. stops endless loops I had with teladi 2.2c where my transport would keep switching destinations so often it never actually arrived anywhere.

Anything I can do to help you guys turn out your fantastic script, let me know.
mr_south
Posts: 35
Joined: Wed, 31. Dec 03, 19:00
x2

Post by mr_south »

Burianek wrote:... I'm sorry in advance if some of the logic isn't codable, I'm not a scripter and I have no idea if any of this is implementable:
No need to be sorry at all. This is exactly my intention to start this thread: gather ideas from everyone. It doesn't matter if they are codable or not, what matter is we can try!
Burianek wrote:Upon entering a system, the transport makes a check to see if there are other factories selling the target product both:
1. cheaper than the current target factory and,
2. closer than or same number of jumps away as the current target

Solves two problems:
1. hopefully only one check per system per transport won't affect performance.
2. stops endless loops I had with teladi 2.2c where my transport would keep switching destinations so often it never actually arrived anywhere.
This is a good suggestion, and we actually had thought about it too. Yet at current stage, I would prefer an even simpler way first: on entering each sector, check the current target, if it's still valid, continue; if not, find another dealer. It uses much lesser computation, and also makes sure there won't be endless loops as you described. If this still apears to be too stupid, we may try the way you suggested.

And I appreciate all the supports out there. When the time comes, we surely would like to have you as our beta testers. Although I don't want to disappoint you, I have to say it again, it is still far far away :P
ShadowTek
Posts: 480
Joined: Sat, 20. Dec 03, 19:05
x2

Post by ShadowTek »

Ok, well when you are ready for beta testers...sign me up!!
Proud member of the PHPBB Network!
Feel free to upload or download X2 Mods!!
User avatar
3iff
Posts: 1085
Joined: Thu, 23. Oct 03, 09:52
x2

Post by 3iff »

Sounds even better than Xai Trading Mk1 (well, it have to, wouldn't it).

It struck me last night that it was a pity that a ship had to return to base before going to buy resources...you've also thought of that, so a ship might be able to deliver energy to a crystal fab and pick up a supply of crystals at the same time.

Also the problem that a ship might set out to pick up 500 units of something and only get 100. It would make perfect sense to pick up other needed stuff from the same sector/area before returning home. This ability would make long trips (over 2 jumps) far more efficient. As we all know, a trip might take 20 minutes and the ship just manages to get a few items. If it could fill to perhaps 75% before returning it would mean less trips and better factory stocks.

Oh, and getting the station to command its supply ships means that two ships won't race to the same factory for the same produce. In a way it's a bit like factory based autotrading. Excellent ideas!

I really hope that's all possible and that you can code it.

I'll be happy to help test it for you if/when you need testers...
merle
Posts: 48
Joined: Sun, 2. Nov 03, 15:57
x3tc

Post by merle »

And make the script purchase a replacement ship if one is lost ....

Maybe an option for granting the ships access to the Player account. I hate having idle money at all factories.
User avatar
Burianek
Posts: 2981
Joined: Mon, 29. Dec 03, 03:29
x3tc

Post by Burianek »

One idea which I can almost guarantee isn't implentable:

Instead of writing messages to the message log, it would be really cool to somehow tie them into one of the monitors. I can imagine riding around in my elephant, with one monitor tied into an external view and another tied into this cool display of scrolling text of my transporters telling me what they're up to...
"Nature's first green is gold" . . . stay golden.
mr_south
Posts: 35
Joined: Wed, 31. Dec 03, 19:00
x2

Post by mr_south »

merle wrote:And make the script purchase a replacement ship if one is lost ....
Well, not sure about this one. It's doable, but would it be too smart and leave player nothing to do? :)
merle wrote:Maybe an option for granting the ships access to the Player account. I hate having idle money at all factories.
Yes, we are working on the advanced money management, which is not just transfering money for a fix threshold, but actually assess the current status of the factory and then decide how much money shall be transfered.
Burianek wrote:Instead of writing messages to the message log, it would be really cool to somehow tie them into one of the monitors. I can imagine riding around in my elephant, with one monitor tied into an external view and another tied into this cool display of scrolling text of my transporters telling me what they're up to...
Hehe, it's certainly no doable with scripts. I even doubt if it could be done with KC.
Soesma
Posts: 7
Joined: Tue, 10. Feb 04, 11:48
x3tc

Post by Soesma »

Before heading for the best dealer, would it be possible to check first if a player factory is supplying the ware. Choose to buy there at whatever the price is rather than going to a competitor who might be selling at a lower price? I know I'm greedy, but I'd rather all profits end in my account one way or another, rather than one of my competitors out there?
mr_south
Posts: 35
Joined: Wed, 31. Dec 03, 19:00
x2

Post by mr_south »

Soesma wrote:Before heading for the best dealer, would it be possible to check first if a player factory is supplying the ware. Choose to buy there at whatever the price is rather than going to a competitor who might be selling at a lower price? I know I'm greedy, but I'd rather all profits end in my account one way or another, rather than one of my competitors out there?
Yep, that's what "factory chain handling" is all about. It should be doable and we will consider adding it.
User avatar
Burianek
Posts: 2981
Joined: Mon, 29. Dec 03, 03:29
x3tc

Post by Burianek »

Out of curiosity,
where did you settle on the trade off dealing with frequency of checks?
For instance, if you check / revise your destination "think too much" system performance slows down.
Not enough, you go to suboptimal locations. I know there's no right answer just wondering if it's possible without getting into too much detail to mention how you addressed this issue.
"Nature's first green is gold" . . . stay golden.
User avatar
Rakeris
Posts: 407
Joined: Wed, 31. Dec 03, 04:25
x4

Post by Rakeris »

:o :o :o :o :o
wow


I can wait for that.
If you want a beta tester I'm allways open.
Aurielius
Posts: 21
Joined: Fri, 19. Dec 03, 07:41
x2

Post by Aurielius »

Well if end user wishes are open, then it would be nice if there was a priority bias towards owner factories when searching for best buy, within a minor price range.
Also a Sector Trader that preferred player factories/goods over NPC's
"Audentis Fortuna iuvat, experto credite"
Virgil 450BC
mr_south
Posts: 35
Joined: Wed, 31. Dec 03, 19:00
x2

Post by mr_south »

Burianek wrote:Out of curiosity,
where did you settle on the trade off dealing with frequency of checks?
...
To ensure the speed, a ship on the way to a dealer performs two simple checks at every cycle (roughly 10s): check if the dealer is still buying/selling the ware; check if the price at the dealer is still within limit. If one of the checks fails, the ship will stop heading the non-valide dealer and do whatever is good at the moment.

This strategy is very effective and yet has almost no additional performance cost. I had it logged every "chang-of-mind-event" last night, and there were more than 50 entries in less than one hour (game time) for one factory! :D
Dragonslayer wrote:If you want a beta tester I'm allways open.
Sure, and TIA :) I will update this thread when it is ready for open beta testing.
Aurielius wrote:Well if end user wishes are open, then it would be nice if there was a priority bias towards owner factories when searching for best buy, within a minor price range.
Yes, we are considering how to handle factory chain. Some players prefer having an "absolute bias", that is the owner factories are always the first choice if they are within jump range, no matter the price. This might also be easier to manage. How do you think of that?
Aurielius wrote:Also a Sector Trader that preferred player factories/goods over NPC's
:? By "sector trader", did you mean the wandering trader like Teladi or TCSMKIII? If so, it may disappoint you because we decide NOT to add our own "sector trader" (ship auto-trader) to this software, but to call a separate software (like Teladi) when it is appropriate. We would like to focus on factory auto-trading.

(EDITED: Some of our group members do have their own ship auto-trader software developed. They will be released separatedly so that players can choose whichever they like most, freely. All-in-one is good, but we favor freedom or choice more :) )
User avatar
Burianek
Posts: 2981
Joined: Mon, 29. Dec 03, 03:29
x3tc

Post by Burianek »

here's a thought:
Have you guys ever experimented with forcing the AI freighters to use your scripts to manage their factories? It's laughable that an AI freighter will pick a SPP 9 sectors away because the price is 1 credit less and then the trip takes 30 min, energy is long gone by the time it gets there, you get the point. The computer AI for factory management is comical.
Maybe you guys could write a 'quick and dirty' watered down script for the AI to run that makes them somewhat more efficient. Not quite as good as the one the player uses, but at least some simple logic to it.
I wonder if it would make the game more or less fun if the computer factories knew what they were doing. On the one hand, it might make the supply/demand situation more realistic. On the other hand it might make the game more difficult. I dunno, something to think about.
Subject of course, that you could actually set the default script the computer uses.
"Nature's first green is gold" . . . stay golden.
duckduck
Posts: 5
Joined: Sun, 23. Nov 03, 09:36

Post by duckduck »

Hi

Would it be possible to use the jumpdrive for traveling rather than the "snail" drive?

This would of course mean that no station is more that 1 sector away (in travel time / distance)=> fewer (and slower = cheaper) ships needed to keep a station operational (but bigger overhead of course due to the cost of energy cell).

Other benefits are:
1) Quicker response time when a station is about to run dry
2) Lesser (due to the shorter travel time) chance of a price change when selling/buying.
3) Better pricing since you can buy/sell stuff from sectors farther away than with "snail" drive
4) Less chance of being attacked since we only travel 1 sector in total
5) Jumpdrive could be used to escape an attack.

I'm currently using a modified version of the Xai.TMK1 v1.x. with jumpdive support and it works fairly well but of course have all the drawbacks mentioned in the first post of this tread (+ some new ones I added :-)...all in all I'm quite happy with it...but Xai.TMK1 V2.0 with its new buying / selling logic + jumpdrive support would be great.

/duck
User avatar
oolon
Posts: 406
Joined: Sun, 8. Jun 03, 14:43
x3tc

Post by oolon »

Your timer delay for checking change of destination events I hope its a random 10-15 seconds, using random wait times helps prevent the game developing a nervious tick after being reload (when all the scripts are running in time).

James

Return to “X²: The Threat - Scripts and Modding”