Better Trade Screen

Better Trade Screen - Gathering Storm update released! 4.4

Does this work with the latest patch?
Yes, it should work with the latest patch, but I have not played a full game with it.
 
Sort cities alphabetically in the "select trade route destination" list.
Sorry, missed your message. This is an excellent suggestion and will add this.

When you select a city in the "select trade route destination" list , show trade route only to that city.
By "show trade route only to that city" do you mean only show trade route path to that city?

When you have a trader selected, show its current trade route.
Is this after the trade route has begun?
 
qqqbbb has some bright suggestions :)
I must admit that I use trade routes in early game, to mainly build road network.
So when I have chosen a target city, I wish I could see the AI chosen route to target. In other colour, or flashing or something?
 
Small bug: you're referencing a <File>Scripts/BTS_Scripts.lua</File> in your modinfo which doesn't exist in the download archive.


And I've spent the better part of the day to try to increase the performance when opening the trade window / sorting the city list for large amount of cities. And I think I've eliminated the main reason for the sluggishness, which seemed to come from the repeated tradeManager calls in the TradeRouteChoosers.lua file. I've now changed the code to call the GetYieldFromCity function only once for each destination city and yield type when opening the trade screen, cache the yields results, and sort the city list using these cached values.
I've made some other changes, i.e. caching the cities as well, but I didn't notice much improvement for these. Tthe cached yields table was actually my last change, and it worked the best.

Feel free to integrate these changes into your mod, and/or change any of my code to your liking. This mod is so insanely useful, but the lag when opening the trade window bugged me on large/huge maps. This seems to be almost gone now.

I also didn't do much beta testing for this, except that there are no errors in the log file.
 

Attachments

  • TradeRouteChooser.zip
    11.9 KB · Views: 131
Thank you for an amazing mod, it's the only mode I consider MUST for civ 6! I could not complete my deity game, cause 40 trade routes drove me crazy - now I can play again. I wonder if you can develop similar functionality for espionage, namely repeat counterspy, it's the most annoying part of it. This will make espionage so much better! There is no mod for that for espionage and your looks the closest to it - similar sort by science/production/gold would be nice for counterspy and offensive espionage but having REPEAT counterspy (like 3-4 turns) would be already great!
 
Small bug: you're referencing a <File>Scripts/BTS_Scripts.lua</File> in your modinfo which doesn't exist in the download archive.


And I've spent the better part of the day to try to increase the performance when opening the trade window / sorting the city list for large amount of cities. And I think I've eliminated the main reason for the sluggishness, which seemed to come from the repeated tradeManager calls in the TradeRouteChoosers.lua file. I've now changed the code to call the GetYieldFromCity function only once for each destination city and yield type when opening the trade screen, cache the yields results, and sort the city list using these cached values.
I've made some other changes, i.e. caching the cities as well, but I didn't notice much improvement for these. Tthe cached yields table was actually my last change, and it worked the best.

Feel free to integrate these changes into your mod, and/or change any of my code to your liking. This mod is so insanely useful, but the lag when opening the trade window bugged me on large/huge maps. This seems to be almost gone now.

I also didn't do much beta testing for this, except that there are no errors in the log file.

I have been doing the exact same thing in the my repository too :). I realized the major cause of sluggishness routes after I timed my code and realized what was causing the massive delay. You can track the progress in the github page here (check the past commits), and I am nearly done with most of caching. A beta release for v3.1 should be out tonight.
 
Last edited:
Thank you for an amazing mod, it's the only mode I consider MUST for civ 6! I could not complete my deity game, cause 40 trade routes drove me crazy - now I can play again. I wonder if you can develop similar functionality for espionage, namely repeat counterspy, it's the most annoying part of it. This will make espionage so much better! There is no mod for that for espionage and your looks the closest to it - similar sort by science/production/gold would be nice for counterspy and offensive espionage but having REPEAT counterspy (like 3-4 turns) would be already great!
That will depend on time, and/or if someone does it before me. Currently, I have my hands full with this and the More Lenses mod.
 
Thank You

With over 16,000+ downloads total, this has been the most popular mod I have ever made! Thank you to all who downloaded, reported bugs, and gave feature requests. This mod would not have been what it is without all of you.

Issues till now

This version of the mod is meant to address the main issue I, and all of you, have with this mod - the performance. Sometimes this has been so bad that Trade Overview panel is unusable. This version is hopefully going to fix all of that. To see what has changed we first need to see how bad the previous version was.

Performance Measurements

Prerequisites

