[Col2] JTradeRoutes: Project Discussion

Jeckel

Great Reverend
Joined
Nov 16, 2005
Messages
1,637
Location
Peoria, IL
Mod Thread: JTradeRoutes: An Improved Interface

The main problem with the Trade Route system in Colonization 2 is its interface. This not to say that the system itself is ideal, but for now I'm concentrating on a complete revamp of the interface to the system. After that is done, I will then focus on adding and enhancing the system itself.

My first step, which is practically done, is to provide more straight forward access to the information of your Trade Routes. To that end, I have narrowed it down to 4 important elements.

1) The Trade Routes themselves.
2) The Transports to move along the Trade Routes.
3) The Commodities to put in your Transports.
4) The Data over Time of the various parts of your Trade System.

This information can now be easyly accessed through a new Screen I have created. It has 5 different Pages.

The first and second Pages, "Domestic Routes" and "Foreign Routes", address the first point and show the Trade Routes in your Colonies and the Trade Routes with Europe, respectively. This Page has Buttons that allow you to Create, Edit, and Delete Trade Routes. This Page also has a Button, Assign Units To Trade Route, that will all you tell Units to use the selected Trade Route. Also note that the Create Trade Route Button is on all Pages of the Screen.

The third Page, "Transports", addresses the second important point. This Page has two Tables, the top one showing Land Cargo Transports and the bottom showing Sea Cargo Transports. I just made this Page tonight and it is basicly done. What isn't done is the popup that will allow you to assign Trade Routes to the Transport Units.

The forth Page, "Commodities", addresses the third important point and gives a comprehensive overview of the Yields Stored in all your Cities. The Table at the top of this Page shows your totals for each Yield and the Table on the right shows the total for each City. I'm not sure what else I'm going to do with this Page, but it isn't quite done yet.

The fifth and final Page, "Graphs", begins to address the forth important point, but is not near done. Currently it works similarly to the Info Screen, except better because I coded the screen correctly.. something it seems was not done with alot of the default screens... anyway.. It currently has two Graphs, one shows the History of Yields Stored in Cities and the other shows the History of Production Rates of each Yield.
Most importantly, I am planning to add Histories for the Buy and Sell values of each Yield, but I have a few other ideas for useful Graphs as well.


All in all, after working on it for only a few days, the Screen is 95 percent done. I have the main work done and am now just adding features and tweaking the layout.

Most of the work so far has been done with Python to make the Screen, but I did add a few new helper functions to CvTradeRoute objects to make it easyer to determine if a Trade Route goes to Europe and if it is a Land or Sea Trade Route.

In the long run, my goal is to make Colonization 2's Trade Route system just like the one in Sid Meier's Railroads! With Multiple stops on each Trade Route, the ability to set the amount of each Yield that is pickup and dropped off. :king:
 
Do you need help with designing a new trade route system? I'm also learning fast (in a general sense) so I could probably figure out the SDK stuff if somebody helps me to set it up so I can compile it - and I already know a bit of python, so if time allows I'd even be able to help with the implementation.
 
I've got the coding side of it handled, but I am happy to hear any suggestions or ideas you have for how the Trade Routes need to be redesigned. :cool:
 
Update.

I removed the old Screen Shots from the second post and replaced them with more current ones. I implemented some Popups from my new Screen that allow you to Create, Edit, and Delete your Trade Routes. Three Screen Shots have been added to teh second post to show these new Popups.

I've added a Name and a Priority to Trade Routes, though the Priority isn't implemented into the Auto Trade Route system yet. Thats it for this update. :king:
 
Ok, so I did some very basic thinking on this side of the game:

First of all, it should be noted that the "best", i.e. most effective, system is probably not what you (or should I say we?) want to be aiming for for trade automation. The reason for this is that the best system is most likely a fully automated version that is completely controlled by an AI instead of the player. Obviously, this isn't much fun because not doing anything is never fun.

That said, I think there's two different basic ways of trading in the game. The first is raw materials trade. This kind of trade basically covers the shipment of certain goods (everything you won't want to sell) from producing cities to consuming cities, usually involving only fairly small quantities of goods, for example when a city with a cotton resource ships its cotton into a city with a textile mill to be used there. This category also contains the distribution of "overflow" for goods like lumber or tools (weapons and horses probably also fall into this category) that you basically need in every larger settlement - some settlements have a bit of overproduction while some have a bit of overconsumption, trade can be used here to balance these out.

The second big type of trade applies to trade goods that will eventually be sent off to Europe (or, rarely, sold to the natives). Here, you will usually transport large quantities of goods (say, 100 and up) from a production city to a port hub and from the port hub to Europe.

