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

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

Post by LKRaider »

MinGW's MSYS also works for making diff's.

Or, you can use the Win32 version of the diff utility, released by the GnuWin32 Project - DiffUtils. By far, the simpler to get, IMO.

Also, since we're on the topic, take a look at WinMerge
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

Diffutils worked nicely, thanks :).

Problem with WinMerge is it only does one file at a time :(.

WARNING: Current release contains code which allocates and deallocates memory. Although I think it releases everything it allocates, I cannot be sure!

I would like any feedback as to whether I released the Queue correctly.

Here it is, the queue patch, Win32 executable, and language files:

*Attachments deleted - from now on, attachments will be in first post*
Last edited by CobraA1 on 04 Jun 2005 00:57, edited 2 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
Asterix
Engineer
Engineer
Posts: 121
Joined: 04 Apr 2005 18:17
Location: Germany

Post by Asterix »

Hmm, maybe I'm too blind, but I cant see, which SVN-revision this patch was made for :?:
User avatar
Invisble
Transport Coordinator
Transport Coordinator
Posts: 341
Joined: 17 May 2005 15:06
Location: England
Contact:

Post by Invisble »

OK having taken your exe and copied it to my backup/testing OpenTTD folder I have noticed a few bugs.

Basically what I did was set the game year to about 2000 and then built 2 airports, I then built one of every type of aircraft and set them flying between.

Now for the Bugs I have noticed.

1. You cannot delete airports to upgrade, if you do it crashes the game (no crash.sav produced, just a windows abnormal termination report).

2. The aircraft do this rather strange thing, they fly up to an airport to about the point where they would decend to land, if a) the runway is not clear or b) they are not number one in the que the aircraft stop in midair, turn 45 degress then fly off, slowly speeding back up to full speed (over 2/3 tiles), this happens every time untill they are number 1 in the que when they land normally.

3. Large maps take forever to generate, I know they take a long time normally anyway, but I went for a shower while waiting for one to generate and came back to find that it still had not generated 20 mins later (map size 11*11 or 2048*2048)

At the moment that is all the bugs I have found for you, when I get a chance I will play seriously around and pick out more.........

Saying that, exelent work, great patch and keep it up, I look forward to future revisions.

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

Post by LKRaider »

Winmerge also does directory diffs (this means, all files in a directory and subdirs). Just specify a directory as a loading pane instead of a file.
Use 'Tools' -> 'Generate Patch' to make the diff (make sure to define 'unified' there).


Btw, I am downloading your build right now :D


EDIT: hehehe, they can brake in midair :o I wish I'ld have a plane that could to that, heh

Also, helicopters won't use both heliports on the international airport for taking off when exiting a depot (only using one). For landing, they use both, although they also seem get queued behind airplanes, apparently... (not sure of that tho)
Last edited by LKRaider on 02 Jun 2005 16:06, edited 6 times in total.
Mek
TTDPatch Developer
TTDPatch Developer
Posts: 417
Joined: 13 Apr 2004 13:35
Location: Eindhoven, Netherlands
Contact:

Post by Mek »

Invisble wrote:3. Large maps take forever to generate, I know they take a long time normally anyway, but I went for a shower while waiting for one to generate and came back to find that it still had not generated 20 mins later (map size 11*11 or 2048*2048)
I guess that is caused by it being a debug build, and thus having all optimizations turned of
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

Hmm, maybe I'm too blind, but I cant see, which SVN-revision this patch was made for
Whatever's lying around in SourceForge. I'm not working in SVN right now . . .
1. You cannot delete airports to upgrade, if you do it crashes the game (no crash.sav produced, just a windows abnormal termination report).
OK, I'll look at it - the complete text of the error would be nice, though.
2. The aircraft do this rather strange thing, they fly up to an airport to about the point where they would decend to land, if a) the runway is not clear or b) they are not number one in the que the aircraft stop in midair, turn 45 degress then fly off, slowly speeding back up to full speed (over 2/3 tiles), this happens every time untill they are number 1 in the que when they land normally.
I'll take a look at the aircraft stopping problem. The other stuff is expected, though. I haven't implemented the other features yet.
3. Large maps take forever to generate, I know they take a long time normally anyway, but I went for a shower while waiting for one to generate and came back to find that it still had not generated 20 mins later (map size 11*11 or 2048*2048)
That's a result of this being a debug build. It has a lot of debug stuff that slows it down, and it's not fully optimized.
"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 »

Cobra, You desired the compleate text of the error report, well your wish is my command. please find attached one txt document that Windows generates to pinpoint the cause of the crash, I have no idea how much it may mean to you.

Hope it helps.
Attachments
5c3e_appcompat.txt
The Error Text (in XML format by the looks of things).
(10.36 KiB) Downloaded 492 times
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

OK, found the source of the error - I was a bit overzealous in freeing memory, and it tries to free the memory twice.

