4

Normally, the game's map generator creates towns with arbitrary populations starting under 100 and going up to over 2000. I would like to tweak these min/max values to something like 100 and 500.

Is there a setting or a newGRF I'm missing that will allow me to do that?

4

There is no specific way to achieve what you're asking without editing the source, however there are a few work-arounds which can get close to what you're after.

Firstly, in OpenTTD, some Towns are designated Cities. Cities start off with a higher population count and also grow faster compared to towns. You can disable the generation of Cities by changing the "Proportion of towns that will become cities" option in Advanced Settings to 0. Whilst there will still be some population variation between towns, the difference will be drastically reduced.

However, this will still leave a wide variation in population sizes between towns, with populations ranging from below 100 to above 1,000. Towns also come in 3 variants - small, medium and large. Whilst there is no way to influence the type of town generated when playing a new game, another work around exists using the scenario generator. Enter the scenario generator and have it generate terrain for you to your liking, just as you would have done when starting a new game. Once the terrain is generated, open the Town Generation tool. Select the size of town you wish to add to the map, Small, Medium or Large, and then click the Random Town button repeatedly until the desired number of towns has been generated. Save the scenario and return to the main menu. You can now use the Play Scenario option to play your new custom scenario.

  • I'm afraid that's not quite what I'm looking for. Even at 1 in 20 and size multiplier of 1, I still ended up with a range of 63-926. It's better, but I basically want to set up my own arbitrary values. – Pvt. Grichmann Feb 24 '14 at 20:06
  • Unfortunately, I don't think there's a way to achieve that in standard OpenTTD - you'd need to modify the source code responsible for town generation. One alternative could be to use the scenario editor, where you can set the size of the town created to be Small, Medium or Large. This won't give you a precise population number for each town, but will give you finer population control. A quick way to do it would be to go in to the editor, create a new random landscape and then in the Town Generation tool, select the size of town you want and repeatedly click the Random Town button. – KingJ Feb 25 '14 at 7:03
  • Then I suppose "it can't be done without messing with the source code" is the answer I'm looking for, with workarounds as an added bonus. – Pvt. Grichmann Feb 26 '14 at 12:08
  • I've now updated my answer above to reflect this. – KingJ Feb 27 '14 at 10:00
0

You can also achieve this by using "game scripts". Check out the site at https://nogo.openttd.org/api/trunk/. By utilizing the GSTown class you should be able to generate towns in any way you want to a large degree of flexibility.

Say you want towns in the "desert" climate that are about 300-500 population. A typical house in this climate is 10 people or so. So you would like 30-50 buildings.

Note that the occupancy of buildings (as well as how much cargo is generated) will largely depend on the newGRFs you use. So if you have a 'target population' in mind you may have to experiment to find out what the average building occupancy is. There is a more exact way, but this requires time*.

First, generate a map that is devoid of towns and industry (using map generator custom options you can specify less towns). Then, write a game script that creates some random 'small' towns and a bunch of industries.

Finally, iterate over the towns, looking up their population. Add extra houses by using the "ExpandTown" function to expand each town by however many houses it's 'missing'.

*To generate your buildings more exactly, you want to build a few buildings, then wait 3 months (until they complete building) and then check the population of the town. Once it hits your randomly generated 'target population' you can stop building. There's a bunch of statistics that comes in to minimize the number of rounds you need to add/remove buildings until you hit the target or get 'close enough'. What you could do is e.g. exponential approximation: build half the extra amount you think you need, wait 3 months, then repeat. In 10 iterations (let the script run for 3 years before you start building) you'll be able to get very close.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.