Plane maximum range

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

User avatar
KrevRenko
Engineer
Engineer
Posts: 104
Joined: 25 Mar 2005 14:28

Re: Plane maximum range

Post by KrevRenko »

How do you prevent a plane that flies to an airport that is well within it's range from looping around, waiting for a clear runway until it runs out of fuel and falls from the sky?

By not accounting for it?

I think that this would not happen on a real airport, but is more than likely on a crowded OTTD airport if aircraft queuing is not being used.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Plane maximum range

Post by MagicBuzz »

KrevRenko wrote:How do you prevent a plane that flies to an airport that is well within it's range from looping around, waiting for a clear runway until it runs out of fuel and falls from the sky?

By not accounting for it?

I think that this would not happen on a real airport, but is more than likely on a crowded OTTD airport if aircraft queuing is not being used.
IMHO as I suggested, the range must be computed when affecting the orders. After, the plane should just fly as it fly now, without taking care of the time it actually flies.

I mean departure and approach times should not be considered.
doghousedean
Traffic Manager
Traffic Manager
Posts: 141
Joined: 30 Apr 2007 10:26

Re: Plane maximum range

Post by doghousedean »

All it really needs is an error box etc that pops up when you try and give a plane an order that is out of range!

Then you dont need to touch the movment code.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Plane maximum range

Post by DaleStan »

So I order it to an intermediate airport, then order it to the distant airport, and then remove the intermediate order.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Plane maximum range

Post by MagicBuzz »

DaleStan wrote:So I order it to an intermediate airport, then order it to the distant airport, and then remove the intermediate order.
And the program have just to compute again the range, and invalidate any unreachable airport :p
This should be really easy to do IMO.
Thus it would automatically raise the "Vehicle has invalid orders" popup, so there is no need to do anything more ;)
User avatar
KrevRenko
Engineer
Engineer
Posts: 104
Joined: 25 Mar 2005 14:28

Re: Plane maximum range

Post by KrevRenko »

What if you actually delete the intermediate airport? And do this mid-flight? Will the plane find an airport within range to land at? Or, if there is none, will it quietly exceed its range to go to the destination?
doghousedean
Traffic Manager
Traffic Manager
Posts: 141
Joined: 30 Apr 2007 10:26

Re: Plane maximum range

Post by doghousedean »

KrevRenko wrote:What if you actually delete the intermediate airport? And do this mid-flight? Will the plane find an airport within range to land at? Or, if there is none, will it quietly exceed its range to go to the destination?
Maybe this could be a new disaster type?
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Plane maximum range

Post by MagicBuzz »

OTTD isn't a flight simulator.

The plane won't go to the nearest airport... For what ? What does a train or a truck when it head to a station that is deleted ? It just tries to reach the next valid order. It just have to do the same.

Here is a small draft about what I'm thinking about :
aircraft-range.gif
aircraft-range.gif (11.38 KiB) Viewed 2092 times
- The aircraft initial orders are A->B->C->D->E->F->G->H
- You remove the airport "C" (you destroy it, or you remove it from orders)
- The "RemoveOrder" function and the "Airport destructor" both raise a small check to ensure the plane range is still ok.

Algo (simplified)

Code: Select all

For each orderlist that use the removed airport
   curRange = FindPlaneWithShorterRange(orderlist).MaxRange
   order = orderlist.firstorder
   While order != null
      If order.next = null and order.previous = null
         break
      If order.next = null and order.previous != null and Distance(order.previous.dest, order.dest) > curRange
         order = order.previous
         order.next = null
      Else If order.next != null and Distance(order.dest, order.next.dest) > curRange
         order.next = order.next.next;
      Else
         order = order.next;
      End If
   End While
End For
=> This should update correctly any order list that uses the removed airport. Planes will just continue the updated order list.
doghousedean
Traffic Manager
Traffic Manager
Posts: 141
Joined: 30 Apr 2007 10:26

Re: Plane maximum range

Post by doghousedean »

obviously, not thinking straight today, my cats kept me up all night!
User avatar
KrevRenko
Engineer
Engineer
Posts: 104
Joined: 25 Mar 2005 14:28

Re: Plane maximum range

Post by KrevRenko »

MagicBuzz wrote:OTTD isn't a flight simulator.

The plane won't go to the nearest airport... For what ? What does a train or a truck when it head to a station that is deleted ? It just tries to reach the next valid order. It just have to do the same.
But you don't want to simulate bus range or train range(diesel/steam). You want to simulate airplane range.

No, OTTD is not a plane simulator. But it is you who wants to add a simulation aspect to it, not me.

Imagine, for example, a very large map of the Atlantic ocean with US East Coast, France and the UK. I could build a regional jet, set up artificial islands spaced within plane range, build airports and then send the jet flying through the order chain, deleting intermediate airports as is convenient. And the plane can cross the Atlantic suddenly! It may even be profitable since the regional jets cost less to maintain, are high capacity and the distance is huge and so on.

Not like I can stop you from coding this the way you want it to have. Just don't call it plane range restriction, call it order distance fasc... restriction or something like that since what you're doing is not restricting a plane's range.

EDIT: spelling corrections
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Plane maximum range

Post by MagicBuzz »

KrevRenko wrote: But it is you who wants to add a simulation aspect to it, not me.
I don't want it.
Read my first post in this thread : I don't like the idea. I think even huge maps (4096x4096) are not big enought to need a plane range.

Thus, when you play alone, you just have to choose yourself which plane can go where. The problem should only be present when playing on multiplayer games, that doesn't allow bigger maps (or you might experience desync).

My interventions in this thread are just some suggestion about a way to handle this feature, as the GRF format doesn't have much chances to handle this information as it need an update that is unusefull for TTDP that is the GRF specs owner.

I won't code anything. I can support someone that tries to implement this feature, but I won't design a patch, as I don't want it ;)

The only thing I might work on, when the vehicle realistic physics acceleration feature will allow it, is on a "realist accidents" patch, where you planes could fall down out of fuel, and you trains crashing when taking a curve at with a too high speed. At this time I might need this feature, but currently I didn't started anything as this patch depends on some other patches mostly for overspeed.
User avatar
KrevRenko
Engineer
Engineer
Posts: 104
Joined: 25 Mar 2005 14:28

Re: Plane maximum range

Post by KrevRenko »

OK, sorry about directing my whole post at you. I was really trying to argue against the idea as it is, not a person (you or anyone else.). Just trying to reason out the best way to do this (or anything I poke my nose into).

I don't like this idea because the implementation would be:

a) hackish and would be one feature (restriction) dressed up to look like something else, or
b) prone to having planes falling down on city centers around airports, if implemented properly (which would be quite complex).

This is a post regarding the topic. Nothing personal, MagicBuzz. :)
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: Plane maximum range

Post by athanasios »

Falling on city centers? That would be very complicated and require many many new graphics: Destroyed buidings sprites...
They could falll in the sea though.
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.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: Plane maximum range

Post by MagicBuzz »

athanasios wrote:Falling on city centers? That would be very complicated and require many many new graphics: Destroyed buidings sprites...
They could falll in the sea though.
easy : just use the dynamit tool...
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Re: Plane maximum range

Post by richk67 »

If I were implementing such a feature, I would re-use the UFO-landing and XCOM destroying code which makes a great job of avoiding destroying important things (eg. stations are immune, but track is not, unless it is occupied.)
OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 16 guests