Having identified these two types, we have to think about what would be the most fun way to manage goods flow for these. The simple and straightforward approach is to have one (or, occasionally two) vehicles transporting goods from one city to another. However this is highly ineffective and typically wastes a lot of cargo space, so we'd like to do better.

One way to do better is to introduce a trade route concept. A trade route is basically a set of nodes (cities) connected by one or more edges (travel time with different ways of traveling). For example, I'd like to set up trade for my Cotton City I and Cotton City II to Weaving City, and from there transport cloth to my Hub City. Let's say Cotton I and II are fairly close (1 turn for a wagon) and each produce 10 Cotton per turn. Cotton I is slightly closer to Weaving (say 3 turns), which has a similar distance to hub. Weaving is well set up and produces 20 cloth per turn from the cotton. In this case, I can easily calculate that one cart will not be able to service this route, because if I'd set up a single route with the items:

  • Load all cotton in Cotton I
  • Travel to Cotton II (1)
  • Load all cotton in Cotton II
  • Travel to Weaving (3)
  • Unload all cotton, load all cloth
  • Travel to Hub (3)
  • Unload all cloth
  • Travel back to Cotton I (7)

the total travel time would be 14 days which means that both cotton cities have 140 cotton available, which is more than the total capacity of 200. So I have to split it up into two subroutes:

Subroute 1
  • Load all cotton in Cotton I
  • Travel to Cotton II (1)
  • Load all cotton in Cotton II
  • Travel to Weaving (3)
  • Unload all cotton
  • Travel to Cotton I (4)

Total travel time 8 turns

Subroute 1
  • Load all cloth in Weaving
  • Travel to Hub (3)
  • Unload all cloth
  • Travel back to Weaving (3)

Total travel time 6 turns

