News:

Welcome to World of Banished!

Main Menu

Dismiss Merchant (Part 2)

Started by salamander, June 16, 2014, 07:07:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

salamander


This is a continuation of Dismiss Merchant, just to keep things organized.




Introduction
In the first part of this discussion (Dismiss Merchant), @Kaldir raised some interesting questions about how merchants visit trading ports.  From a planning point of view, for those who like to develop a town around a trade-based economy with a plan in mind, knowing how often you can expect a merchant can be important so that needed resources are imported in sufficient amounts.

The basic assumption here is that the game in some way times how often merchants will visit a trading port.  One of the main questions is when does this 'merchant timer' start -- eg, when a merchant undocks or when a merchant leaves the map, etc...?  Depending on the answer to that question, placement of trading ports in a town could be important to how often the port gets visited.

Town Setup (see attached maps)
Montitonka is built on a large-sized map.  The starting point in the game was near the map center, and the town is mostly built around a large river entering from the east and exiting at the bottom of the map.  Two areas were chosen for the construction of a total of eight trading ports, ports 1-6 considerably further upstream from ports 7-8.

The round trip of a merchant was modeled as having six timing points:

  • Map Entry -- the time a merchant boat's nose entered the map
  • Arrival Point -- the time a merchant boat's nose passed under the bridge marking this point
  • Docking -- the time a merchant reached a trading port (the merchant bell sounded in-game)
  • Undocking -- the time a merchant was dismissed from a trading port with the 'Dismiss' button
  • Departure Point -- the time a merchant boat's nose passed under the bridge marking this point
  • Map Exit -- the time a merchant boat's nose left the map
The Arrival and Departure Points were set up as bridges across the river upstream and downstream of the trading ports, and were used for convenience to be able to keep consecutive timing points on-screen at the same time.  All eight of the ports shared the same Arrival Point, but the upstream ports (1-6) and the downstream ports (7-8) had different Departure Points.

These points have six intervals between them:

  • Run-in -- interval between Map Entry and the Arrival Point
  • Arrival -- interval between the Arrival Point and Docking
  • Residence -- interval between Docking and Undocking
  • Departure -- interval between Undocking and the Departure Point
  • Run-out -- interval between the Departure Point and Map Exit
  • Off-screen -- interval between Map Exit and Map Entry


salamander

#1
Results
The timings of the intervals were done in seconds at 2x game speed, but are recorded in the following table as the 1x game speed equivalents.  The auto-save feature was disabled.  Round Trip is the interval from undocking to the next docking at a trading port.



















PostRound-trip (avg)Run-inArrivalDepartureRun-outOff-screen (avg)
1
1969
220
40
110
584
1015
2
2065
220
74
72
584
1115
3
2134
220
76
72
584
1182
4
2121
220
88
58
584
1171
5
2139
220
96
50
584
1189
6
1967
220
100
46
584
1017
7
2404
220
358
44
328
1454
8
2337
220
372
34
328
1383

Initial Observations
For the discussion a little later on, note that the four on-screen intervals (Run-in, Arrival, Departure, and Run-out) are based on the map's geography and are constant.  Arrival and Departure intervals seem to be port-specific, but their sum is constant.

In contrast, the remaining two intervals (Round-trip and Off-screen times) show a considerable amount of variability, and the variability in one is mirrored in the other (ie, compare the difference in Round-trip times and the difference in Off-screen times for any pair of ports).  These two intervals include, at least partially, the off-screen part of a merchant's journey.  Because everything on-screen is done in constant time, it is reasonable to conclude that the variability is due to the Merchant Timer (MT), and that the MT is responsible in some way for the amount of time spent off-screen.

Also note that the average Round-trip/Off-screen times for ports 1-6 are considerably lower than for ports 7-8.  As the only difference between these two groups of ports is geographical location on the river, this suggests that the Round-trip/Off-screen times are dependent on the placement of ports on the map, and that the interval measured by the MT includes both on-screen and off-screen components.

