Aircraft queueing & planespeed

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
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Aircraft queueing & planespeed

Post by CobraA1 »

SUCCESS!

I've been able to do in OpenTTD what I've wanted to do in TTDPatch for a long time - aircraft queueing! A year ago, I was very bothered by broken/slower aircraft being taken over by faster aircraft, and never getting a chance to land. Ever. They'd just go around all day, while faster aircraft took over the runway.

This also uses Benben's planespeed patch, allowing the user to adjust aircraft speeds, since many people think planes going slower than trains is ridiculous.

Both the patches are together because the queueing patch adjusts some of the same lines as the planespeed patch, causing conflicts if they were to be seperated. Also, the higher plane speeds are beneficial to the queueing patch, allowing it to clear the queue faster.

The current "features" of the patch:

-Aircraft queueing, solves eternally circling aircraft problem.

-Better placed and shorter aircraft loop, allowing the queue to be cleared faster (less time in the air after an aircraft leaves the runway), and is also more visually appealing IMHO. This is a permanent change, and cannot be turned off, because of how the airport state machine works. (not finished, not in current patch)

-Aircraft further back in the queue wait at higher altitudes, which prevents aircraft from bunching up, and from flying through each other.

-Aircraft slow down when the destination airport is busy to slow down filling of the queue (and speed up a little when they're one of last two in queue, so it can be cleared faster).

-Helicopters line up in their own queue. Relatively simple compared to aircraft queueing, since helicopters can stand still :).

-Modified form of BenBen's planespeed patch.

-Descent added between queue and landing.

Internal changes not visible to the user:

-New queue type designed specifically for holding vehicles, includes features:
--Very fast operations for almost everything (usual case for most operations is O(1), worst case O(n)), despite availablility of mid-queue deletions and the ability to get a vehicle's position in the queue.
--Vecicles can be deleted from middle of queue (the primary reason for creating a new queue type - they *must* be able to do this, because the owner may do something like redirect the aircraft to a new airport)
--Vehicles know their position in the queue - used internally for making decisions and in that nice stacking effect :).
--In addition to the queue knowing which vehicle it contains, vehicles know which queue they belong to.
--Vehicle type is non-specific - queue can be made to hold trains & road vehicles as well as aircraft. But it must be a vehicle.

-Several datatypes had to have their size increased in order to overcome limits.
--Planespeed required new code to allow aircraft to move faster than one unit at a time.
--Plane heights also required changes.

NOTE: The patch is based off of the 19 September 2007 SVN - r11127.

The patch has now been submitted to FlySpray.

Current version changes the savegames - savegames made with my patch will not work with non-patched versions of OpenTTD!
Attachments
queue_release.zip
(784.59 KiB) Downloaded 501 times
queue_lang.zip
(51.71 KiB) Downloaded 400 times
queue.patch
(51.4 KiB) Downloaded 495 times
Last edited by CobraA1 on 19 Sep 2007 10:05, edited 67 times in total.
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
User avatar
Korenn
Tycoon
Tycoon
Posts: 1735
Joined: 26 Mar 2004 01:27
Location: Netherlands
Contact:

Post by Korenn »

could you NOT start a new topic about the same subject everytime you have something to report? the development forum is supposed to be tidy.
Alltaken
Tycoon
Tycoon
Posts: 1285
Joined: 03 Dec 2003 06:24
Location: Christchurch, New Zealand
Contact:

Post by Alltaken »

i think the vehicle running cost (or somthing) can also adhear to this formula...butin reverse

so that the speed difference is proportional to the running cost or somthing.

Alltaken
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

I think it could be a good solution. Would like to see it working (wooo patches!) :)
Alltaken
Tycoon
Tycoon
Posts: 1285
Joined: 03 Dec 2003 06:24
Location: Christchurch, New Zealand
Contact:

Post by Alltaken »

BTW cobra i am just curious did you get the idea from the recent topic on the scale of boats?

Alltaken
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Oh, for crying out loud! What's wrong with the way TTDPatch does it?

