NewGRF Airports, try 2

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
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

NewGRF Airports, try 2

Post by Yexo »

Long-wanted by some, unkown to others, here it finally is: another NewGRF Airports implementation.

Goal of this project
A lot of the elements in OpenTTD can already be modified / added by NewGRF files, think about industries, vehicles, houses etc. So far airports have been an exception: while it is possible to replace the graphics, no new airports could be added. The goal of this project is to create and implement a spec for newgrfs to be able to change / add airports.

History
A very brief history for those who don't know what happened. In 2007 richk67 started work on a project called "NewGRF (Air)ports". I quote from his topic:
The concept is to remove the hardcoded airports from OTTD, and provide them as modifiable and replaceable newgrfs, so allowing users the ability to design and include their own airports, along with specific new graphics.

Specific new features provided in this branch:
New GUI, with preview picture.
Rotateable airports (where defined)
Asymmetrical airports with holes!
Part land/part sea airports (for seaplanes)
Multi-tile depots so that a hangar can be scaled better to cross more than one tile.
Due to various reasons (which are not to be discussed in this topic) the development on that branch was stopped somewhere in 2008/2009. The approach of that branch was to include a list of nodes and transitions between nodes in a grf. For each transitions you could specify one (or a few) predifined rules when that transition was valid. Examples: block 1 is free, current aircraft is a helicopter, etc. This is very close to the internal OpenTTD airport implementation. While this allows for new airports to be created, it has the drawback that the newgrf writers are limited by the rules given in the spec. When development had just started Pikka wrote an alternative spec with more freedom for the newgrf writer. That is the spec I've taken as example and which I've build upon.

Features
  • New airports can be defined via NewGRF files
  • Non-rectangular airports
  • Rotated airports (only when a newgrf defines them)
  • Water airports
  • ... whatever airport coders can come up with
What this is not
  • Modular airports; On the other hand I'm sure Dimme wants to try and see if he can write a simple program that can create newgrf airport files.
The spec (for newgrf coders)
Please note that while this branch is being worked on the spec is subject to change. The full specification can be found here: http://users.tt-forums.net/pikka/wiki/i ... umentation.
Some design choices:
  • Airports are in many ways similar to industries. Airports are also split in "airport tiles" (the graphical component) and "airports" (the logic component).
  • The airport statemachine is completely implemented via callbacks. Every airport has 16 4-byte slots persistant storage (var 7C).
  • Aircraft gain one extra doubleword sized property to specify where they can land (normal airstrip, on water, heliport, zeppelin pylon) as well as the minimum runway length required. This property is available in the airport statemachine callback. The unused bits are reserved and can be used for other landing types.
  • The node-list is rotated by openttd. It's possible to use different nodes in different nodes by checking for the rotation in the statemachine callback, but for most airports this shouldn't be necesary.
Test airports
I've attached 5 test airports. mini_airport.grf contains a small airport with a diagonal runway and can be rotated in all directions. water_airport.grf contains a very simple water airports (without grahpics). However, since no normal plane can land on a water airport it isn't useable until someone creates a water aircraft newgrf. Graphics are partly by skidd13 and partly from opengfx. survey_camp_depot.grf is an industry with an airport, graphics by andythenorth. windfarm.grf contains the firs windfarm drawn by zephyris, it doesn't work as an airport but serves as test-case for animation. seaport.grf uses the windfarm graphics but can only be build on water. It's a testcase for the docks functionality, not-yet-complete but a ship can load at it.
License is of all newgrfs is gplv2, the source is included in the zip file.

A big thanks to Pikka for the original spec and for a lot of help with improving/discussing it to what it is now.

Download
Binaries are available here: http://www.openttd.org/download-airports
The source checked out via hg here: http://hg.openttd.org/developers/yexo/airports.hg/

Bugs / crashes
Please note that this is still in development, so an occasional crash can be expected. Please do report them.

NFORenum support
I've attached data files for nforenum that support implemented part of the spec. Also attached a diff against nforenum's data.cpp to create new data files.
Attachments
airports.zip
5 test airports
(184.42 KiB) Downloaded 3490 times
renum.zip
NFORenum data files
(1.79 KiB) Downloaded 1008 times
renum_airports.diff
Only needed if you want to compile nforenum yourself
(33.57 KiB) Downloaded 849 times
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: NewGRF Airports, try 2

Post by petert »

This seems like a really great project. Sorry that I was so eager to report bugs before. Another question that may have to do with this patch or GRFs in general, is there a maximum size limitation for airports? Also, do you have a diff for this?

