Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[RELEASED] TradeSys 2.x - A trading and manufacturing system

Discussion in 'Assets and Asset Store' started by CallumP, Mar 2, 2013.

  1. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Currently removed from the asset store but I am developing a new version
    Code can be found on github here

    TradeSys
    is an item trading and manufacturing system and can be used as a core element of many games. If you have any items in your game which you wish to be tradable, then use TradeSys!

    TradeSys 2.0 brings many new and improved features to make its use even easier! The whole system has been rewritten from the ground up with performance at the heart. The result of this is a system which can now easily cope with over 2000 trade posts, a significant improvement over the previous version.

    TradeSys is a simple to set up and use system which allows for the trading of different in game commodities. Items can be manufactured at trade posts, allowing the game to be more interesting. TradeSys will automatically tell traders where to go with new user defined options allowing you to change what determines the best trade for a trader to make.

    Pricing of items at trade posts is done automatically by TradeSys which allows the prices to be different at different trade posts depending on the numbers that are in stock. As the numbers of items fluctuates across the trade posts, the prices will change too, making your game more dynamic and interesting.



    Notes:
    • Due to Dropbox removing support for HTML rendering, the demo scenes will download a html file which is then playable in a browser.
    • The quick scene example is not included with TradeSys







    Features:
    • Simple to set up
    • Automatic stock pricing
    • Item manufacturing at trade posts and on traders
    • Trader management
    • Custom inspectors making set up simpler
    • Fully commented source
    • Plus many more

    Asset Store


    All for $25!

    More features to be added in the future!

    Comparison between TradeSys and TradeSys Lite



    If you are updating from TradeSys 1.x, please delete the TradeSys directory and import TradeSys 2.x. This is due to files being rearranged and some removed.
     
    Last edited: Apr 18, 2020
  2. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    New update!
    This adds the ability for traders to carry multiple types of item, you can now disable items at trade posts, so will not be traded. Also added expendable traders where TradeSys will create a trader at the start post and destroy it when it gets to the required post.
     
  3. Distant_Temples

    Distant_Temples

    Joined:
    Apr 14, 2012
    Posts:
    131
    This looks really interesting. I'm not sure if I can use this for my project as is. I'm not saying I couldn't use it, I'm just not good at coding stuff. Do you have plans of having an example that is integrated into a vendor system? Like a vendor NPC ( Capsule ) with a window showing what they have for sale and being able to buy and sell stuff.
     
  4. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    I will be adding code snippets that could be used to make the window, probably something similar to code behind the trade post window in the web player demo. But will also include the code to use when a player is buying or selling items, and will probably include an example of using the different code segments together.
     
  5. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Version 1.2 has been released!

    This version adds:
    • A custom inspector for the traders, and has buttons for easy trade post finding, or location setting
    • Units for goods based on their mass
    • A manufacturing checker, saying if an item will increase, decrease or stay the same, and will give a value to show how quickly it will change
    • A fully commented player script and a scene demonstrating the use (one of the webplayer examples is of the scene that you will get). This includes a fully functioning shop mode, and the ability to click on a trader and view the information.
    • Added methods to make it easier to enable / disable posts and items.
    • Fixed item pricing
    • Some UI Tweaks
    Check the manual for how to use TradeSys, more information on the changes that have been included and using the extra methods that have been added.
     
    Last edited: Nov 30, 2015
  6. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Version 1.3 has been released!

    This version adds:
    • Spawners with traders able to collect the items
    • Groupings - it is now possible to group trade posts together, so that not every trade post trades with every other one
    • An overview to the controller, showing information about groups, goods and manufacturing
    • Can view trade links, spawn sphere radius and radar sphere in the scene view
    • Update interval option to the controller, so the update frequency of post prices, and possible trades may be reduced to improve performance
    • Massive UI update to make TradeSys even easier to use and set up!
    Check the 12 page manual for how to use TradeSys, more information on the changes that have been included and using the extra methods that have been added.
     
    Last edited: Nov 30, 2015
  7. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,717
    I was writing my own smiliar system but just found out about yours now and with this price im sure going to buy this at the next pay day.

    Just one question though, are we able to define different type of products? And if so, how do we do that? By inheriting from a base item class?

    Briefly, is this anything smiliar to X3 games trading system at all?
     
  8. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Adding different items is very simple as it is done in the inspector. Once the controller script has been added, there is a goods tab where you can add and define all of the products. The screenshot below shows the inspector where you add the goods.
    $Picture2.png

    I hadn't heard of the X3 games before, but after some researching, the manufacturing aspect does appear to be similar, I can't seem to find too many details about other aspects, but it does include other things that I had planned to included in later versions.
     
  9. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Version 1.4 has been released!

    This version adds:
    • Factions - you can now select factions for trade posts and traders
    • Option to view the trade links while a trade post has been selected, making it easier when editing groups or factions
    Check the 14 page manual for how to use TradeSys, more information on the changes that have been included and using the extra methods that have been added.
     
    Last edited: Nov 30, 2015
  10. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    I have made a quick demo scene using TradeSys as an example of how quickly and easily it can be added into a game to provide one key aspect of gameplay. The scene wont be included with TradeSys because it makes the download much larger, and is unnecessary for most projects as it is only a demo, so requires more editing.

    The scene is using a new version of TradeSys which I will upload once I have made a few more edits - creating the scene meant that I found some areas that could be improved upon, so that will be sorted first.

    Here is the link to try for yourself: https://dl.dropbox.com/s/dfin38lco8ejfji/4.html

    UPDATE: The ability to change groups has been added, and the traders will no longer slide every so often. Turns out that I didn't change the wrap mode for the animations, so the sliding was because the animation had finished.
     
    Last edited: Jul 4, 2013
  11. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    questions

    can the trading routes be set up by player(s), ie. regional regulations

    so scenario like this: players control different regions, set prices in their regions and set routes between market locations (ie. decide who they are trading with = trading union)

    maybe this controls it:
    [A custom inspector for the traders, and has buttons for easy trade post finding, or location setting]

    I like this:
    [the update frequency of post prices, and possible trades may be reduced]
     
    Last edited: Jul 2, 2013
  12. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    It may be possible for the player to set trade routes, but this would be done by selecting what groups the trade posts belong to, similar to what is done in the editor for each trade post. I haven't tried this, but will have a go at adding it into the player script as an example of how it could be done.

    The prices are currently only set by the controller, based on the number of items available at the trade post, this means that it is not possible for a player to set the prices, but custom pricing is something that I hope to add.

    The custom inspector makes it easier for you to set up where the trader starts at in the game. By selecting the trade post, and pressing set location, the trader will be moved to the trade post, so you don't have to move it, and the find post button is so that if a trader is close enough to a trade post, its location will be set to there, and the start post set.

    The update frequency offers performance benefits because it isn't having to update the prices or the trades occurring as often, but also means that when a player purchases an item, the price isn't necessarily changed instantly, so possibly makes it feel slightly more realistic.

    I hope this answered your questions, feel free to ask any more that you have!

    UPDATE: I've added the ability to select groups in the player script, with an example in the most recent demo with the skeletons
     
    Last edited: Jul 3, 2013
  13. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Version 1.5 has been released.

    This version adds:
    • More options!
      • Can now select the area shape for a spawner, and the rotation of the spawned items
      • The trader stop time has more options to determine the stop time and when they stop
    • The way manufacture pause works has been edited, and a cool down time option added
    • Can now add all the trader prefabs into the expendable trader list with the click of a button
    • Controller has a new tab which displays extra information when your game is playing
    • Added ability to select groups in the player script in game

    Includes some other small fixes and improvements
     
  14. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Version 1.5.1 has been released!

    This version fixes a problem with the trader pause times, but also means that it is now possible to use with versions of unity after 4.0.0!

    A lite version of TradeSys is now available! Information of the comparison between the versions can be found in the first post
     
    Last edited: Aug 5, 2013
  15. GregMeach

    GregMeach

    Joined:
    Dec 5, 2012
    Posts:
    249
    Just purchased after reading PDF and checking out the examples - looks perfect for my game as a starting out point.

    Thanks!

    One problem: This conflicts with TNet (TNManager.cs - TNPlayer). I'll see what I can do to re-factor, just thought you should know.

    Update: I changed your /Example scripts HitMe.cs and Player.cs to use TSPlayer - a quick check and both example scenes seemed to work.

    Update 2: I had to add the "Item" tag in one of the example scenes
     
    Last edited: Aug 26, 2013
  16. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Thanks for letting me know about the name conflicts, I will try and sort them for the next version, hopefully adding TS to them should prevent any problems.

    Regarding the item tag not being added, I don't think it gets added if there are no objects with that tag in any of the scenes, and because it only appears with a spawner, it isn't added. I have something lined up which should fix this problem.

    Thanks for purchasing TradeSys and I hope that you find it useful in any games you make
     
  17. GregMeach

    GregMeach

    Joined:
    Dec 5, 2012
    Posts:
    249
    Spent some time with my demo scene to find my way around. So far:

    Revised the "shop" views
    Buy - only shows "Buy" button for in-stock items
    Buy and Sell - Items now display on 2-lines
    Sell - only shows "Sell" button for items you have
    Added a new "Info" section that (for now only) displays what each post manufactures.

    Again, thanks and I left a (positive) review and oh yeah, raise the price - current price is a give-away.
    :)

    Feature Request:
    1. Save/Load function
    2. Trade Post min/max item settings
     
    Last edited: Aug 28, 2013
  18. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Thanks for the positive review!

    Glad you managed to work out how to show more of the information that TradeSys can show, and are customising the shop view script.

    Saving and loading functions were something I had considered adding, but because I thought that people may have different preferred methods, I didn't include it. Would a method which had a list of all of the different variables that should be saved be useful?

    In the new version, trade posts can have custom pricing, but it is a set price which won’t change, but I will have a look at adding the min / max / base pricing similar to that found in the controller.

    Thanks again for your feedback and for purchasing TradeSys! (I will be increasing the price)
     
  19. GregMeach

    GregMeach

    Joined:
    Dec 5, 2012
    Posts:
    249
    Sweet! - I'm not kidding about the price :)
    Re: "Would a method which had a list of all of the different variables that should be saved be useful?" - Yes, you have "insider" knowledge that I'll never have ;-)

    Seriously though, send me an email to my username at gmail [.] com - I'd really like to send you a donation through PayPal if you can take it.

    I'll hack-in my min/max, using something like your Mfg-> needs process. This way I can create continual "demand" for goods. Oh and also I'm going to add some sort of consumption, kind of like an opposite spawner, a... wait for it... consumer. :) Actually after typing that out, that sounds like it should become a function of a trade post, besides any manufacturing, kid of like a cost of doing business.

    Okay, I'll stop typing now... please, send me an email or just let me know that one listed in the store is good.
     
    Last edited: Aug 29, 2013
  20. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    The consumer process could be done by having a manufacturing process which does not have any making items, only needing items, this way you can also set how long between each time items get used up.

    I had misread your previous post - I thought it was min / max prices rather than min / max number of items, but I will have a look at what I can do

    The email address on the store does work
     
  21. GregMeach

    GregMeach

    Joined:
    Dec 5, 2012
    Posts:
    249
    DOH! sweet....

    Cool - ttyl
     
  22. GregMeach

    GregMeach

    Joined:
    Dec 5, 2012
    Posts:
    249
    My Unity/c# foo is pretty low.... :(

    I'm trying to play a sound when an item is picked-up. I've added an Audio source to my "crate" prefabs, made sure the sound is set to 2D. I'm getting my Debug.Log output but still no sound. Any ideas?

    Code added inside the PickupCheck() function
    Console output:
    Ore(Clone) playing pickup
    UnityEngine.Debug:Log(Object)
     
    Last edited: Aug 29, 2013
  23. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    After testing this out, the audio doesn't play because the GameObject playing the audio is deleted straight after. I have thought of a couple of options, but there are probably more.

    Instead of having the audio on the crates, you could have the audio on the player itself, and then you can use gameObject.audio.Play() when an item is picked up.

    Another option could be to play the audio, disable the renderer and collider so it appears that the gameobject has gone, and set the tag to untagged, just to be sure it cannot be picked up again. Then it would need a script on the crates which checks to see if the audio is playing, and delete the gameobject if it is not.

    This is only a couple of options, but hope this helps!
     
  24. GregMeach

    GregMeach

    Joined:
    Dec 5, 2012
    Posts:
    249
    Thank-you and I promise that was the last n00b non-related question. Until of course... No just kidding. My plan includes semi-detailed crates each with their own sound so adding a Crate script that will allow various actions, like playing sound (emitting a beacon, other interesting stuff) is where I'll go. It sounds like I can use an OnTriggerEnter to immediately disable the renderer, play the sound and then once the sound has finished ( I'm done with it) destroy the object.

    Thanks

    Update: Try as I might, I couldn't get it to work with a Crate script. Once I removed the Destroy in PickupCheck, all hell broke loose...(related to removing the item from controller list; index out of range, etc) ;-P I did however go with option 1 and now use PlayAtPoint and it's working fine. A few more GUI updates and I'll start on my multiplayer test. Lord knows what I'll screw-up on that... I'm sure you'll find out ;-)
     
    Last edited: Aug 30, 2013
  25. GregMeach

    GregMeach

    Joined:
    Dec 5, 2012
    Posts:
    249
    Just a quick "inter-operability" update. I'm starting my work on saving (and loading) and to start I'm going to use UnitySerializer. That caused a conflict on the "Spawner". A quick rename to TSSpawner in itself and SpawnerEditor file resolved the issue.

    I guess to be compatible with other assets the "catch-all" would be to preface or prefix all your classes with TS. Of course the same could be said about UnitySerializer, where he could have called his class USSpawner... ;-)

    Note: after looking over the UnitySerializer/Scripts folder I can lots of room for improvements in his naming structure (e.g. OpenDoor.cs and PauseMenu.js), yeah those aren't going to conflict with anyone else's scripts :D
     
  26. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    286
    Looks useful! It will be great if you add some more options and functionality in trade system.
     
  27. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Thanks!

    In the new version that I am working on, lots of new options have been added for example for altering how the traders decide which trade post to take cargo to (using profits and distances).

    If you have any more options of functionality that you would like to see added, let me know!
     
  28. GregMeach

    GregMeach

    Joined:
    Dec 5, 2012
    Posts:
    249
    THIS IS MEANT TO BE FUNNY
    Erm, could you be a bit more vague? How about... "Make it better" :D
    Okay I'm joking and I've been told people see it as me being a dick - just having some fun with ya...

    Callum - adding more functionality to the Traders is awesome and something I already added to my feature list. What I'm thinking about now is taking all the awesomeness you have provided with TradeSys and create or supplement it via code. I'm quite sure you already have (all?) the features I need and I see them listed in the manual. I'm just not sure how/where to start.

    What I'm thinking is I would create my minimum design, like super-scaled down version and then create a prefab. This would then become my starting point for either my entire universe or an individual galaxy and based on other parameters (like size, complexity) I would expand the system through code.

    Hmmm, this now gives me yet another idea.... dang-it! ;)
     
  29. Todd-Riggins

    Todd-Riggins

    Joined:
    Oct 25, 2012
    Posts:
    6
    Hi CallumP, I look forward into integrating your system into my project. Just wanted to let ya know... with the latest version of Unity 4.3(+) with just TradeSys loaded into my Unity Project ready to be used, I get about 33 warnings like...

    Assets/TradeSys/Editor/ControllerEditor.cs(210,46): warning CS0618: `UnityEditor.Undo.RegisterUndo(UnityEngine.Object, string)' is obsolete: `Use Undo.RecordObject instead'

    I'm not familiar with those unity methods and don't want to try to fix something I don't quite understand at the moment. If you can get rid of these warnings for all of us, that would be awesome.

    Anyways, thanks for making such a cool trade system! Laters...
     
  30. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Hi, thanks for purchasing TradeSys!

    I will get the warnings cleared up from the API update in 4.3 sorted as soon as possible, will just need to understand what the best way of adding the changes is first!
     
  31. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    TradeSys 1.5.2 has just been released. This fixes any warnings that are caused since the API update in 4.3. TradeSys now uses the TradeSys namespace, so this should help prevent any naming conflicts.
     
  32. ballboy_gray

    ballboy_gray

    Joined:
    Nov 16, 2013
    Posts:
    5
    CallumP, do you have any intention to release the source for the skeleton market or something similar? I'm just getting started with Tradesys and would love to see an example to learn from.
     
  33. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Hi, I don't think I'm able to release the source for that because it uses some other assets (A* pathfinding, skeletons, money, crates, buildings). They are all free, but I don't think the licences allow me to redistribute them (and I can’t remember where I put the project files). There are a couple of very basic examples included, but I will try and create another more complex demo scene which may be easier to learn from.
     
  34. Todd-Riggins

    Todd-Riggins

    Joined:
    Oct 25, 2012
    Posts:
    6
    EDIT: Just deleted the tradesys directory and re-imported tradesys. Works fine now. Sorry.

    Hi, just updated to 2.0. Getting this error:

    Code (csharp):
    1. Assets/TradeSys/Example/HitMe.cs(10,68): error CS1061: Type `Player' does not contain a definition for `focus' and no extension method `focus' of type `Player' could be found (are you missing a using directive or an assembly reference?)
     
    Last edited: Mar 21, 2014
  35. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Version 2.0 has been released!

    TradeSys has been completely rewritten and as a result has significant performance improvements. Many new features have been included such as grouping of goods and manufacturing processes.

    More options for trader logic have been added, enabling you to change what influences the best trade and many other enhancements and tweaks!

    Check the change log in the manual or on the asset store.

    If you are updating from TradeSys 1.x, please delete the TradeSys directory and import TradeSys 2.x. This is due to files being rearranged and some removed.
     
    Last edited: Nov 30, 2015
  36. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,114
    Thanks for new release. Would it be possible to get a print friendly pdf ie black text on white background?
    Current pdf will be a killer on blue ink ;)

    Also question on factions, is it possible to have a faction change factions during run-time (ie captured by another faction) and if so to get a trader that was en-route to that faction at time of faction-change to re-route if new faction is hostile to that trader.
     
    Last edited: Mar 22, 2014
  37. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Hi, there is a link to the print friendly version of the manual in the first post.

    It would be possible for a trade post to change faction during run-time by calling GenerateDistances() in the controller script. However, depending on the number of trade posts, this may cause your game to slow down while it updates the trade links. Currently there is no way of getting the traders to re-route to a different trade post because it would require some different calculations to those done when it is at a trade post.

    I will however look at adding in the code for trade post re-routing and a way of recalculating the trade links which has better performance to allow much simpler trade post capturing.
     
    Last edited: Nov 30, 2015
  38. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    2.1 has been released!

    Release notes:
    • Traders can now have manufacturing processes
    • Can now enable or disable a manufacturing group
    • Player scene now has demonstration of post tags, with the ability to buy trade posts
    • Player scene has examples of other uses for goods and manufacturing grouping by allowing machinery to be fitted to an owned trade post
    • Improvements and fixes to GUI and trading
    Player scene additions can be found in the demo.
     
  39. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    You've just answered, more or less, something i was pondering on heavily (price is amazing btw if it does what it says on the tin). I don't really need travelling traders but i certainly could do with trading, especially if it was balancing over several areas, and i need manufacturing, as in combining objects in the inventory as well as maybe having the trader/post combine things in their own inventory to create a product.

    What seems great about this is that it seems it is entirely possible to abstract the idea entirely away from a 'shop' and a 'merchant', a part of what i intend is very harvest moon-ish and to that end i was thinking of the idea of say, making your own post for manufacture or item generation, so the post could be something you planted in a set area, over time it grows (in fact the value changing over time could drive other things like the scale of the object representing the crop), so the planted crop is a post, it is changed to an inventory item when harvested and the 'post' removed. That abstraction would make an absolute ton of things possible (in my case i wish to have a homestead you can farm on, harvest on, make things, upgrade items around it, give and take items from your family that start an event or somesuch, and travelling away from the homestead enjoy the meat of a good trading and manufacturing system at various settlements), from what your description outlines it already has everything there, it just doesnt look like it is intuitive and fast to manage that kind of aspect of it.

    I'm going to get this asap because it solves my biggest problem that i was fretting over, i intend to combine it with Environment Gator (https://www.assetstore.unity3d.com/#/content/13442), so values can be modified by time of day, weather, season, special events, and the main control and interaction interface i intend to be Adventure Creator (https://www.assetstore.unity3d.com/#/content/11896), although thats only in settlements and near people you shouldnt harm. And i spose if a trader were to travel they'd be using A* over a large terrain. Do you think that should be any trouble to gel?

    And additionally do you intend (or am i being ignorant) or like the ideas i put above? It would just make it absolutely perfect for the remaining worry with my project (its a competition so time-critical, submission is in 9 weeks or so). So cheers! I'll grab this when i have the cash and look forwards to using it, and bending it to my will if you arent enthused by my suggestions
     
  40. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Hi,
    Those sound like some very interesting ways to use TradeSys! The ideas that you have should be possible, I’ve tried to think and give how it might be possible to do some of the ideas that you mention.

    Depending on the number of trade posts going to be used, it may be best to have them all in place at the start of the game. This is because when a trade post is added or removed, the GenerateDistances method needs to be called, and this may cause performance issues if there are many trade posts. However, if the trade posts are at the start, they can be prevented from trading or manufacturing items. The trade posts could be made invisible as long as the trade post script is still enabled. I am looking at making it possible to make changes to the number of trade posts and groups / factions.

    It is possible to get the number of an item held at the trade post, so you can use it for representation of the crop (the player script has an example of getting the number of items at a trade post). The items could be made using a manufacturing process, and the create and cooldown times for each process can be changed by using the EditProcess method (this is explained in more detail in the manual). Environment Gator should be able to work with TradeSys if it is possible to get variables to use in EditProcess (I haven’t used Environment Gator before, so unfortunately I can only suggest how it might be possible).

    The quick scene (not included due to the use of other assets, but the webplayer link is in the first post) has the skeletons using A* pathfinding. This can be done by removing the code which makes the traders move (the LookAt and Translate in the trader update method), and instead just tell the A* pathfinding script where to go (send it the variable called target from the trader script).

    If you have any more questions or need some help, feel free to contact me
    Good luck with the competition!
     
  41. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Creating the posts at the start shouldn't be a bad idea at all, so long as they remain static until activated (and then reset when used, in the case of crops and such) and that i can change their positions in their 'inert' state, so the crop could be planted anywhere it is allowed (given a transform and activated)

    How many posts is it possible to create initially within good performance, given most will be unactivated at start, and hence not doing anything? and can they be activated by non-player action? (Say some form of manufacturing post or product post could be activated and even deactivated by rainfall - Environment Gator can supply this information along with the time of day and suchlike). A final thing is a post able to provide a product or extra products randomly upon accessing it, given a bias, and the amount of this random product be a random number too. In normal operation this could be the runner of the post finding something interesting to sell you, and as a resource, say you cast a net for fishing, the lake being the resource, you catch ten trout and every so often a mouldy boot (comedy animal crossing style fun).

    A few more ideas there that i'd find very useful, and thanks! My idea's a little ambitious but this thing makes it within reason to attain
     
  42. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    I can create 2000 trade posts, 200 traders with 30 different goods in about 3.5 seconds. The autogen demo scene in the webplayer lets you try out different numbers (5000 takes about 15 seconds, so too many will result in a long wait). The start initialisation is the main time that it will be slow but is only called once. This is because it gets the distances between trade posts and works out the top number specified (the method to get the distances is maximised, so only needs to calculate 0.5n(n+1) distances, which for 2000 trade posts results in ~2 million calculations). From this point, the distances used to determine the best trades are done using the initial calculations, and these references are much faster than calculating each time.

    The manufacturing and trading can be enabled or disabled using TradePost.EnableDisable(bool enableTrades, bool enableManufacture) more information about this method is in the manual. This means that it is possible for it to be enabled or disabled by Environment Gator.

    For random item additions, in the trade post script, something like:

    Code (csharp):
    1. int groupID = Random.Range(0, controller.goods.count);//the id of the group for the item
    2. int itemID = Random.Range(0, controller.goods[groupID].goods.count);//the id of the item itself
    3. int number = Random.Range(min, max);//the number to add to the post (set using min and max)
    4.  
    5. stock[groupID].stock[itemID].number += number;//add the items to the trade post
    6. controller.UpdateAverage(groupID, itemID, number, 0);//update the average stock numbers required for item pricing
    7. UpdateSinglePrice(groupID, itemID);//update the price of the item at the trade post
    should work. (I'm going to be adding a similar method to this one to the script now!)

    This should allow the random addition of new items, and by changing the random numbers, it would be possible to alter the bias.
     
  43. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    2.2 has been released!

    This is not a particularly major update, but adds in a few useful features and provides some improvements to use and performance.

    Release notes:
    • Edited the buy / sell list updates so is more efficient
    • Uses sqrMagnitude instead of Vector3.Distance, so improving starting performance
    • Disabling trades at a trade post or changing factions or groups will make any trader heading to the trade post head back to where they stated from
    • Can set the closest posts to 0 so will check best trades at all posts
    • Added new methods:
      • Method to add or remove items from stock at a trade post
      • Method to allow factions or groups to be edited at a trade post
      • CalcDistance in controller so that other distance calculations can be used not just straight line distance
      • Added method to allow changes to buy, sell and hidden options at a trade post
      • Renamed EnableDisable at trade posts to EnableDisableTradeMan
     
  44. GregMeach

    GregMeach

    Joined:
    Dec 5, 2012
    Posts:
    249
    ..continues to be AWESOME!!!

    Thanks

    PS I use this with TNet and always have to rename your Player.cs to TSPlayer.cs - I realize Player.cs is super generic and TNet should (also) have used something else but if I rename the TNet one I have to modify a "crap-ton" (technically speaking) more related scripts. When I rename yours; nothing else is affected / nor breaks.
    :cool:

    Edit: manual link on 1st post was/is broken
     
  45. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Thanks!

    I'll append TS to the player script in the next update, forgot to do that because all of the other scripts use namespaces, so should be fine with the same names. The player script doesnt use namespaces so it is clearer on how to get the variables etc. stored in TradeSys.

    The link to the manual on the first post should be fixed now, and will be fixed on the asset store soon as the links have changed.
     
  46. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,114
    Just goes from strength to strength. Cheers CallumP for the faction change update. :D
     
  47. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,821
    Very nice! We are just starting to build our trade system and I found yours. Would it be difficult to set this up for multi-player?

    Thanks!
     
  48. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    Hi, thanks for your interest!

    Unfortunately I don’t have any experience with multi-player, so I'm not really able to help you out too much, and I wouldn't know where to begin in helping you.

    Hopefully it would act as a good basis for you to add in multi-player functionality, especially as 2.x includes a lot more comments, so should be helpful if you need to make any changes.

    Sorry I can’t be of more help, if you have any questions, feel free to contact me on here or email and I’ll do my best to answer.
     
  49. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    2.3 has been released!

    The major feature addition in this update is the return of spawners! This time they have more options available such as being able to spawn multiple items in a single crate.

    Other update information:
    • Moved the trader AI into a separate script, TSTraderAI. This was to make it more obvious which parts should be changed when using your own AI, and to also hopefully reduce the number of changes you need to make when TradeSys updates.
    • Bug fixes:
      • Fixed where item shuffling gave an error
      • Sorted problem of going onto manufacturing tab after deleting an item
      • Sorted manufacturing mass for processes containing deleted items
     
    Last edited: Jul 15, 2014
  50. CallumP

    CallumP

    Joined:
    Mar 2, 2013
    Posts:
    76
    TradeSys Lite has now also received and update, and now uses TradeSys 2.x as a basis. This allows you to see the much improved performance and some of the new features.
     
unityunity