For those of you who don't have enough time to check it out for yourself, there's a patch, planespeed, that takes a number from 1 to 4.
The number is the number that the TTD-motion-speed is multiplied by. So, 1 has the same effect as off, and 4 means planes travel at full speed.

Slightly OT:
I'm still not sure where you folks got this eighth-speed thing; Patchman says:
TTD normally divides a plane's speed by four when calculating how fast it should move across the map.
Now, I understand OTTD could have chosen to do things differently, but could someone please cite their source for this eighth-speed claim?
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
Asterix
Engineer
Engineer
Posts: 121
Joined: 04 Apr 2005 18:17
Location: Germany

Post by Asterix »

in engines.h the aircraft-maxspeed is stored as one-eigth of the shown speed in mph
(stumbled accross it by accident ;) )

btw in .NFO it seems to be also factored by 8 (http://wiki.ttdpatch.net/tiki-index.php ... ion0Planes)
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

Korenn: For crying out loud, I only started what, 2 topics?

One was technical about a specific file, the other more general about a patch. I feel they're entirely different topics, so should be separate.
Oh, for crying out loud! What's wrong with the way TTDPatch does it?
People complained.

OpenTTD doesn't have the option at all.
Slightly OT:
I'm still not sure where you folks got this eighth-speed thing; Patchman says:
Quote:
TTD normally divides a plane's speed by four when calculating how fast it should move across the map.
Now, I understand OTTD could have chosen to do things differently, but could someone please cite their source for this eighth-speed claim?
aircraft_gui.c, lines 516, 522, 533.

SetDParam(1, v->cur_speed * 8);

SetDParam(1, v->cur_speed * 8);

SetDParam(0, v->cur_speed * 8);
For those of you who don't have enough time to check it out for yourself, there's a patch, planespeed, that takes a number from 1 to 4.
Hmm, you're right. It may be possible to combine the two patches also. I suppose it all depends on how many people want our patches.

Question: Are patches like these generally put into OpenTTD? Why or why not?

Why is the planespeed patch not in OpenTTD?
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
User avatar
Korenn
Tycoon
Tycoon
Posts: 1735
Joined: 26 Mar 2004 01:27
Location: Netherlands
Contact:

Post by Korenn »

CobraA1 wrote:Korenn: For crying out loud, I only started what, 2 topics?
maybe I overreacted a bit, there are a whole bunch of useless threads spawning on the forum and I was getting irritated about it. I'm sorry that you were the outlet :)
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

CobraA1 wrote:
DaleStan wrote:Oh, for crying out loud! What's wrong with the way TTDPatch does it?
People complained.
Oh? What did they compain about? I remember, back when planespeed was just on/off (where planespeed on means planespeed 4), people complained that on was too fast, but now planespeed 1, 2, and 3 are options too. (planespeed also fixes a TTD bug where very slow aircraft will speed up when they break down, hence usefulness of planespeed 1)
CobraA1 wrote:
DaleStan wrote:Slightly OT:
I'm still not sure where you folks got this eighth-speed thing;
aircraft_gui.c, lines 516, 522, 533.

SetDParam(1, v->cur_speed * 8);
SetDParam(1, v->cur_speed * 8);
SetDParam(0, v->cur_speed * 8);
Yeah. That would be where the displayed speed is set to 8 times the internally stored value (same as in TTD unpatched, and the reason that NFO uses mph*8). Very similar lines exist in roadveh_gui.c and ship_gui.c. Does that mean we need to adjust their in-game speeds too? :roll:

This planespeed patch is part of TTDPatch, so it can't be put in OTTD in its current form.

EDIT: Why must 8) be an emote? WHY!?
Last edited by DaleStan on 31 May 2005 05:06, edited 1 time in total.
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
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

Actually, somebody did release a patch for the plane speed for OpenTTD, it turns out (after some searching):

http://www.tt-forums.net/viewtopic.php? ... raft+speed

In any case, such a patch is much easier to implement than my non-linear formula.

Any idea if we'll be seeing benben's patch in an upcoming version of OpenTTD? Or are further changes needed?
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

I've also been playing around - and seem to have succeeded - in implementing queueing for aircraft - a concept I've been playing around with for over a year ever since I've had problems with slower (or broken) aircraft staying in the air forever when they are combined with faster aircraft.