So far, so good. The above example is simple enough but what happens if Weaving produces so much cloth that one cart can't handle it anymore? In this case I'd like to be able to add a second cart to the trade route, so trade routes should have a separate existence from the carts assigned to them (similarly, if a cart is destroyed or captured, you'd like to be able to assign another one to the route).

This kind of trade route doesn't have any huge requirements about conditions that might apply to whether or not it should be transported. However, let's assume Weaving can only convert 10 cotton into cloth per turn. In this case, the warehouse would fill up and any additional cotton delivered would be wasted. Now it would of course be desirable to add another weaver but sometimes that's not possible, so I'd like to be able to deliver any surplus to the Hub instead. The best way to do this would be to consider the total amount of cotton delivered to this city (this can be calculated by summing over all the delivery trade routes' sources or maximum throughput, whichever is lower) and if it exceeds the consumption, I'd like to carry off some of the cotton with the cart assigned to the second route from above (which has extra capacity). In effect, I want to be able to say: "If {cotton delivery} > {cotton consumption} and {remaining cotton capacity} < 50 then {transport cloth} and {transport cotton}; else {transport cloth} and {transport cloth}" (this could be implemented by using dropdown boxes to form a condition, then use an and/or dropdown to add another one; levels could be used for bracketing).

This system is, of course, pretty complicated and the simple system above will usually work well enough. The conditioned transport would be very cool to set up though, and I'd really enjoy doing this stuff. You could also use the simple system and add a checkbox that simply says "don't deliver goods if warehouse is already full" or something, which is also easier to comprehend.

One thing is still important: What happens to lumber, goods and so on? For these, I'd like to be able to use something similar to the current system: Set automatic import/export orders, then assign carts to a certain number of cities they should handle. For example, I'd like to transport any lumber above 50 from Woodcutter's Heaven to one of three big cities, Metropolis I-III, if they are in need of it. I'd set up an import order for each of the cities and assign a cart to the four cities supposed to trade wood. This cart should then take any surplus lumber and deliver it to whichever of the cities has the largest demand. Something similar could be implemented with the conditioned trade routes from above by setting up a route from Woodcutter's Heaven with optional stops at the Metropolises if their lumber level drops below 50 and there's still lumber on the cart.

So much for now, I can work out some more details when you decided whether or not you'd like to use conditioned trade routes :D

Besides, I'm currently trying to set up the SDK to be able to make my own minimod (some of the game design is just plain bad and much too easily exploitable)
 
Ok, so I did some very basic thinking on this side of the game:

I always love to hear what other people think up. :band:

...First of all, it should be noted that the "best", i.e. most effective, system is probably not what you (or should I say we?) want to be aiming for for trade automation. The reason for this is that the best system is most likely a fully automated version that is completely controlled by an AI instead of the player. Obviously, this isn't much fun because not doing anything is never fun....

Let me stop you right there. The goal of this mod, and my intentions in coding it, are not in any way centered around the Automation aspect. I am fixing the interface to the system and adding some new features to it, and I plan to train the AI to use those features, but it will be totally up to the Players to Create, Modify, and Delete their Trade Routes as the need arises.

It seems that a lot of what you said is geared more towards the AI deciding what to pick up, how much to take, and where to drop it off at. If I misunderstood what you were saying let me know, but in my opinion that goes against the whole point of having a Trade Route system other then to watch the little wagons move around the map.

That all said, a few things you said are along the lines of what I am planning.

...One way to do better is to introduce a trade route concept. A trade route is basically a set of nodes (cities)...

I have the SDK code done and working to set up multiple stops on a single Trade Route.

...
  • Load all cotton in Cotton I
  • Travel to Cotton II (1)
  • Load all cotton in Cotton II
  • Travel to Weaving (3)
  • Unload all cotton, load all cloth
  • Travel to Hub (3)
  • Unload all cloth
  • Travel back to Cotton I (7)
...

My next step is to allow you to set how much of the Trade Route's Yield is picked up and dropped off at each Stop on the Route.

...so trade routes should have a separate existence from the carts assigned to them (similarly, if a cart is destroyed or captured, you'd like to be able to assign another one to the route)....

Yep, this is exactly how it is currently.

...The conditioned transport would be very cool to set up though, and I'd really enjoy doing this stuff....

I have been considering implementing a simple Screen that would allow you set conditions similar to what you are talking about. When I get closer to coding it I will let you know.

...add a checkbox that simply says "don't deliver goods if warehouse is already full" or something, which is also easier to comprehend....

I am working on a fix to this already. I don't know how I'm going to stop it, but I'm trying a few different things.

...Besides, I'm currently trying to set up the SDK to be able to make my own minimod (some of the game design is just plain bad and much too easily exploitable)

I wish you luck, maybe you can implement some of this stuff yourself. :king:
 
Update Time.

First, I'm going to release a first version at the end of the week.

It will basicly just include the new screen and the ability to name your Trade Routes. I am not including any new functionality to Trade Routes, as Dale mentioned including the new screen in the Unofficial Patch Mod, so I going to release an Unaltered Game Play version of the mod.

As for the complete mod. I now have Trade Routes with multiple Stops.

I'm now working to allow you to set up how much of the Yield to pick up and drop off at each Stop.

Since I'm getting more and more info to set for each Trade Route, I'm working on a more informative popup to Create and Edit them.

High on my ToDo list is to add a Button to the Trade Routes Page that will allow you to assign the Trade Routes to Units and another Button on the Transports Page that will allow you to assign Units to Trade Routes.

And I'm still working on adding Yield Buy and Sell Price History Graphs.

Thats it for this update. I'll post again after I've uploaded the Unalterd Game Play Version of the mod. :cool:
 
Thanks. :)
 
Hehe, yes you misunderstood me. What I meant with automation was that you shouldn't have to manually load everything, then give your cart a destination, then unload stuff, then send your cart back. Kind of like in Railroad/Transport Tycoon and similar games. Let me quote myself:
alpaca said:
First of all, it should be noted that the "best", i.e. most effective, system is probably not what you (or should I say we?) want to be aiming for for trade automation. The reason for this is that the best system is most likely a fully automated version that is completely controlled by an AI instead of the player. Obviously, this isn't much fun because not doing anything is never fun.

As for implementing things myself: I'd rather wait what you come up with, then bash you over the head with a big stick and steal it :p

In fact I think that right now there are more pressing concerns with C4Col which I'd like to address. Once the REF, Europe and some other of the more obviously broken mechanics are fixed, if I have time, I'll give it a try. At the moment I'm still learning how to work with the SDK - never coded C++ in my life and the core dll is a pretty big project to reverse-engineer.
 
Amazing work Jeckel. Shame on Firaxis for releasing a flawed product and then forcing us depend on wonderful folks like you to fix their messes. I noticed a lot of angry posts at the top of the forums. It feels like a case of "do it fast and sell it", instead of "do it right".

I have no experience doing what you are doing, but I was wondering how hard it would be to add a new map view that shows cities, resources, and trade routs. That way, instead of looking at a table you could see that there is a level 1 (1 wagon) trade route to the fronteer city, but a level 4 (4 wagons) trade route between the inland city and the port city. Along with the goods flowing in each direction.
 
First of all, Kudos for the work being done !

Personally, I would dream of an interface like only seen so far in the original Railroad Tycon : a simplified map which shows each city where you can graphically "click" the next destination, and which goods to load and download there. You could also see graphically where a transport is, and which goods are waiting where. For this I feel the same as DonaldAtHome.

What I miss the most is the possibility to ask a transport to be full prior to move to the next destination. But I guess this can not be implemented.

I love the possibility of looking into historical data ....

In anycase, whatever you have showed so far is by far better than what is available right now ...
 
When you figue out the mechanics of popups, ("implemented but not used" LOL no joke). Would it be possible to add a popup for negative production of finished goods/hammers. Why this was not put n the original release is beyond me.
 
First, thanx to all for the kind words. We modders don't get cash for this, but praise is like a paycheck. :band:

A quick update on the current progress.

I am not going to release the Unaltered Game Play version today. I was playing a game using the mod and I found one glaring oversight in my Screen. Sure you can Create and Edit your Trade Routes from the Screen, but you still had to find each Unit to tell the Unit to use each Trade Route.

I am about half done with adding a few new popups to the Screen that will allow you Assign Units to Trade Routes and to Assign Trade Routes to Units.

This may take me a few more days to get done, but it really rounds out the Screen and allows you to do everything you need to do without leaving the Screen.

Amazing work Jeckel. Shame on Firaxis for releasing a flawed product and then forcing us depend on wonderful folks like you to fix their messes. I noticed a lot of angry posts at the top of the forums. It feels like a case of "do it fast and sell it", instead of "do it right".

I have no experience doing what you are doing, but I was wondering how hard it would be to add a new map view that shows cities, resources, and trade routs. That way, instead of looking at a table you could see that there is a level 1 (1 wagon) trade route to the fronteer city, but a level 4 (4 wagons) trade route between the inland city and the port city. Along with the goods flowing in each direction.

First of all, Kudos for the work being done !

Personally, I would dream of an interface like only seen so far in the original Railroad Tycon : a simplified map which shows each city where you can graphically "click" the next destination, and which goods to load and download there. You could also see graphically where a transport is, and which goods are waiting where. For this I feel the same as DonaldAtHome.

What I miss the most is the possibility to ask a transport to be full prior to move to the next destination. But I guess this can not be implemented.

I love the possibility of looking into historical data ....

In anycase, whatever you have showed so far is by far better than what is available right now ...

I am using Sid's Railroads! as my basis and it has a Trade Routes Map like Railroad Tycoon. I'm researching a way to recreate this in Colonization and will post when I get more figured out about it.

When you figue out the mechanics of popups, ("implemented but not used" LOL no joke). Would it be possible to add a popup for negative production of finished goods/hammers. Why this was not put n the original release is beyond me.

I will see what I can do about this after I finish the current version of the mod.

Thanx for the support guys. I'll see about getting some more Screen Shots of my current progress up this weekend. :king:
 
A tiny thing: It would be cool if you numbered the wagon trains automatically when they're created (you can give a unit a custom name, so you might hook into that) and maybe display that in the trade window so that it's less confusing to see what a cart is up to. The player can still change the name of course, but more often than not I don't think I would ;)
 
A tiny thing: It would be cool if you numbered the wagon trains automatically when they're created (you can give a unit a custom name, so you might hook into that) and maybe display that in the trade window so that it's less confusing to see what a cart is up to. The player can still change the name of course, but more often than not I don't think I would ;)

I plan to port one of the Civ4 naming mods to Col2. Not sure which one or how I'm going to implement it, but it is high on my priority list. :cool:
 
Update. :cool:

ALL NEW SCREEN SHOTS!! Check the second and third posts for Screen Shots of the current state of the Screen and its Popups. :band:

I have the Graph Page done, finally. It works just like I want. I can now start planning the SDK changes to make a Buy and Sell Yield Price History Graphs.

I have one change left for the Commodities Page. I want to display the Yield Rates of each City some how. Not sure if I'm going to use a Dropdown Menu or if I'm just going to add the Rate as more text in each cell of the Table.

On the Transports Page, the Assign Land Trade Routes and Assign Sea Trade Routes Buttons don't yet do anything. The creation of their Popups is my very next goal.

I have a little polishing left to do on the Assign Units To Trade Route Popup, but things are moving along nicely. :king:
 
Looks great! One small point of criticism. In the breakdown of the trade route info, it says "Route Distance: 3"... 3 what? 3 tiles? 3 turns?

Turns would probably be more useful than tiles... I don't really care how far something has to travel as much as I care how long it's going to take. But, if that's not possible, I can still calculate the number of turns based on the number of tiles...
 
Good point DPII. Distance is in Tiles at the moment, but I will see what I can do about having it display the number of turns between the Cities for each Transport Unit.
 
Top Bottom