Before we begin, some disclaimers needs to made.
  • I made all these measurements in my own computer running Intel i5-6500 + GTX 1060 + 16GB RAM. So exact numbers might vary depending upon your PC.
  • More importantly, the minimum time step in LUA is one second. Hence all measurements are rounded down to a whole number. This means 0.9 seconds gets rounded down to 0, which is obviously not representative. That is why next to each time that has 0 secs, I will give what I felt the time was (instant vs small delay vs noticable delay)
  • The performance is measured in Trade Overview panel, since that will have higher number of trade routes and we need a bigger delay to measure the performance because of the reasons mentioned above. The optimization improvements are also in Make Trade Route screen.
  • Continuing the reasons of above, I am testing this in Standard Islands Map. Save file linked below (in downloads).
  • Tests for v3.0 were done with this commit (with a minor bug fix)

Now with that out of the way lets see the results

Performance


Test, done in order, total routes = 268 | v3.0 (secs) | v3.1-beta (secs)
Opening Trade Overview panel, with tab Available Routes | 9 | 1
Sorting by Production | 7 | 0 (small delay)
Sorting by Gold + Science + Culture + Faith | 14 | 1
With the above sort settings, expand all groups | 15 | 1
With the above sort settings, collapse all groups | 15 | 0 (instant)
With the above sort settings, expand a single group (first one) | 11 | 0 (instant)
Change group setting to None (shows all 268 routes) | 16 | 0 (small delay)

HOW??

One word - caching. I got this idea when I was playing Hearthstone of all things (yes, it was when I saw the Hidden Cache card). That night I implemented cache for trade route yields and the result was remarkable. After that, I spent the next few days caching other info (like icons, route turns, etc), optimizing loops, simplifying sort functions, reusing tables, and finally not re-sorting and re-filtering unless absolutely needed.

Why not just release it?

Because of the amount of code changed, and the number of people using this mod I don't want to release something without proper testing. I am quite excited about this version and that is why I am releasing it is as a beta.

Where do I get it?

Get it from here, or the attached file in this post.

Other changes in v3.1-beta
  1. When grouped by destination or origin, the sort settings for groups are cloned (with ascending turns) to sort settings within each group. Example: if you sort by gold, the groups themselves are sorted by gold, and routes within each group are sorted by gold + ascending turns.
  2. Added collapse all button
  3. Expanded the Make Trade Route screen to show both the origin city and destination city yields.
  4. Fixed alignment of sort bar in Make Trade Route screen.
  5. When a group is collapsed, the tooltip shows the top route.
  6. Trade routes automated info is tracked across saves. You no longer have to renew trade routes when you load a save.
  7. In Trade Overview screen, routes don't sort until shift is released.
  8. When selecting a destination in Make Trade Route screen, the route path only to that city is shown.
  9. Fixed some tooltip ambiguity.
  10. Increased animation speed of opening trade panels.
  11. Removed the non-existent BTS_Scripts.lua file from .modinfo

Leaving notes
  • If you notice a bug, please report it. Include how you can reproduce the bug, attach the save file and the LUA log file.
  • Finally, keep hitting that next turn button!
Edit: v3.1 is released. The beta version here is deprecate, hence I removed it.
 

Attachments

  • BTS_TEST_SAVE.Civ6Save
    1.3 MB · Views: 129
Last edited:
no probs so far
whats the col: and exp: checkboxes do?
 
Last edited:
Not sure why but I'm not seeing the options for Repeat and Sorting?

I only seem to have the ability to filter

Using a Mac so haven't upgraded to Winter Patch yet, not sure if that makes a difference

Thanks
 
Not sure why but I'm not seeing the options for Repeat and Sorting?

I only seem to have the ability to filter

Using a Mac so haven't upgraded to Winter Patch yet, not sure if that makes a difference

Thanks
Are you using the latest version? If possible can you also upload a screenshot of the screen?
 
Are you using the latest version? If possible can you also upload a screenshot of the screen?

I believe so - I downloaded the v3 and deleted the old one (modification dates are mostly 11/15/16)

Untitled.png
 
It looks like my mod was not installed. The sort options, the correct amount of turns are also missing. Check if the mod is activated in Additional Content.
 
It looks like my mod was not installed. The sort options, the correct amount of turns are also missing. Check if the mod is activated in Additional Content.

Doh! I had installed but it looks like it got deselected when I removed the older version to install the new version

Didn't have Civ open at the time so that's a bit surprising...

In any case, thanks for taking the time to answer a silly question ;-)
 
how do you get the repeat routes to work they never seem to work for me always asks me for new destination?
 
Top Bottom