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:
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.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.
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
- 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.
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.
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.