Where does the MT start and stop?
Any model of how the MT affects how often a merchant returns to a port (ie, the Round-trip time) needs to account for the observed timing data.  The following figure shows a simplified model of the round trip a merchant makes in the game (the times shown for trip legs A-C are arbitrary).



Of the six timing points defined in the first post of this thread, two (Arrival Point and Departure Point) are arbitrary points I decided to create for convenience.  The remaining four points (Map Entry, Docking, Undocking, and Map Exit) are points that could be expected to be 'recognized' by the game itself.  Therefore, I will define two additional timing intervals based only on the points likely to be recognized by the game:

  • Entry -- interval between Map Entry and Docking (Run-in + Arrival)
  • Exit -- interval between Undocking and Map Exit (Departure + Run-out)
Referring to figure and using these new intervals, the Entry time for Port 1 is equal to A (10 min), and the port's Exit time is B+C (10 min); the Entry time for Port 2 is equal to A+B (15 min), and the Exit time is C (5 min).  Note that the total on-screen time for both Port 1 and Port 2 is 20 min, which is to be expected because on-screen times are constant.

As far as the starting point for the MT, it is unlikely that it could be either of the 'upstream' time points (Map Entry or Docking).  If it were either of these, it would be possible for a merchant bound for a particular trading port to enter the map after the MT expired before the previous merchant had left the port if the previous merchant was being 'kept' in-port for an extended period of time by keeping the port's trading window open.  I have personally never observed this to happen.  That leaves Undocking or Map Exit as the most likely points at which the MT starts.  I am also assuming that the expiration of the MT marks the Map Entry point: 1) because it seems like the simplest way to do things, and 2) because once a merchant re-enters the map, on-screen times are constant, so using Map Entry is as good as any other likely timing point upstream of a trading port.

So, there are two likely hypotheses about the starting/ending points for the MT:

  • Hypothesis 1: start timing at Map Exit / stop timing at Map Entry
  • Hypothesis 2: start timing at Undocking / stop timing at Map Entry
The first hypothesis does not fit the data.  In this case, the MT would be the same as the off-screen time (OS).  Under this hypothesis, the round-trip time for a merchant from Port 1 would be: B+C+MT+A=50 min; and the round-trip time from Port 2 would be the same: C+MT+B+A=50 min.  Although the variability in the round-trip/off-screen times could be attributed to a large amount of game-introduced variability in the duration of the MT, this hypothesis doesn't explain why average round-trip times for ports 7-8 are consistently different from ports 1-6.

The second hypothesis, which overlaps the MT with both on-screen and off-screen parts of the merchant round-trip, does fit the data.  In this case, the MT would not be the same as OS; a portion of the MT would be consumed by the Exit time of the merchant from the trading port to the Map Exit point.  Therefore, the off-screen time would be equal to the MT minus the Exit time: OS=MT-Exit.  Because the Exit time for ports 7-8 is smaller than for ports 1-6 (because of geographical location), the off-screen time for ports 7-8 would be higher than for ports 1-6, consistent with the data.  This would also introduce a natural variability in the off-screen time (and therefore the Round-trip time) based on how close the trading port is to the Map Exit point, in addition to any other variability in MT included by the game.  In other words, geographical location of the trading port becomes important, which was suggested as likely in the Initial Observations section.

