Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New setting: Grow cities around stations #9089

Closed
Seramis opened this issue Apr 24, 2021 · 3 comments
Closed

New setting: Grow cities around stations #9089

Seramis opened this issue Apr 24, 2021 · 3 comments
Labels
enhancement Issue would be a good enhancement; we accept Pull Requests!

Comments

@Seramis
Copy link

Seramis commented Apr 24, 2021

Version of OpenTTD

All future versions

Expected result

A new setting is introduced: "Grow cities around stations". When enabled, the city growing algorithm uses a random passenger-accepting station belonging to this city to use as a center-point to grow the city. As a result, cities will not look just like circles, but have a small "blobs" around each station.
In this random station selection, keep the city's center-point still as one of the options.

While i'm not too good at C++, i believe town_cmd.cpp file, method "GrowTown(Town *t)" on line 1690 needs an update on lines
1711: TileIndex tile = t->xy; // The tile we are working with ATM
1727: tile = t->xy;
Where instead of always choosing town's center point, it should find all appropriate stations + adds its own center point just as one option, and use random option from the result.

In addition, configuration panel needs some updates to enable or disable this option.

Actual result

Setting is not (yet) present today.

@PeterN
Copy link
Member

PeterN commented Apr 24, 2021

One thing to bear in mind is that the centre point must be a road tile as the algorithm follows roads, so you'd need to find a suitable road tile near the starting point. Doing so would also help the long standing issue (that is probably used deliberately by some players) that if the central road tile is removed a town cannot grow.

@Seramis
Copy link
Author

Seramis commented Apr 24, 2021

One thing to bear in mind is that the centre point must be a road tile as the algorithm follows roads, so you'd need to find a suitable road tile near the starting point. Doing so would also help the long standing issue (that is probably used deliberately by some players) that if the central road tile is removed a town cannot grow.

On that same method, there is already logic for that using data on lines 1692-1706. That same logic would apply here with stations.
Though, maybe that list of "search areas" (called "_town_coord_mod[]") may need some "enlarging" as the stations can be quite big. :)

@TrueBrain TrueBrain added enhancement Issue would be a good enhancement; we accept Pull Requests! and removed suggestion labels Apr 24, 2021
@TrueBrain
Copy link
Member

There are many (good) ideas on how to improve town growth. No doubt there :)

Sadly, an implementation for this is not trivial. This because we would like to have a generic solution where people can write their own town growth algorithm for. The main motivation here is that there are many of these ideas, and we cannot implement them all. In the past we used to do that, which resulted in many many settings, which are very hard to maintain and hard to make sure the game isn't broken in any combination of them.

Additionally, we tend not to leave feature-requests on our issue-tracker. We have our forums for that, which is a much better incubator for ideas.

Normally I would say: if you want to learn C++, let us know, and we can see if we can help you out, but if I am being honest: this is not a good starting point :P It isn't easy to add a generic interface for it.
Of course if you just want to have fun and see what you can make town growth do, you should absolutely do that. And the forum will be very judgemental of the result (both positive and negative), so please do share any progress there :)

But for now, sadly, I will be closing this ticket. If any developer ever picks up making town growth scriptable, we will for sure keep this usecase in mind!

Tnx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issue would be a good enhancement; we accept Pull Requests!
Projects
None yet
Development

No branches or pull requests

3 participants