Boost city growth

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

orangemoo
Engineer
Engineer
Posts: 7
Joined: 26 Sep 2004 09:49
Location: Canterbury, England
Contact:

Post 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
Horse
Transport Coordinator
Transport Coordinator
Posts: 325
Joined: 10 Sep 2004 20:25

Post by Horse »

Were can i find that.
orangemoo
Engineer
Engineer
Posts: 7
Joined: 26 Sep 2004 09:49
Location: Canterbury, England
Contact:

Post by orangemoo »

Horse wrote:Were can i find that.
In the source code.
User avatar
Gorre
Transport Coordinator
Transport Coordinator
Posts: 322
Joined: 03 Jan 2004 10:28
Location: Somewhere over the rainbow
Contact:

Post 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...
User avatar
Buggi
Engineer
Engineer
Posts: 124
Joined: 02 Feb 2005 19:03
Location: Now in North Dakota

Post 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.
-Buggi
Programmer and TTD fan...
User avatar
Gorre
Transport Coordinator
Transport Coordinator
Posts: 322
Joined: 03 Jan 2004 10:28
Location: Somewhere over the rainbow
Contact:

Post by Gorre »

Probably not, my ICE3 with 400+ passengers is arriving every two month. This sounds really funny...
Horse
Transport Coordinator
Transport Coordinator
Posts: 325
Joined: 10 Sep 2004 20:25

Post 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.
haakon99
Traffic Manager
Traffic Manager
Posts: 155
Joined: 15 Apr 2004 20:54

Post 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
Red.xiii
Engineer
Engineer
Posts: 93
Joined: 11 Jan 2005 13:33

Post 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!!
Horse
Transport Coordinator
Transport Coordinator
Posts: 325
Joined: 10 Sep 2004 20:25

Post 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.
Red.xiii
Engineer
Engineer
Posts: 93
Joined: 11 Jan 2005 13:33

Post 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
pasky
OpenTTD Developer
OpenTTD Developer
Posts: 90
Joined: 25 Apr 2004 15:14
Location: Czech Republic
Contact:

Post 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).
The flush toilet is the basis of Western civilization. -- Alan Coult
User avatar
Buggi
Engineer
Engineer
Posts: 124
Joined: 02 Feb 2005 19:03
Location: Now in North Dakota

Post 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 :)
-Buggi
Programmer and TTD fan...
Jupix
Chief Executive
Chief Executive
Posts: 683
Joined: 19 Feb 2005 09:08
Location: Finland
Contact:

Post 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)
Attachments
metropolitrans.jpg
(716.24 KiB) Downloaded 479 times
#################
User avatar
kilo.dollar
Traffic Manager
Traffic Manager
Posts: 161
Joined: 02 Jul 2007 08:45
Location: Harare

Re: Boost city growth

Post 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.
Year 2243.
Population.Passenger.Mismatch.png (45.71 KiB) Viewed 6227 times
I think that I may never see,
A billboard as lovely as a tree.
Perhaps, unless the billboards start to fall,
I may never see a tree at all.
zombie
Traffic Manager
Traffic Manager
Posts: 153
Joined: 19 May 2005 22:19
Location: Germany

Re: Boost city growth

Post 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
User avatar
kilo.dollar
Traffic Manager
Traffic Manager
Posts: 161
Joined: 02 Jul 2007 08:45
Location: Harare

Re: Boost city growth

Post 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?
I think that I may never see,
A billboard as lovely as a tree.
Perhaps, unless the billboards start to fall,
I may never see a tree at all.
Marco4J
Engineer
Engineer
Posts: 1
Joined: 16 Aug 2007 13:05

Re: Boost city growth

Post 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.

:D

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.
zombie
Traffic Manager
Traffic Manager
Posts: 153
Joined: 19 May 2005 22:19
Location: Germany

Re: Boost city growth

Post 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
Dave_McMahon
Traffic Manager
Traffic Manager
Posts: 253
Joined: 22 Apr 2005 15:40
Location: Ipswich U.K

Re: Boost city growth

Post by Dave_McMahon »

How on earth do you get 4.2 Billion!!!!!! lets see the game!
David McMahon
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 11 guests