Patch: New passenger destinations

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
Kathius
Engineer
Engineer
Posts: 13
Joined: 06 Aug 2007 21:03
Location: Berlin, Germany

Patch: New passenger destinations

Post by Kathius »

Hi folks,

playing without passenger destinations was quite boring but I didn't want to miss new features like timetables and the new grouping system, so I decided to give it a try and write a passenger destinations patch using the new cargo packets. Thanks to the old patch it was quite easy to find the places that needed to be changed, but the new cargo packets are so different that I decided to rewrite from scratch.
Although still in development, it already works quite well, so I think it's time for a first patch-file.

You can activate it in the economy tab of the patch settings. But please do not do this at the starting screen. At the moment the game will crash if the patch is activated during a game that already has generated passengers, so don't forget to activate it right after starting a new game. The savegame format is also incompatible with others and I plan to introduce features that will change the format again.

Passengers will choose their destination based on how far away and how "big" (according to passengers produced) stations are. They choose their way to their destination depending on the length of the route, not necessarily the number of transfers. The route length is determined by adding the distances between each station involved plus some virtual length for each station and even more length for a transfer.

Connections are displayed in the station window similar to the way the old passenger destinations patch did along with all stations at which passengers have to transfer. Since this list can get very long, I plan to show connections in an extra window later, where they also can be sorted. This would also allow to display alternative routes, which are not implemented yet.
Currently, the passengers' destinations are only displayed at stations and in trains. Other vehicles can also transport them but you won't see where they want to go.

Many thanks go to:
- the authors of the original patch, destinations make OpenTTD so much better
- rubidium for reading my mind and improving the pool-code at the same time I got nuts trying to write the saveload-code
- my girlfriend for not being too upset that I was programming all day long during the last week

Enough said for now, just try it out (hope it works)!

Greetings,
Kathius
Attachments
newdestinations_10814.diff
(51.85 KiB) Downloaded 1852 times
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: New passenger destinations

Post by Roujin »

Wow, thanks a lot for your effort! :)
..building right now to try it out :)

Your system of length+virtual length sounds reasonable :) can't wait to test it & hope you get the issues with crashes etc. sorted without too much hassle ;)


bang, compile finished, i'm off :D wheee ^_^

PS: well tell your gf it was worth it :D you're definately my hero of the day right now ^^


edit: first thing i noticed: the text in the patch options is in another color than the other lines, or is that on purpose?
Last edited by Roujin on 07 Aug 2007 00:11, edited 2 times in total.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: Patch: New passenger destinations

Post by athanasios »

I will download and compile. Thanks!
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: New passenger destinations

Post by Roujin »

i think i have found a bug: in the station window, as soon as there are three or more blue lines (the ones for specific destinations), the white lines for other types of cargo (e.g. mail) get pushed down outside of view. there's no scroll bar to scroll down to them.

if i have another (4th) destination, i can scroll down to that line, but still not down to the white line for mail (in my case), which should be below.

other than that, it works like a charm :) :) (have yet to try airport feeders and such :) )


edit: and i have a question about your destination choosing system. if there are two ways from A to B, and one is slightly better, will ALL of the passengers only take the better one or will some also take the longer route?
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
rav
Traffic Manager
Traffic Manager
Posts: 253
Joined: 17 May 2007 13:36
Location: Netherlands
Contact:

Re: Patch: New passenger destinations

Post by rav »

awesome first post Kathius! welcome to the forums :]

I really, really like passenger destinations, and I hope I can find the time to compile & run this patch really quick!
I also have a suggestion (not critisising your awesome work in any way): you could use timetables to let passengers decide which is the quickest route to their destination (eg: from station A to B, directly with train X takes 100 ticks, going via bus Y to airport C and take plane Z to B takes 40+20 ticks, so passengers will prefer to go by plane) :)
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: Patch: New passenger destinations

Post by Zephyris »

Awesome first post! I'm so glad to see this patch resurrected...
They choose their way to their destination depending on the length of the route, not necessarily the number of transfers.
I like that, it'll stop the profiteering which was possible in the last version where you could force passengers to take excessively long routes. This way they'll take the cheapest route - much more reallistic.
Ghost
Engineer
Engineer
Posts: 20
Joined: 10 Jan 2005 10:02
Location: St.Petersburg, Russia

Re: Patch: New passenger destinations

Post by Ghost »

Someone, please, post the compiled windows executable!
Thanks in advance!
User avatar
rav
Traffic Manager
Traffic Manager
Posts: 253
Joined: 17 May 2007 13:36
Location: Netherlands
Contact:

Re: Patch: New passenger destinations

Post by rav »

Ghost wrote:Someone, please, post the compiled windows executable!
Thanks in advance!
ofcourse, you could try compiling yourself with BuildOTTD
bokkie
Transport Coordinator
Transport Coordinator
Posts: 327
Joined: 19 Jan 2007 19:26

Re: Patch: New passenger destinations

Post by bokkie »

nice :D
Ghost
Engineer
Engineer
Posts: 20
Joined: 10 Jan 2005 10:02
Location: St.Petersburg, Russia

Re: Patch: New passenger destinations

