Passengers/Mail with Specific Destinations
Moderator: OpenTTD Developers
- Magic_Pixel
- Engineer
- Posts: 80
- Joined: 29 Jul 2004 07:56
- Location: Tulcea/Bucharest, Romania
- Contact:
In this context maybe goods should be added too.
(Although it could be acceptable that some processing industry owns a raw material facility and that facility only sells the cargo to the owner processing industry. For example a specific food processing plant could own/have an exclusive contract with one/several farms)
(Although it could be acceptable that some processing industry owns a raw material facility and that facility only sells the cargo to the owner processing industry. For example a specific food processing plant could own/have an exclusive contract with one/several farms)
- lucaspiller
- Tycoon
- Posts: 1228
- Joined: 18 Apr 2004 20:27
Then people would have no control whatsoever where to take the goods.(i.e to the that need most, not just every city connected in the network that can take it). There are profits to be consindered..Magic_Pixel wrote:In this context maybe goods should be added too.
(Although it could be acceptable that some processing industry owns a raw material facility and that facility only sells the cargo to the owner processing industry. For example a specific food processing plant could own/have an exclusive contract with one/several farms)
- Magic_Pixel
- Engineer
- Posts: 80
- Joined: 29 Jul 2004 07:56
- Location: Tulcea/Bucharest, Romania
- Contact:
Yeah, true, but this is a transport management game and a transport company has to move according to the market demand. Or, if you control both the market and the transportation system there is no challenge involved. I don't think this game is mostly about huge profit numbers as it is about the challenge of achieving a nice transportation network across a country/map. That's why we're always using random maps, so we can face new challenges. Isn't this right? (Besides, one industry could own a supplier which at the other end of the map, and that involves both the challenge and the huge profits you were talking about)
Anyhow, this was just a suggestion to top up the current version as I would gladly accept even a rudimentary passenger destination approach (which luckily is not the case here)
Anyhow, this was just a suggestion to top up the current version as I would gladly accept even a rudimentary passenger destination approach (which luckily is not the case here)
- Magic_Pixel
- Engineer
- Posts: 80
- Joined: 29 Jul 2004 07:56
- Location: Tulcea/Bucharest, Romania
- Contact:
I have split this topic, continue the idiocy here: http://www.tt-forums.net/viewtopic.php?t=9252
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
-
- Engineer
- Posts: 46
- Joined: 31 Jul 2004 21:56
What I've implemented yesterday should work in this scenario. In fact, this is the point of the second screenshot I've posted. You can simply replace the second bus with an airplane, there is no difference.Celestar wrote:What about transferring passengers?
Example:
A ==== B ==== (C,D,E,F)
A is a bus station, B is an airport in the same city, and C-F are airports in distant cities. So if there is a bus going from A to B with to drop off passengers, they'd like to go to C-F.
Celestar
As soon as I can hack something to enable saving, I'll post a first patch/binary for testing, then you'll be able to see it for yourself. I hoped I could do it earlier, but time constraints...
-
- Engineer
- Posts: 46
- Joined: 31 Jul 2004 21:56
@TolgaAbaci: I have a couple of questions regarding your current implementation. How do you handle a setup like this, where some passengers from B want to go to A and some want to go to C?
TrainX should only pick up the correct passengers, does it check its schedule when it tries to pick up passengers?
And how will the station GUI handle different passengers? Will you have an extra window that displays the destinations? Because it already gets crowded when many different cargo types are at a station.
Code: Select all
TrainX TrainY
Town A <----------------> Town B <-------------------------->Town C
And how will the station GUI handle different passengers? Will you have an extra window that displays the destinations? Because it already gets crowded when many different cargo types are at a station.
"There's a readme that comes with the source. I suggest you read it."
- Korenn
- Korenn
-
- Engineer
- Posts: 46
- Joined: 31 Jul 2004 21:56
Yes. It works like this: We keep a graph of all available passenger routes, constructed from orders of vehicles with passenger carrying capability. This graph is used to query the shortest paths (currently paths with smallest number of stops) from one station to all others, by using Dijkstra's shortest path algorithm (basic computer science stuff). This is very fast.dominik81 wrote:TrainX should only pick up the correct passengers, does it check its schedule when it tries to pick up passengers?
Once a vehicle arrives at a station, we find the shortest paths to all possible destinations. Then, for each possible destination, we check whether this train goes in the same direction (same next stop) as the shortest-path. If so, passengers board it. We do the same for the passengers already on board, to decide whether they should get off, or stay on the vehicle.
Right now I still have one more bug in the graph-generation from vehicle orders, seems I am not handling one case properly, but it should not be too difficult to fix. Tomorrow evening...
Good question/point. So far I have not worked so much on the GUIs, very basic stuff as you have seen from the screenshots. Once I manage to get the groundwork done, I'd like to have a look at this issue. I am open to any suggestions on this issue.dominik81 wrote: And how will the station GUI handle different passengers? Will you have an extra window that displays the destinations? Because it already gets crowded when many different cargo types are at a station.
And another update: It looks like I'll be able to get the save functionality done, after some more inspection of the saving mechanism.
-Tolga
- Magic_Pixel
- Engineer
- Posts: 80
- Joined: 29 Jul 2004 07:56
- Location: Tulcea/Bucharest, Romania
- Contact:
Situation:TolgaAbaci wrote:[Yes. It works like this: We keep a graph of all available passenger routes, constructed from orders of vehicles with passenger carrying capability. This graph is used to query the shortest paths (currently paths with smallest number of stops)
route 1
A<--->B<--->C
\___________/
route 2
So this means that if we have a straight route with 3 towns and a curvy route only connecting A to C, the passengers going from A to C will choose route #2 even if technically it is not the shortest? If so, I assume the pathfinding algorithm within the game could be more useful. Or maybe something between your Djikstra and the one in the game (to calculate the fastest route (including times spent in stations - but I guess it is too complex to be done now. I CAN wait )
good luck and thanks for your work
I'm sure this works pretty nice, but I'm not too sure if it is efficent enough. The Dijkstra algorithm has a theoretical running time of O(m + n), where n are the vertices and m as the edges. Implementing it with priority queues gives you O( (n+m) log n), a simpler implementation O(n^2). Even though n is fairly small here, this might still consume too many computations, because it requires O(n^2) each time a train arrives at a station.TolgaAbaci wrote:Once a vehicle arrives at a station, we find the shortest paths to all possible destinations. Then, for each possible destination, we check whether this train goes in the same direction (same next stop) as the shortest-path.
Keep in mind that we try to still make it possible to run OpenTTD on low-CPU devices such as PDAs.
I was just wondering if you had planned it already. GUI won't be a problem, but destinations would need a new one.TolgaAbaci wrote:So far I have not worked so much on the GUIs, very basic stuff as you have seen from the screenshots.
"There's a readme that comes with the source. I suggest you read it."
- Korenn
- Korenn
I think that it's time to admit that to implement everything that people want to will mean cpu requirement increases, and go ahead and let that happen. As for this, I don't really knwo how much of a hit this will cause but frankly if it's reasonable for the mojority of PC owners I don't think theres a reason to worry (for those working of PDA versions, the featurecan always be turned off).
-
- Engineer
- Posts: 46
- Joined: 31 Jul 2004 21:56
The current implementation is the simpler, O(n^2) implementation. I am not sure if a priority queue implementation is worth the effort, since n is quite small here.dominik81 wrote:Implementing it with priority queues gives you O( (n+m) log n), a simpler implementation O(n^2).
Yes, n is rather small for modern hardware, and furthermore the frequency of trains arriving at stations is relatively low (even when you have a lot of them).dominik81 wrote:Even though n is fairly small here, this might still consume too many computations, because it requires O(n^2) each time a train arrives at a station.
Keep in mind that we try to still make it possible to run OpenTTD on low-CPU devices such as PDAs.
I believe even PDAs should be able to handle this part of the solution. Even if it's a problem, this feature can be turned off, then the CPU usage will be the same as the original. So it will still be possible to run OTTD on any hardware it can run on today.
I am not sure if a more efficient solution exists for this problem. If you know about it, or if you have some other suggestion, I'd like to hear about it.
The bigger problem is probably within the MoveGoods function, whose load increases quite a bit for passenger-generating tiles if the switch is turned on. This function is called far more frequently, so this is a bigger problem. However, I have to point out that even the original implementation of this function seems very inefficient to me (it has to scan neighbouring tiles for nearby stations and so on).
Last edited by TolgaAbaci on 04 Aug 2004 20:26, edited 1 time in total.
-
- Engineer
- Posts: 46
- Joined: 31 Jul 2004 21:56
-
- Engineer
- Posts: 46
- Joined: 31 Jul 2004 21:56
Who is online
Users browsing this forum: No registered users and 4 guests