Bus station - how calculate passengers flow

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
ilt
Engineer
Engineer
Posts: 18
Joined: 03 Oct 2008 17:49

Bus station - how calculate passengers flow

Post by ilt »

Hi, all!

We have GetLastMonthProduction for town and industry in API.

My AI builds bus stations. Then AI manages the station on the basis of actual number of passengers. The result often does not meet expectations!

Can we calculate flow of passengers per month for future bus station?
I very interested in the option when the town already has other operating bus stops!

If others AIs have this function, tell me where to look!
krinn
Transport Coordinator
Transport Coordinator
Posts: 342
Joined: 29 Dec 2010 19:36

Re: Bus station - how calculate passengers flow

Post by krinn »

Well, see just bellow why it's not so accurate, but you have GetLastMonthTransportedPercentage to get the amount of your monthly passenger/mail transported.
Roughly it's production-(production*amounttransport) = remain for you if you wish estimated the amount you could grab

But it's not that accurate as for an industry, because if you're in the catchment area of an industry, you have 100% chance to handle the cargo amount produce, while for a town, you will be in its catchment area, but you will only catch a few of them (depend on your station size).
So a finer estimated would be a bit hard to really calc, and at least me, i didn't goes upto that.
That's for a big estimate of a "future station", because when built, you will face the station rating, flow of vehicle (specially for passenger AI that love to kill towns with zillions bus) and other events that could affect it (player destroying building, town can do it too), player paying rights for cargos...
ilt
Engineer
Engineer
Posts: 18
Joined: 03 Oct 2008 17:49

Re: Bus station - how calculate passengers flow

Post by ilt »

Krinn,

I need the "ideal" flow of passengers "future" bus stop for planning (not real flow for manage).

First, flow needs to choose a route that AI is going to build.
Second, flow needed to compare and select the location of the bus stop.

Now, I appreciate the choice of a route for the number of passengers using the formula "production*(1-amounttransport)".
Bus station is constructed in a random tile in the town center. (and often in the wrong place)

I dont know game mechanics catchment area for bus stops.
It like "populations of catchment area / towns population * production * (1-amounttransport)". Right?
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Bus station - how calculate passengers flow

Post by Zuu »

That is probably a good estimate. Although, I believe that population is not strictly correlated to the amount of passengers that a house generates. In AITile, there is a function to check the cargo production of some tiles, which you then would have to compare against last month production of town. Note though that last month production can vary a bit between months. Another option is to try to make a formula that describes how large tile area to query for the total passenger production of a town. I use these kind of formulas in some situations to not query a too large tile area for small towns, however they are more an empirical formula than something based on fundamentals of the game. Also these formulas could easily be broken by a NewGRF that provides houses with significantly higher/lower population per house than default.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
svetovoi
Engineer
Engineer
Posts: 87
Joined: 12 Oct 2007 14:07

Re: Bus station - how calculate passengers flow

Post by svetovoi »

I'd say that simplest [AITown.GetLastMonthProduction(...) - AITown.GetLastMonthTransported(...)] works surprisingly well.

You just need to carefully select a station location so the station would collect as much CargoAcceptance rating from houses around as possible - each house can be considered as a "small factory" and you need to maximize summary production of all "factories" in the station's coverage area.
ilt
Engineer
Engineer
Posts: 18
Joined: 03 Oct 2008 17:49

Re: Bus station - how calculate passengers flow

Post by ilt »

Hmm

How i can CargoAcceptance rating link to passenger flow?

As Zuu said, i think about
tiles produced passengers in catchment area/total tiles produced passengers in town * AITown.GetLastMonthProduction(...) ...
svetovoi
Engineer
Engineer
Posts: 87
Joined: 12 Oct 2007 14:07

Re: Bus station - how calculate passengers flow

Post by svetovoi »

ilt wrote:How i can CargoAcceptance rating link to passenger flow?
AFAIR CargoAcceptance is de facto CargoProduction for towns and to receive production for each house i use AITile.GetCargoAcceptance(...) with zero station radius(last param).

What exactly acceptance/production figures are is not really matters imo, because when you build station at the point with highest summary rating in coverage area you'll be extracting largest passengers share from the town (even with respect to all production fluctuations mentioned by Zuu and krinn). Thus whatever estimation you use - even simplest [AITown.GetLastMonthProduction(...) - AITown.GetLastMonthTransported(...)] - with good station placement function you'll usually receive lesser estimation mistake than your opponents. And this is pretty much all that matters tbh because without opponents you can just use town population as well as almost ideal production indicator.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 7 guests