Post by Ghost »

rav wrote:
Ghost wrote:Someone, please, post the compiled windows executable!
Thanks in advance!
ofcourse, you could try compiling yourself with BuildOTTD
Managed to do this. Thank you for advice!
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Patch: New passenger destinations

Post by MagicBuzz »

Outstanding first post Kathius ! :shock:

Considering the passenger with destination, I wonder if it could be possible to have the same function for general cargo.

I mean, currently, in OTTD, when an industry produce N units of goods, you can transport it all to any other industry accepting this kind of goods.
But in reality it doesn't work like this : an industry will subscribe contracts with others ones, then will send to them only the needed amount, not more.

By this way, we could end up with REALLY complex networks, that must combine any kind of transport.

Currently, you can become a Tycoon just by looking at the map :
- Ok, 3 coal mines are closes together here...
- Ok, one power plant is very far... Land is quite flat...

Let's go : I build 50 trains on a very long line between the coal mines and the power plant, then all trains will gain millions dollars for each course. After less than 5 years I have billions in bank so I just have to start a new game coz it's anoying to continue building while there is no challenge anymore.

With various destinations for goods, we should be encouragead to start the game with more trucks for short range services, as only a few amount of goods will be transportable to each consumer industries and longer routes with trains won't gain anought money.

I don't have any idea about the "how hard is it to code", but I should love this feature... I dream for this since the first Transpot Tycoon version :)
User avatar
rav
Traffic Manager
Traffic Manager
Posts: 253
Joined: 17 May 2007 13:36
Location: Netherlands
Contact:

Re: Patch: New passenger destinations

Post by rav »

it's certainly different from passenger destinations as passengers pick destinations only if they can reach them :|
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Patch: New passenger destinations

Post by MagicBuzz »

rav wrote:it's certainly different from passenger destinations as passengers pick destinations only if they can reach them :|
Oh :(

I would prefer passenger destination works with any existing city on the map. I'll take a look at the patch and see if it can be turned as an option then :)
User avatar
rav
Traffic Manager
Traffic Manager
Posts: 253
Joined: 17 May 2007 13:36
Location: Netherlands
Contact:

Re: Patch: New passenger destinations

Post by rav »

I think that that would result through-the-roof memory usage, and generally an unplayable game: lets say a city produces a couple of hundred passengers per year on a 2048 * 2048 sized map with a reasonable amount of cities: each city would get only a few passengers and transportation would result in losses
Vloris
Engineer
Engineer
Posts: 108
Joined: 13 Jan 2007 22:39
Location: Enschede, The Netherlands
Contact:

Re: Patch: New passenger destinations

Post by Vloris »

MagicBuzz wrote:I would prefer passenger destination works with any existing city on the map.
How nice (and complex to work with) that may look, it doesn't work that way in reality.
You don't go to the trainstation wanting to travel to Town-X-which-has-absolutely-no-public-transport do you?
All passengers waiting at a specific trainstation have a travelplan in their minds which includes a destination station to end their journey.

I used "waiting" there, of course, some passengers go to a station to ask for possible directions to destination X, but those aren't waiting, and so shouldn't bee seen in the list of waiting passengers in openttd.

And, I concur with rav: it would be rather unplayable on a large map: there are just to many cities to connect together in one complete 1920-2050 game usually.
Kathius
Engineer
Engineer
Posts: 13
Joined: 06 Aug 2007 21:03
Location: Berlin, Germany

Re: Patch: New passenger destinations

Post by Kathius »

Thanks everybody for the positive feedback.
Roujin wrote: first thing i noticed: the text in the patch options is in another color than the other lines, or is that on purpose?
Just something I was too lazy to fix ;)
Roujin wrote: if i have another (4th) destination, i can scroll down to that line, but still not down to the white line for mail (in my case), which should be below.
Never noticed this one, because I usually don't transport mail. Will be fixed soon.
Roujin wrote: and i have a question about your destination choosing system. if there are two ways from A to B, and one is slightly better, will ALL of the passengers only take the better one or will some also take the longer route?
All passengers will take the shorter route, so the vehicles serving the longer route have more space for passengers on their route. However, if passengers have to wait more than 3 months for their short route train to arrive, they will start to take ANY train that brings them to the next station.
By the way, it's also possible to create - how should I call it? - bidirectional circular routes. So if you have two routes a-b-c-d-a-b... and a-d-c-b-a-d... and a passenger want to get from a to d, he will take the a-d-c-b-a route. In the old patch he would have used whatever vehicle arrived first.
rav wrote: you could use timetables to let passengers decide which is the quickest route to their destination
I thought about that before. But not every route is guaranteed to have a timetable, so how would I compare timetabled to not timetabled routes? If vehicles would be forced to generate a timetable and you couldn't change them below the calculated times, it could be a very reliable system though.

I don't like how "connections" are generated currently anyway, it's just a very basic system that doesn't recognize route changes very well. The station looks for connections as soon as a vehicle enters the station. It then compares the vehicle orders to its existing connections, replacing routes that got shorter, but not replacing routes that got longer. It just doesn't know that the short route doesn't exist anymore.
MagicBuzz wrote: Considering the passenger with destination, I wonder if it could be possible to have the same function for general cargo.
This would be interesting indeed, and it shouldn't be too hard to implement. However, I first want to get passenger destinations right, it still has some problems and needs some finetuning.