It will be fixed in the next release of my patch.

I've also thought about perhaps coordinating incoming aircraft speeds, but that leads to another problem - what happens when the position in front of the aircraft recently landed is full, and the aircraft cannot get out of the way for a coordinated landing? It messes up the entire flight pattern for all aircraft landing. So no coordinated landings until airports are redesigned.

I can, however, speed up the airplanes, shorten the airport circling behavior, and if possible line it up with the runway. That may make it more efficient for use with the queue.

One of the major problems, unfortunately, is that airports in OpenTTD are not realistic - compare to a real airport.

In a real airports, the buildings are off to one side, and the runways are paralleled by taxiways, so the aircraft can quickly get off the runway. Also, there are multiple ways to come into the terminals, so that planes don't line up as much.

Even in the International airport in OpenTTD, the "taxiway" is very short, and right away any aircraft coming from the hangar can block landing planes! Very inefficient design, if you ask me.

I'm not about to re-design the airports right now, but I do feel they could be done better. Yeah, they take up a lot of space - but then again, so do real airports :wink:!

Another thing that would help, BTW, is larger capacity aircraft - real 747s can hold 500+ people! Setting capacities to be realistic would also make aircraft a more viable choice for OpenTTD. In large cities, it is not unusual for me to see numbers in the thousands . . .
"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
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

You are right there, airports should be completely overhauled, and ideally, be modularized (so you can build/expand them at will).

Coordinating circling speed is a good idea, since planes don't stay at full speed while waiting in the airport landing pattern.
Lining up the circling behaviour would be good too.
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

Alright, another update! This time I'm putting it in the first post so it's easy to find ;).
What I've done:

-Fixed some bugs - more specifically, the airport deletion crash and the aircraft slowdown when deciding whether to land.

-Impmented Benben's aircraft speed patch, which is currently buggy - for some odd reason, aircraft slows down sometimes, then speeds up.

-Implemented the aircraft holding pattern before the runway for the International airport only. This requires making changes to the finite state machine for each airport. This also means it's a permanent part of the patch - I know of no simple way to make it optional. I will probably implement new holding patterns for all airports in the next version of the patch.

NOTE: The idea to change aircraft altitude based on queue position can't be done currently - right now, all that is known about a queue is what's on top.
"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
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

:o

Okay, some impressions after a quick test:

- Helicopters also get queued behind aircrafts, even if heliport pads are free to use
Edit: They don't land if there's an airplane on the landing runway. Weird... :?

- Speed patch displays weird behaviour (maybe because it is a debug build?)

- Queue speed should be same for all aircraft (so they circle at same speed)

- Queue circling pattern should be retangular, not have that weird little curve to align with landing strip (you know?)

- I like the new position for the circling pattern ! :D

- Aircraft should be able to enter the queue from any point, or from the four corners of the circling pattern, wichever is closer - (now it seems to be fixed on the upper position closer to the takeoff runway)

- Aircraft should have realistic acceleration (takeoff speed to cruise speed should take much longer and landing speed should be lower) :wink:

It is looking pretty good so far :D
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

- Helicopters also get queued behind aircrafts, even if heliport pads are free to use
Edit: They don't land if there's an airplane on the landing runway. Weird...
(Done)
Heh, should've known - yeah, it doesn't distinguish helicopters/aircraft in code currently, so helicopters use the queue code also. Will be changed in next version.
- Speed patch displays weird behaviour (maybe because it is a debug build?)
(Done)
Yeah, I know, I'm researching what causes it right now.
- Queue speed should be same for all aircraft (so they circle at same speed)
(Done)
OK. Will be in next version.

EDIT: What speed do you want?
- Queue circling pattern should be retangular, not have that weird little curve to align with landing strip (you know?)
(Done)
I'll move the points around to see if I can improve it.
- I like the new position for the circling pattern !
(Done)
Thank you. I'll do all airports in the next version.
- Aircraft should be able to enter the queue from any point, or from the four corners of the circling pattern, wichever is closer - (now it seems to be fixed on the upper position closer to the takeoff runway)
(rejected) - sorry, I see now easy way to do this currently.
That's because of the way the layout is designed for airports - the circling pattern is actually part of the airport layout.

I'll see what I can do about changing the conditions for entering the queue, though - perhaps when the aircraft enters a certain range?

Right now, the aircraft only enters the queue when it attempts to land.
- Aircraft should have realistic acceleration (takeoff speed to cruise speed should take much longer and landing speed should be lower) Wink
(working on it)
The acceleration algorithm is quite weird, and I don't have a full grasp of how it works yet, but I'll see what I can do.

Thanks for all of the input :). Keep it coming :).
Last edited by CobraA1 on 04 Jun 2005 20:30, edited 2 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
lucaspiller
Tycoon
Tycoon
Posts: 1228
Joined: 18 Apr 2004 20:27

