Attached is a patch to change, and, I hope, enhance, the system of p****enger and mail generation in Simutrans, in respect of the choice of destination city. The current system works like this: each city generates a certain number of p****engers, checks to see whether a stop is in range, and, if it is, gets a random city as its destination (if the city is more than 120 tiles away, it tries again, therefore very approximately preferring more local cities), then checks to see whether the stop has a route to the destination, etc.
This patch is aimed at increasing the chances that p****engers will find a local, rather than a distant, city as their destination: the number of p****engers waiting to be ****igned are split into three roughly equal groups. The first looks for a city within 64 tiles (if the returned random city is more than 64 tiles away, it asks for another one: to prevent infinite loops, if it has done that unsuccessfully 32 times, it returns any city, even if more than 64 tiles away), the second for a city within 128 tiles, and the third, a city within 4096 tiles (each using the same method).
The aim of this patch is to effect a subtle but hopefully important change to gameplay and, consequently, strategy. At present, the game is really very hard in the first decade or so (especially for making a profit from p****engers), but, once a certain threshold is p****ed in terms of the number of towns connected, the game suddenly becomes very easy, and making money ceases to be a challenge. The reason for this is because, because the numbers of generated p****engers have their destinations fairly evenly spread throughout the map (albeit subject to the slight local preference indicated above), a linear increase in the number of connected towns will result in an exponential increase in the number of p****engers who are able to get to their destination. I find that this makes the game too imbalanced: it is too difficult at the beginning, and too easy later on. What is needed is a way to reduce the rate of increase of the number of p****engers carried with every added connexion. Increasing the preference for local towns will go some way towards doing that.
If p****engers and mail are generated at the same rates, but more strongly prefer local destinations, then, as local destinations will be easier and more cheap to connect than distant destinations, players will have more p****engers and mail to transport near the beginning of the game, but the rate of increase as more and more distant destinations are increased will reduce. If the overall number of p****engers is reduced slightly (easily achieved by editing the setting in simuconf.tab), then the difficulty at the beginning will be either the same as at present, or slightly lower, but the game will not then become easier at quite the rate that it does now.
I note above that this patch is only a partial solution to the problem: a second solution would be to give one third of p****engers one alternative destination, and one third of p****engers two alternative destinations, to which each will travel if there is no route to their chosen destination. This is realistic, in that people often go to a town not for something that that town has uniquely, but for something that is present in a number of towns, and people really would go to an alternative town if a route to their chosen town was not available. In gameplay terms, this would have the effect of far more greatly flattening the growth of p****enger numbers over the cycle of the game than a simple preference for locality.
I have not yet written the code for that, as that would be somewhat more complicated, and I should like to see people's thoughts on this patch first; however, I am looking into doing that soon. (The plan at this stage is to have people who travel to alternative destinations be counted as happy/unhappy rather than "no route", and for the fact that they are going to alternative destinations to be invisible to the player, just as it would be to a real transport network planner; but, if anyone has alternative ideas, I should be interested to learn of them).
If, overall, the growth of p****enger numbers as more towns are added can be flattened somewhat (obviously, not too much, since the whole point of the game is to acheive success by building networks), the overall p****enger generation level could be reduced whilst retaining approximately the same (or even, a somewhat lower) level of difficulty at the beginning of the game. This would, in turn, make it far easier to avoid overcrowding in the later part of the game (when the player has a large network), but, conversely, it would be incrementally harder to make newer lines generate a profit. Additionally, I am keen on the idea of a revenue penalty (a sort of opposite speed bonus) for p****engers, mail and goods travelling from overcrowded stations, as well as capping the total number of p****engers/mail/goods that can accumulate at an overcrowded station, to make handling overcrowded stations more challenging (the idea being to make it easier to avoid station overcrowding than it is now, but more of a problem when it does occur).
Any feedback would be most welcome!
Edit: (5th of January 2009) I have now revised and updated the patch to work with the new translations in the code. This patch is up-to-date for nightly r2218. The patch itself no longer includes the simuconf.tab file, because my simuconf.tab contains settings irrelevant to this patch and that might interfere with other people's settings. Instead, I reproduce below the section that needs to be added to the simuconf.tab file in order to make this patch work properly:
################################P****enger routing################################
# Note: the program will generate three groups of p****engers: (1) local;
# (2) midrange; and (3) long distance. The program will look for a town within
# the specified distance ranges for each cl**** of p****enger. If it cannot
# find such a town within a certain number of tries, it will pick a random town.
# The ranges *may* overlap - indeed, this is encouraged.
local_p****engers_min_distance = 0
local_p****engers_max_distance = 64
midrange_p****engers_min_distance = 0
midrange_p****engers_max_distance = 128
longdistance_p****engers_min_distance = 0
longdistance_p****engers_max_distance = 4096
# The following are percentage chances. They represent the chances that
# any p****engers generated will try to find a town within each of the three
# ranges, respectively.
p****enger_routing_local_chance = 33
p****enger_routing_midrange_chance = 33
# p****enger_routing_longdistance_chance is 100 minus the sum of the two above values,
# but not stipulated individually.
# Some p****engers who are not able to find a route will be content
# to go to an alternative destination. Set the maximum number here.
# (Note: whether any given p****enger is content to go to an alternative
# destination, and, if so, the number, will be random. For each
# possible number of alternative destinations, the chances will be even.
# For example, if the number is set at 2, there will be an equal chance
# of p****engers having 0, 1 or 2 alternative destinations).
max_alternative_destinations = 3
# This is the number of p****engers routed at once,
# to save CPU resources. Decreasing this number will
# make the game run more slowly. Default = 7.
p****enger_routing_packet_size = 7