Assuming Hypothesis 2 is correct (ie, the MT is from Undocking to Map Entry), the MT for a merchant from Port 1 would be (B+C)+OS, and from Port 2 would be (C)+OS.  Because (B+C) and (C) represent the Exit times from Ports 1 and 2, respectively, both can be re-written as MT=Exit+OS, or OS=MT-Exit.  The total Round-trip time by this hypothesis would be: Round-trip=Exit+OS+Entry for both Ports 1 and 2.  But, because OS=MT-Exit, this becomes Round-trip=Exit+(MT-Exit)+Entry, or (cancelling the Exit's) Round-trip=MT+Entry, for both Ports 1 and 2.  Put another way, the round-trip time for a merchant depends on the MT (a constant, with perhaps some variability added by the game) plus the Entry time for a trading port.

What is the duration/variability of the MT?
Again assuming that Hypothesis 2 is correct (MT=Exit+OS) an estimate of the 'Merchant Timer' can be obtained from the data already collected (data for both Exit times and OS times have been collected).  The data collected represent eight merchant visits at each of eight trading ports, for a total of 64 visits.  Over all 64 visits, an average MT value of ~30 min was observed.  Using the minimum and maximum values of the individual data points, it appears that the variability around this average MT value is up to 5 min, above or below.  Looking at the data by the eight visits to an individual trading port (rather than total visits), gives similar values.  These 'real-time' values convert to in-game times for the MT of 6 months plus/minus 1 month (in the sense that Early Spring, Autumn, Late Winter and so on are considered months).

salamander

#2
Practical Considerations In-Game
Probably the most important outcome of this has to do with the placement of trading ports.  The data collection described here was done on a river, where every merchant followed the same path, stopping at some point to dock at a trading port.  In a similar situation, it appears to be advantageous, as far as getting merchants visiting as often as possible, to have ports located as close as possible to the entry point of merchants onto the map (because round-trip time=MT+Entry).

A map on which trading ports are located around the coast of a lake may be more complicated, but there is no reason to think that the results from the data collected here do not apply to a lake environment.  I would suppose, then, that the closer your trading ports are to the entry into a lake, the more frequently the traders to that port would visit.

The results here also suggest that allowing merchants to remain at a trading port for an extended period of time will delay the arrival of the next merchant at that same port.  So, if you are doing auto-trading, it would be to your advantage to dismiss the merchant manually, with the 'Dismiss' button, rather than allowing the merchant to time-out and leave on its own after three seasons.

Conclusions

  • There is a timer for the return of a merchant
  • For a particular trading port, the timer starts when the merchant undocks and when the timer expires, a merchant arrives on-screen destined for the same port
  • There is variability built into the duration of the timer
  • The duration of the timer appears to be 30 min +/- 5 min; or 6 game-months +/- 1 game-month
  • Trading ports placed nearer to the entrance point for merchants will be visited more often
  • Keeping a merchant at a trading port longer than necessary will delay future merchants to the same port



nmid

Heh, Nice. Being a dedicated trader, I would love to keep this thread in mind.

salamander

Added Introduction and Town Setup sections.

Kaldir

That's a lot of work you're going to do, keeping track of eight trading posts for multiple years.
Will you also be noting which vendor (type and name) visits when? Or is there already knowledge about how often a merchant comes by?

If you find time (sorry, not trying to overload you), it would be interesting to see what a trading post in the upper lake would do. The merchant would have to do a long, extra trip up and down the stream.

You're arrival and departure bridges (smart idea) suggest the merchants are coming from the east in this map? I've only see them going west to east in my maps. Maybe because the river's 'west' entry is in the south here?

Anyway, good luck on the research. I'll be keeping a close look at this thread, although more for curiosity than practical use (I'm not much of a trader myself).

salamander

#6
Added the timings for the eight trading posts.  There's more to come, but I was getting nervous about not having hit the Save button in a while.




@Kaldir -- On this go-around I didn't keep track of which of the five merchant types visited (or the merchants' names).  But, I did collect some information for that type of thing (though not the names) on another map several weeks ago.  I'll try to remember to include that at some point, but the bottom line is that the five merchant types seem to visit with equal likelihood.  After getting runs of Seed Merchants or Livestock Merchants, that's hard to believe, but over several years it seems to be the case.

I'm not even sure whether a merchant would be able to get into the upper lake, which is both fed and drained by small creeks.  I asked about that in another thread a little while ago, and I think I'm going to eventually put a trading port over there just to see if any merchants show up.  If they do, I agree, it would be interesting to see how the timings there compare.

Your right, the river in this map is flowing from east to west.  I really haven't played enough games to say if there's a 'rule' to the way the map generator sets up rivers or not.