Finally, I have quite a bit of free time to experiment, and I implemented it :).

Is it just me, or do aircraft never break down in OpenTTD :?:.
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
User avatar
Invisble
Transport Coordinator
Transport Coordinator
Posts: 341
Joined: 17 May 2005 15:06
Location: England
Contact:

Post by Invisble »

CobraA1 wrote:I've also been playing around - and seem to have succeeded - in implementing queueing for aircraft - a concept I've been playing around with for over a year ever since I've had problems with slower (or broken) aircraft staying in the air forever when they are combined with faster aircraft.

Finally, I have quite a bit of free time to experiment, and I implemented it :).

Is it just me, or do aircraft never break down in OpenTTD :?:.
whoohooo, finally something I have been looking forward to and wanting for a LOOOONG time.

Is it possible to post a diff or even a compiled exe/lang pack for the aircraft queing please?
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

Sounds like a nice patch, would like to see it aswell (a diff ?) :)
User avatar
Gedemon
Traffic Manager
Traffic Manager
Posts: 150
Joined: 29 Apr 2004 21:53

Post by Gedemon »

Hi Cobra !

me want a diff too !!! :P

suggestion : I'll love to see first plane circling lower than last one in queue...

about planespeed as Korenn as said in Benben's topic, plane position updating should be edited if you want more than 2 or 3 times original speed.

and yes, planes does break down, I use it to rise probability of crash at landing in my diff...

and last airports/planes cost should match relative speed...
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

OK, cool - I will continue to work on these patches.

I'll probably implement a method similar to benben's instead of my own, it's more realistic, plus since it can be adjusted, it's more flexible.
suggestion : I'll love to see first plane circling lower than last one in queue...
I'll see what I can do :).

WARNING: The queue only solves the problem of slow aircraft eternally circling! It does not make the airport handle more aircraft!

After some testing, it does indeed appear that the concerns about not being able to handle as many aircraft may be valid, as it requires many aircraft to wait for the correct aircraft to land before they can follow.

The planespeed patch will help alleviate it, as it will make all aircraft faster.

I will also see what I can do to decrease the size of the circling pattern when an aircraft can't land, which will also decrease the delay before an aircraft can land.

I will also look at other methods of improving it so aircraft don't have to wait as long.
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
User avatar
Invisble
Transport Coordinator
Transport Coordinator
Posts: 341
Joined: 17 May 2005 15:06
Location: England
Contact:

Post by Invisble »

Just as an Idea which I don't know if it can be implemented, to help reduce take off and landing times, why not go for a couple of options.

the first being a "outer marker" inline with the runway(s) at some point, this is where the "stack" or circling aircraft are, this would solve a/c having to wait for other a/c (short for aircraft) no1 to circle around the airport and land.

My secound idea is probably close to being impossible to impliment but I don't know.
Jet aircraft have whats known as "Point of No return", this is a pre-determined speed/distance down the runway where if the aircraft has to abort it's take off it basically cannot, it has to take off and circle around for an emergancy landing, others wise known as "take off speed". At this point very busy airports like London Heathrow already have aircraft on final approach, so what you get is about 30 secounds after one aircraft has taken off the next is landing on the same runway.

Something like this would also reduce circling times.

Final idea, instead of aircraft having to circle at a preset hight, what about as they take off they "climb" to a very high altitude and then as they get close to the outer marker of the destination airport they slowly start to sink untill they become the last aircraft in the stack. Though that is probably more eye candy than anything else.......
User avatar
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

Of course, if it is possible, make all runways avaiable to be used for landing/takeoff as needed :D

But we can wait for the first patch to be released before we start to really bug you about these extra features, hehe
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

All good ideas :). I will see what I can do.

I've got *basic* aircraft queue code working right now, I just need a way to create patches.

Anybody know of a good program for doing so?
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away" --Henry David Thoreau
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

TortoiseSVN seems to be the prefered Windows program. Alternatively, you can install cygwin and use diff (diff -u, please.)

If you're on a Mac, I don't have the slightest idea.
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
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Ahrefs [Bot] and 2 guests