Edit: Under test airports, you have a little BBCode bug, you just forgot the "]".
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: NewGRF Airports, try 2

Post by Yexo »

petert wrote:This seems like a really great project. Sorry that I was so eager to report bugs before.
No problem.
Another question that may have to do with this patch or GRFs in general, is there a maximum size limitation for airports?
Yes, there is a maximum, and I think it's the same as for industries. I'm not sure whether the limit is 16x16 or 127x127.
Also, do you have a diff for this?
No, just learn to work with hg :p
Edit: Under test airports, you have a little BBCode bug, you just forgot the "]".
Thanks, fixed.
petert
Tycoon
Tycoon
Posts: 3008
Joined: 02 Apr 2009 22:43
Location: Massachusetts, USA

Re: NewGRF Airports, try 2

Post by petert »

Yexo wrote:No, just learn to work with hg :p
Well, hg isn't the problem, I was just hoping to look at the code difference, and how else are people supposed to add this to their patchpacks?
Also, TortoiseHG for Windows.
User avatar
Gedemon
Traffic Manager
Traffic Manager
Posts: 150
Joined: 29 Apr 2004 21:53

Re: NewGRF Airports, try 2

Post by Gedemon »

here it is, great ! :D

Yexo wrote:I'm sure Dimme wants to try and see if he can write a simple program that can create newgrf airport files.
for people like me that have a lot of trouble reading / writing a nfo, this kind of programm would be more than welcome.
Eddie
Engineer
Engineer
Posts: 67
Joined: 13 Feb 2007 20:16
Location: Essex, UK
Contact:

Re: NewGRF Airports, try 2

Post by Eddie »

Yexo wrote:water_airport.grf contains a very simple water airports (without grahpics). However, since no normal plane can land on a water airport it isn't useable until someone creates a water aircraft newgrf.
What ever happened to that Ekranoplans grf that was being talked about...? *nudge nudge*
Image
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: NewGRF Airports, try 2

Post by Gremnon »

Actually, I'm fairly sure that in either AV8 or the old PlaneSet, there was a water-plane, at least one that worked on RichK's NewGRF ports.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: NewGRF Airports, try 2

Post by Yexo »

Eddie wrote:
Yexo wrote:water_airport.grf contains a very simple water airports (without grahpics). However, since no normal plane can land on a water airport it isn't useable until someone creates a water aircraft newgrf.
What ever happened to that Ekranoplans grf that was being talked about...? *nudge nudge*
I have absolutely no idea.
Gremnon wrote:Actually, I'm fairly sure that in either AV8 or the old PlaneSet, there was a water-plane, at least one that worked on RichK's NewGRF ports.
It'll have to be recoded since the spec is different.
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: NewGRF Airports, try 2

Post by Zephyris »

What ever happened to that Ekranoplans grf that was being talked about...?
You mean this one? Coding was never completed, because ekranoplan behave as ships, not planes, and are so limited to far below their real life speeds in-game. If you feel like recoding then these sprites are available.

On the subject of sea planes at one point it came upon me to model and spritise the Saunders-Roe Princess, the sprites are attached if anyone would like to code them (though I would do so outside of this thread to keep it on-topic...).

*edit* oops, forgot to say what I originally meant to: Awesome! This will be epic!
Attachments
Saunders-RoePrincess.zip
(51.04 KiB) Downloaded 774 times
0007.png
0007.png (1.49 KiB) Viewed 37743 times
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5601
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: NewGRF Airports, try 2

Post by PikkaBird »

Nice work Yexo. :) Sorry I've been a little slack about this, I'll have to try and get some av8ports coded asap. :)
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: NewGRF Airports, try 2

Post by cmoiromain »

Gonna be legen- wait for it - dary!
I am little, ugly, and nasty. How do you do?
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: NewGRF Airports, try 2

Post by Roujin »

Yexo wrote:
Bugs / crashes
Please note that this is still in development, so an occasional crash can be expected. Please do report them.
Alright.
I'm using revision h1b3fcb99, which should be the tip of your repository at the time of this post.

I have downloaded your grfs and am using the mini_airport.grf. (selected in main menu)
When clicking on "Build airport" in the airport building toolbar, the window opens with the category "small airports" selected. I can build small airports without problems (commuter airport is disabled due to game date). I can also change category to "diagonal airport" and build your mini airport without problems. However, when I select one of the other categories, an assertion fails:

file: newgrf_airport.h
line: 59
expression: airport_type < lengthof(AirportSpec::array)


---
Good luck with this project :) Glad you picked it up :)
* @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
Dimme
Transport Coordinator
Transport Coordinator
Posts: 277
Joined: 30 Jul 2008 12:42
Location: Trondheim, Norway

Re: NewGRF Airports, try 2

Post by Dimme »

Great work Yexo :D
Yexo wrote: What this is not
  • Modular airports; On the other hand I'm sure Dimme wants to try and see if he can write a simple program that can create newgrf airport files.
Sure, but it will take some time. Have just started learning nfo. With these specs I guess it is possible, looking at the amount of freedom put into it :)

First, I'm going to make some airports!
Try my modular airports minigame!

Image
User avatar
Pingaware
Director
Director
Posts: 625
Joined: 03 May 2007 20:18
Location: England

Re: NewGRF Airports, try 2

Post by Pingaware »

A pair of flying boats which worked with the previous NewGRF Airports. Whether they work with this one is another matter.

The Beriev Be-200 here and the Boeing 314 here. Just scroll down the pages to find them.
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Re: NewGRF Airports, try 2

Post by richk67 »

Good to see someone having a good go at this.

Just a quick query about the newgrf spec. In Aircraft movement states it lists 02..04 as "going to pad 1..3, respectively". Does this mean this spec is limited to 3 terminal pads?

Cheers. RichK
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
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: NewGRF Airports, try 2

Post by Zuu »

Oh, really nice to see you posting about your work. :-)

Yexo wrote:Binaries will come soon, the source checked out via hg here: http://hg.openttd.org/developers/yexo/airports.hg/
If the binaries will be built with the existing build system or at least presented at http://finger.openttd.org/versions.txt and located at the usual place, I can add them to OpenTTD Auto Update.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: NewGRF Airports, try 2

Post by Yexo »

Thanks for the bug report Roujin, it's fixed before the binaries were build.
richk67 wrote:Just a quick query about the newgrf spec. In Aircraft movement states it lists 02..04 as "going to pad 1..3, respectively". Does this mean this spec is limited to 3 terminal pads?
No, using these states is fully optional. The only states with a special meaning are listed below. The complete list is there because aircraft newgrfs check for those states to use the correct graphics, so using +-the same states is advisable, but using state 02 for "going to some pad" is entirely ok. In fact the only limit on the number of pads is the amount of space on the airport, pads don't need to be exactly 1 tile big.
Zuu wrote:
Yexo wrote:Binaries will come soon, the source checked out via hg here: http://hg.openttd.org/developers/yexo/airports.hg/
If the binaries will be built with the existing build system or at least presented at http://finger.openttd.org/versions.txt and located at the usual place, I can add them to OpenTTD Auto Update.
Binaries are as of now available via http://www.openttd.org/download-airports
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: NewGRF Airports, try 2

Post by Roujin »

Yexo wrote:Thanks for the bug report Roujin, it's fixed before the binaries were build.
[...]
Binaries are as of now available via http://www.openttd.org/download-airports
Sorry, but I'm still getting the assert with the binary you provided (h89c8ed46, win32).

"Assertion failed at line 59 of c:\openttd\compile\src\newgrf_airport.h: airport_type < lengthof(AirportSpec::array)"

Same procedure as above to produce the assert.


(wild stab in the dark (that is, IF you are not experiencing the same): maybe you've got something in your global OpenTTD dir that's essential to run this; I'm thinking of something like a definition of the original airports in the new .grf format) Sorry if that's completely off, just ignore it then ;)
* @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
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: NewGRF Airports, try 2

Post by Zuu »

Yexo wrote:Binaries are as of now available via http://www.openttd.org/download-airports
Thanks Yexo. After a while they also shown up on http://finger.openttd.org/versions.txt, so now I have added "Last NewGRF Airports" as a target to OpenTTD Auto Update for the people using that program.


Regarding the bug Roujin posted, I also get the same crash.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Dimme
Transport Coordinator
Transport Coordinator
Posts: 277
Joined: 30 Jul 2008 12:42
Location: Trondheim, Norway

Re: NewGRF Airports, try 2

Post by Dimme »

I also get the same crash as roujin, it appeared when I started the game in 1975 and tried to build an airport. When I started the game in 1990, I could build the commuter and diagnal airports, but I got the crash again after waiting a while (had some planes flying between the two mentioned airports).
Try my modular airports minigame!

Image
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 9 guests