Kaldir

Interesting to see that the off screen time seems higher for posts 7 and 8. If that stays consistent in your research, it suggests that trading near the entry point is most profitable. I wonder if that was intended or foreseen by the developer.

It would be interesting to see what the upper and lower round trip time is for the posts, to get a feel for how much randomness is added by the game. Did you dismiss the merchants or let them leave themselves?

Interesting numbers so far. :)

salamander

Added a Results (and Discussion) section.

At this point, I think I've added all I intended to add.  I hope there will be comments, and I'd be more than willing to make changes to the three main posts based on those comments.

rkelly17

Great work, @salamander. I love to see this kind of detailed research, and the timing of merchants is an important factor in supporting a settlement by trade.

Some questions: You indicate that the merchant timer is 25-35 minutes at 1X. Do you think that these parameters are solid, or is this an approximation? Is there any sense of randomness about the exact length? If the hypothesis is correct that the timer starts when the merchant leaves, then it is obvious that trading posts should be built as close to the entrance as possible. The problem is, of course, the geography of the map, which has only a limited number of appropriate building sites. If the hypothesis is correct I would assume that one result would be fewer merchants at posts nearer the exit due to a longer total mean time between merchants. Can you confirm that?

In playing the game it feels that merchants come more frequently as the settlement gets bigger. Does you data give any help in deciding whether the feel has a basis in reality? Does someone need to do a longitudinal study?

Given the existence of "wrong-way merchant" maps in which the merchants go back almost to the entrance point before turning around and rowing for the exit point, if the timer starts when the merchant leaves the post, is it possible to have two merchants connected to one port on the map at the same time? My experience is that a "wrong-way merchant" map is one in which the river makes a 90 degree (or close) turn and runs parallel to the map edge very shortly after entering the map, then after a bit makes a second close-to-90 degree turn toward the center of the map. The merchant turns somewhere in that stretch running parallel to the edge. So far I've had 3 of these maps but I've never built multiple trading posts on any of them. The trading post tends to be near the center of the map where the starting barn or wagon is. I've not really watched to see whether the next merchant always waits for the previous merchant to exit before entering.

Kaldir

Now that is serious research!

It would be nice to see the in-game months next to the 30 mins. That way it's easier to estimate the arrival of the next merchant when you're playing at a higher speed, or when you switch speeds. I don't know how many months 30 minutes (and 25 and 35) on 1x speed is, but I'm sure someone here knows.

Quote from: rkelly17 on June 20, 2014, 09:29:48 AM
In playing the game it feels that merchants come more frequently as the settlement gets bigger. Does you data give any help in deciding whether the feel has a basis in reality? Does someone need to do a longitudinal study?

I wonder if it only feels that way because you have more to do or more to keep track off, and because you might have more trading posts. But it would be nice if someone could do some timings on a 1k+ population map to be sure.

Quote from: rkelly17 on June 20, 2014, 09:29:48 AM
Given the existence of "wrong-way merchant" maps in which the merchants go back almost to the entrance point before turning around and rowing for the exit point, if the timer starts when the merchant leaves the post, is it possible to have two merchants connected to one port on the map at the same time?

No that would be interesting  :) . In theory, if you build a trade post next to the river-exit, the merchant does the entire river twice after undocking, and based on @salamander's numbers this could be long enough for a second merchant to show up.

salamander

@Kaldir -- thanks for the suggestion about converting minutes to game-oriented time.  Where I first mentioned what I estimate the MT to be, and again in the conclusions, I've put in the game-months conversion from the minute times.

I'm pretty sure I remember a long while back seeing that each month was 5 min in real time so that a game year was an hour, but I couldn't find it again to confirm.  It turned out to be easier to time a few months in-game myself, and those values are correct.

@rkelly17 -- Lots of good questions.  It's going to take me a little while to try to answer some of them, but I will try.  I just didn't want you to think I was ignoring you.

salamander

