Page 5 of 6
Posted: 26 Feb 2005 15:48
by orangemoo
Here's the definitive answer!
Each "tick", one town is checked. So that it remembers which town it is checking, there is a global variable called _cur_town_ctr. This is incremented each time a town is checked meaning that the next one will be checked.
However, _cur_town_ctr is only a byte, meaning only a maximum of 256 towns will ever be processed - in an 11x11 map there can be around 2000 towns, meaning that 1750-odd of them will never ever grow. Changing _cur_town_ctr to a uint solves the problem and everything grows nicely!
Jonathan
Posted: 27 Feb 2005 07:21
by Horse
Were can i find that.
Posted: 27 Feb 2005 09:41
by orangemoo
Horse wrote:Were can i find that.
In the source code.
Posted: 27 Feb 2005 21:09
by Gorre
Well, in my current game, i have about 150 cities, all of my cities are connected with at least one bus. (i must say i really hate having 4, or 5 stations in one city which is ugly).
The world population raises from 45k to only 60k during almost 50 years.
And the worst thing is, that I was delivering 1000+ cargo per month to some city and its population lower from 1600 to just 600. This really drives me ill...
Posted: 28 Feb 2005 03:42
by Buggi
probably because you weren't servicing that station every 20 days
Yeah, city growth is baffling me too. See my thread "A Request" in the dev forum.
Posted: 28 Feb 2005 06:31
by Gorre
Probably not, my ICE3 with 400+ passengers is arriving every two month. This sounds really funny...
Posted: 28 Feb 2005 11:42
by Horse
I hope it will be changed soon.
I have searched in the soucre code with my compiler but i have not found it.
Posted: 28 Feb 2005 19:38
by haakon99
Horse wrote:I have searched in the soucre code with my compiler but i have not found it.
Compilers are probably not that good for searching...
Easier just to look here:
http://svn.openttd.org/cgi/viewcvs.cgi/ ... iew=markup
Then try edit and search for "
static void UpdateTownGrowRate(Town *t)" from the internet explorer menu.
HÃ¥kon
Posted: 01 Mar 2005 16:40
by Red.xiii
orangemoo wrote:Here's the definitive answer!
Each "tick", one town is checked. So that it remembers which town it is checking, there is a global variable called _cur_town_ctr. This is incremented each time a town is checked meaning that the next one will be checked.
However, _cur_town_ctr is only a byte, meaning only a maximum of 256 towns will ever be processed - in an 11x11 map there can be around 2000 towns, meaning that 1750-odd of them will never ever grow. Changing _cur_town_ctr to a uint solves the problem and everything grows nicely!
Jonathan
Well if Jonathan is correct the the source has been fixed

Just checked it out and it has indeed been changed to a unit. Maybe a mod could lock this thread, and then maybe people will read instead of just posting the same questions!!
Posted: 02 Mar 2005 09:22
by Horse
And what is fixed exactly.
I have the nichtly of 1 march.
How do you know it is fixed i have not see any comments of a Developer it is changed.
I have tried to play it but i don,t see difference.
Posted: 02 Mar 2005 17:27
by Red.xiii
well _cur_town_ctr used to be a byte type, it is now a unit.
Tested using the 1914 build on big maps and although it takes slightly longer to grow, as soon as its over the ~2000 Mark then the town springs into growth action. Tested on a 10*10 Map, with 3 random town's the test subjects and watched the world population as well. No town shrinkage beyond the normal fluctuation.
Got to have plenty of roads for the town to grow into though as i'm not sure what's happened to the town's road building ability...
It did take around 10 years for it to get to the 2000 mark with 3 buses going to 5 depots. Increasing the amount of buses helped as did laying more roads down.
Test it, just cheat to give yourself 10 Million, flattern the area around the town, build 5 bus depots and 4 buses and some roads then run it in fast forward mode. After shrinking/changing loads around the first 10 years it then grew normally
Hope that helps
Posted: 06 Mar 2005 23:47
by pasky
Please test the latest SVN regarding the slowdown on large maps, I hope I fixed it (using toholio's code as an inspiration).
Posted: 08 Mar 2005 19:31
by Buggi
I can confirm a MAJOR change to the town growth on large maps. *claps*
Maybe the little expand cheat won't be needed afterall

Posted: 08 Mar 2005 19:55
by Jupix
I just played a single player game on a 10x10 map. Cities seem to grow very well, good job fixing it (although I never had a problem with this)
Re: Boost city growth
Posted: 16 Aug 2007 08:09
by kilo.dollar
Well, I am struggling to regain my lost city status, oops, growth rate. Shrinking cities.
But, why do I have cities with enormous populations yet everything is dwindling except roads? Passengers have fallen drastically, buildings are reducing.
See attached pic.

- Year 2243.
- Population.Passenger.Mismatch.png (45.71 KiB) Viewed 6243 times
Re: Boost city growth
Posted: 16 Aug 2007 09:21
by zombie
Hi there.
IIRC OpenTTD can handle only 65536 houses per city. If you reach that number of houses it drops back to 0 (overflow). The number of passengers a city can generate depends on the number of houses. To increase the number of passengers you have to grow the city even more although this city has reached an impressive size.
Kind regards
Zombie
Re: Boost city growth
Posted: 16 Aug 2007 10:41
by kilo.dollar
So why that big population in my city, and so few houses. It appears like each house can acommodate 100,000 people.
Is that right?
Re: Boost city growth
Posted: 16 Aug 2007 13:07
by Marco4J
Thanks for your help in this thread folks. I increased (for no real reason) Mansfield's population from 680-ish to about 950 within a year using the tips.

Now I might try something more worthwhile.
Ed - Now, five years later, Mansfield is a town of 5,650 people. Makes me wonder where they all come from. I've also made Elgin grow from 133 to 1,102, and have had a similar increase on Douglas, Isle of Man.
Re: Boost city growth
Posted: 16 Aug 2007 16:09
by zombie
Hi.
kilo.dollar wrote:So why that big population in my city, and so few houses. It appears like each house can acommodate 100,000 people.
Is that right?
The number of people and the number of houses are two different values not completely linked together. Let us pretend you have a city with a population of 1,000,000 and 65,535 houses. That's about 15 residents per house. If the game adds another house and 15 more residents you will have a population of 1,000,015 but you won't have 65536 houses because OpenTTD can't store this value. The number of houses can be anything from 0 to 65535. Therefore you are back to 0 houses and you have to continue growing the city to get more passengers a month.
The population can have any value from 0 to 4,294,967,295 and according to your screenshot you are damn close to the upper limit, too.
I hope that helps.
Kind regards
Zombie
Re: Boost city growth
Posted: 17 Aug 2007 18:36
by Dave_McMahon
How on earth do you get 4.2 Billion!!!!!! lets see the game!