Like the connection building system, the way passengers decide their destination is just a quick and dirty approach to make it work for the moment, that has some major "problems" especially when you start to build rather unrealistic networks (ten bus stations in a small town compared to a single large station in a big city, the small town will attract way more passengers than the large one).

But for now I don't care as much for WHERE passengers want to go. It's more important to me to have a good way to decide HOW they get there, so I will approach a better connection building system next.

So long,
Kathius
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: New passenger destinations

Post by Roujin »

hmm, after some more playing around, i wondered if you should consider different means of transportation when calculating the best route. Say there is both a train and a bus from A to B, normally the train should be first choice. But on the other hand, then the bus line would be totally empty, would that be realistic? I think some people would still use the bus... hmm

How do they act currently? From what you wrote i guess they would treat the train an the bus line equally...

Unless of course the bus line has a stop inbetween (which the train line doesn't have). Then suddenly the train would be preferred, wouldn't it?


I think (without any disrespect to your effort so far) this system still needs some thought...

Choosing which way to take should in my opinion be more flexible, not all-or-nothing - a smaller percentage of passengers might also choose a slightly longer route. (Though, you would have to guarantee that no one uses lines that are completely the wrong directions...)

just some thoughts i've had...

edit:

I've made this little setup.. (see image)


first i made Bus 1 go A->B->C->B->...
they happily take the bus to any destination

then i made the Train, A<->C
now the pax from A to C and from C to A won't take the bus anymore, just the train (except that 3 month rule, haven't tested that)

then i made Bus 2, which goes only A<->C without stopping at B
now the pax from A to C and from C to A will use the train and Bus 2 equally, whatever comes first


all in all the behavior is like i thought it would be.

A suggestion i have is adding some virtual distance to the ways depending on the transport type (bus, train...), so bus gets some kind of a penalty compared to train... airplane would be even better than train etc.
But then you would have to change it so that a certain percentage will still use the longer route...
Attachments
Vorwald Transport, 23rd Sep 1936.png
(286.45 KiB) Downloaded 1068 times
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Kathius
Engineer
Engineer
Posts: 13
Joined: 06 Aug 2007 21:03
Location: Berlin, Germany

Re: Patch: New passenger destinations

Post by Kathius »

The type of vehicle is not taken into account, that's right. The system works this way:
  • Passengers know their destination and the next station in their route (not necessarily a transfer station).
  • Passengers will jump on any vehicle that has their next station as its next station, i.e. if a bus and a plane both go directly to a station 1000km away, passengers will use the bus if it comes first. If the plane has another airport in between they even will never go by plane (except, of course, the passengers have to wait for more than 3 months. However, the plane would take only the (frustrated) part of passengers that really waited that long, not the ones that just arrived, so it's not all or nothing).
  • Passengers will leave the vehicle as soon as its next station doesn't fit anymore, effectively meaning that passengers sometimes transfer more often than necessary. Still, they could be faster this way because there might be a train with route a-b-c, a train a-b and a train b-c. If the train a-b arrives first, they will use it until b where train b-c might arrive before train a-b-c.
The system works in general but has some problems. If you have a bus route abcd and train route bd and passengers want to go from a to d, the most reasonable way would be to stay in the bus for the whole route (at least for short distances). This might even be what station a says. In the end, however, passengers WILL change at station b because it in turn says that the fastest connection from b to d is by train (which of course is right if you don't take into account that they once came from a).

The best thing (in my opinion) would be to let passengers know their next waypoint (transfer or destination) plus some indicator to know which vehicle to take. This could be the order list, vehicle type, vehicle speed or a combination. However, there might be second best routes only slightly behind the best route, so that passengers might want to use that one instead if it arrives first. A station would need to store more than one connection to the same destination. But that would definitely require the seperate connections window. There could be a button next to the vehicle buttons in the stations window that opens that extra window.
Tikor
Engineer
Engineer
Posts: 3
Joined: 07 Aug 2007 14:52

Re: Patch: New passenger destinations

Post by Tikor »

Kathius wrote:
MagicBuzz wrote: Considering the passenger with destination, I wonder if it could be possible to have the same function for general cargo.
This would be interesting indeed, and it shouldn't be too hard to implement. However, I first want to get passenger destinations right, it still has some problems and needs some finetuning.
You could implement the ConnectionList in the GoodsEntry struct so the patch would be prepared for all cargo and new Industries.

Try to keep it as simple as possible for the beginning.
And please Dev's, don't let this one die like the last patch! Post your opinions and help him getting it into trunk. It seems to be a good approach.
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: Patch: New passenger destinations

Post by Zephyris »

A basic solution to the passengers per station weighting problem would be as follows:

PA = XA/T

Where:
PA = Probability of a new passenger wanting to travel to station A
XA = Passenger production rate of station A
T = Total passenger production rate of all player's stations

This need only be updated once a month or so so would not be computationally intensive...
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Baidu [Spider] and 25 guests