Post by lucaspiller »

Sounds good, but it doesn't seem to work with the recent revision. If it is for 0.4.0.1, I suggest you update it to work with the latest revisions because it is more likely to be applied then. Also then if you use svn, you can just use the 'svn diff' command (or similar in TortoiseSVN) to create the patch.
No longer active here, but you can still reach me via email: luca[at]stackednotion[dot]com
User avatar
Arsenal
Traffic Manager
Traffic Manager
Posts: 227
Joined: 06 Jan 2004 21:25

Post by Arsenal »

- Queue speed should be same for all aircraft (so they circle at same speed)
(Waiting for input)
OK. Will be in next version.

EDIT: What speed do you want?
In real life, aeroplanes are not allowed to travel faster than 250 knots under 10000 feet. Applies to takeoffs and landings. Something to do with noise, I believe.
I'm under that impression, but correct me if I'm wrong!
User avatar
Gedemon
Traffic Manager
Traffic Manager
Posts: 150
Joined: 29 Apr 2004 21:53

Post by Gedemon »

about plane acceleration, the diff I posted in benben's topic had a slow acceleration before he edit it, maybe looking at it could help you.

about slower plane, i hadn't tested, but using this code for broken airplane :
if(v->vehstatus&VS_AIRCRAFT_BROKEN) spd = min(spd, 27 * _patches.aircraft_speed_coeff);
could make slower plane going faster when broken, no ? (edit : not slowing)

same problem could occur in queue. good luck for adjusting it ;)


and OT : seem that switch in latest SVN for plane altitude is not good when using newgrf and planes with a lot of different speeds...
Attachments
plane_loan_crash.diff
(13.38 KiB) Downloaded 386 times
Horse
Transport Coordinator
Transport Coordinator
Posts: 325
Joined: 10 Sep 2004 20:25

Post by Horse »

I use the planeset

And A Bus with 56 KM/h drive faster then the Ford 5-AT Triminator.

Especcially for bigmaps you need a realistic planespeed.
I do not Understand why this is not fixed.

I understand it is good for a 256x256 map.
But i play on 2048x2048.
Than this is very stupid.
User avatar
Gedemon
Traffic Manager
Traffic Manager
Posts: 150
Joined: 29 Apr 2004 21:53

Post by Gedemon »

The "Triminator" looks like a really hard plane :D

...

but before whinning Horse, you should learn to use a diff or even simplier a zipped binary. (first post here)

edit : and to understand why it's not fixed yet, just learn to prog...
CobraA1
Route Supervisor
Route Supervisor
Posts: 480
Joined: 07 Nov 2003 17:52
Location: USA

Post by CobraA1 »

Sounds good, but it doesn't seem to work with the recent revision.
Alright, alright - the next release will be diffed against the SVN.

Now I have to live with possible instabilities of the development version, oh well :(.
In real life, aeroplanes are not allowed to travel faster than 250 knots under 10000 feet.
250 knots (about 288 mph, according to my TI-89) it is, then.
and OT : seem that switch in latest SVN for plane altitude is not good when using newgrf and planes with a lot of different speeds...
Agreed. I'm not going to fix it myself right now, but we should use an equation here instead of a switch.
Especcially for bigmaps you need a realistic planespeed.
I do not Understand why this is not fixed.
Fear not! I have fixed that problem!

EDIT: New version of patch released!

It's based off of SVN now, and contains fixes! All of the stuff labeled as (Done) in previous posts are in the new patch. Enjoy :). Download them from the first post.
"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
LKRaider
Transport Coordinator
Transport Coordinator
Posts: 360
Joined: 23 Mar 2005 04:05
Location: Brasil
Contact:

Post by LKRaider »

Woo, nice work :)

New considerations:

- Maybe helicopters should wait in a standing queue? Don't know if it would be too hard to implement (probably is). They still seem to get queued behind planes tho... :? (they only land if the landing strip is free)

- The new fixed circling speed is very nice. There is only one problem tho... very slow planes accelerate to the minimum speed, even if that exceeds their max. Maybe make slow planes go at their max speed (75% would be ideal tho), instead of exceeding their parameters?

- Very good circling pattern, I like it :D

- Hmmm, if there could be some check of plane distance in the queue, so that planes graphics don't stay one over the other... :P

- The problem with plane entrance point on the queue is that sometimes the plane goes to the entry spot and then makes a 180 degree turn to enter the queue traffic pattern. One way to avoid this would be to have multiple entry points (the four corners of the rectangular queue pattern would be enough), or restrict plane curves, so they are not able to turn so much on one tile.

I made an animation of an example of what happens because of the entry point:
Attachments
Plane makes an unrealistic (and ugly) 180 degree turn.
Plane makes an unrealistic (and ugly) 180 degree turn.
180-degree-turn.gif (93.23 KiB) Viewed 9519 times
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 2 guests