#12
Quote from: rkelly17 on June 20, 2014, 09:29:48 AM
Some questions: You indicate that the merchant timer is 25-35 minutes at 1X. Do you think that these parameters are solid, or is this an approximation? Is there any sense of randomness about the exact length?

Because of the variability apparently built into some part of the merchant's round-trip, and I think it's in the merchant timer itself, the 25-35 min range for the timer is an estimate based on average times.  One of the things, though, that caught my attention was that the same estimate was obtained for all of the merchants from all of the trading posts pooled together, and also for each group of merchants assigned to a particular post considered separately, regardless of the geographic location of the trading post.  I would have to say, based on the number of observations, that I have a moderate to good amount of confidence in the estimate.  I also like the 'roundness' of the estimate -- 30 min +/- 5 min seems like something a human (ie, Luke) might come up with.

As far as randomness around the 30 min average, all I can say at this point is that the deviation from 30 min doesn't have to be either 5 min or nothing; it seems like the deviation can be 0-5 min, with any value in the range being possible.  Whether the deviations are uniform or maybe normally distributed, I can't say at the moment.

Quote from: rkelly17 on June 20, 2014, 09:29:48 AMIf the hypothesis is correct I would assume that one result would be fewer merchants at posts nearer the exit due to a longer total mean time between merchants. Can you confirm that?

On this map, I followed individual visits without noting the month/year of the visit.  However, the round-trip times noted in the timings table do show a general trend toward longer times for trading ports nearer the exit from the map (Port #6 is something a mystery, though).  The longer round-trip times would translate into fewer visits in a set number of years.

A while back on a different map, I tracked the month/year of visits to several trading ports arranged around the edge of a lake, rather than on a river as in Montitonka.  However, the same general trend in round-trip times for the two ports closest and farthest from the entry point to the lake still hold -- the port closest to the entry had more visits/year (~1.8 ) than the port farthest from the entry (~1.7) -- that may not seem like a big difference, but in that case the estimates of visits/year were based on a much higher number of visits (~35 per port), so I think the difference may be real, and over time could add up to a real difference.

Quote from: rkelly17 on June 20, 2014, 09:29:48 AM
In playing the game it feels that merchants come more frequently as the settlement gets bigger. Does you data give any help in deciding whether the feel has a basis in reality? Does someone need to do a longitudinal study?

Over the period in which I was timing visits (8-10 years), I didn't notice any change in the frequency of visits.  However, the timings were done around the 70-80 year mark in the game, so if a shift in frequency does happen, I might have missed it.

Quote from: rkelly17 on June 20, 2014, 09:29:48 AM
Given the existence of "wrong-way merchant" maps in which the merchants go back almost to the entrance point before turning around and rowing for the exit point, if the timer starts when the merchant leaves the post, is it possible to have two merchants connected to one port on the map at the same time?

I agree with @Kaldir, that would be interesting to see/know.  I've never had a map where the merchants did the 'wrong-way' travel, other than the split-second wrong-way flip on undocking.  Unless the game specifically tries to safeguard against having two merchants assigned to the same post on-screen at the same time, I don't see any reason why it couldn't happen.  If the merchant timer starts on undocking, the two merchants shouldn't interfere with one another in any way.  I suspect it would take a very special set of map circumstances for this to happen, though.

rkelly17

@salamander, Thank you for the careful and exact replies to my questions. It sounds like a map with lots of port locations near the river entrance would be better for a trading settlement than one where the majority of port locations are near the exit.

If you want to try timings on a "wrong-way merchant" map, here is a seed that produced the effect for me: 230708357; Valleys, Large, Mild, Off, Hard. This is the map from the Allberger Diaries Settlement. Note that the River comes in from the North (Upper left on the map), then makes a quick 90 degree turn to the East, goes a ways and then turns South. I think that it is the quick 90 degree turn and stretch parallel to the edge (which doesn't show well on the mini-map) that does the trick.

Again, thank you for all your work.

canis39

This is a great thread, thanks Salamander!