Post 11 Apr 2013, 11:21 by H.A.H.
@Krom: you're right that I was too general in my previous post. But I think the mechanics can be combined quite easily in the same building. They share very basic characteristcs.
The market is a building suitable for receiving and sending goods; "trading" is a concept built on that principle. So let's model this former behaviour first:
1. The market building can be filled with a good of choice, e.g., fill it with 15 bricks. Each good has a maximum storage capacity, only 1 ware type can be stored.
2. Any good stored in the market building can be transferred 'back into the economy', e.g., serfs take out the goods and bring them to the storehouse.
Generally, we can say that a player only has to give 1 explicit order regarding the goods, namely how many goods to bring to the market; all other ware types are automatically taken out of the building and brought back into the economy.
Next, we have two possibilities with what we can do with the goods:
A. Send them to another player.
B. Trade them for other goods.
We can also model these different behaviours in the UI: we can have different views of the building. One is the overview of the building, that is ware type, amount, action: (send to player, trade for other ware type). The other is when the player wants to select a type of wares. Clicking the icon of the ware type or the trade for other ware type will show a different view that is similar to the storehouse.
I should elaborate on the mechanics of receiving goods. Whenever a player sends goods to another player, the game will look for a 'free' marketplace, that is a market that does not have any goods stored, or a market which has the same ware type as the ware we send and some storage capacity left. The game will then transfer the goods (I don't care whether instantenious or serfs need to bring them to the other warehouse, but one can argue that instantenious is better if you are allowed to send goods to the enemy). Whenever there is no 'free' marketplace, it will queue the order and wait for a free market. There are some special cases, such as two players trying to send two different types of wares to eachother (they are both not free, but the expected behaviour is to swap the goods whenever the maximum capacity is reached or the ordered amount is in the building).