NonTechnical

From X-Plane SDK
Jump to: navigation, search

So What the Heck is an X-Plane Plug-In SDK Anyway?

Simply put, the X-Plane Plug-In Software Developers Kit is a combination of code, DLLs, and documentation that allow programmers to write additions that work inside X-Plane without modifying X-Plane or having a copy of X-Plane's source.

SDKs, Why Are They Necessary

X-Plane is written in C and a compiled executable file is distributed. A programmer cannot modify X-Plane without the source code, and there's no way Austin's going to give the source code out. (This is normal. Pretty much no one who sells a progarm gives out the source code to the program; if they did, someone else could sell the program or steal some or all of the technology very easily.)

If a programmer wants to change X-Plane's data files, this is not hard to do; you simply read about how the data files are structured (nearly all of their formats are published on the web) and write a program to modify them. You can modify them using a text editor, a program like WorldMaker, an Excel spreadsheet, or another program written in C, Visual Basic, or whatever.

A programmer can also write a program that runs while X-Plane runs and send UDP data to X-Plane. But a programmer cannot draw on X-Plane's screen, react when the user clicks the mouse, etc.

The Plug-In SDK allows a programmer to do a number of things not previously possible. The programmer can draw inside X-Plane's window (in the cockpit or the 3-d world), react to keystrokes, put up floating windows, and alter the way the simulator works in a few ways. The programmer can also do anything else a program can do (save and load files, send data over the network, etc.) How does the SDK do that? The Plug-In SDK specifies a way for plug-ins to talk to X-Plane. It also provides a DLL that augments X-Plane to talk to plug-ins that follow that specification. The Plug-In SDK will contain example code that developers can copy to write plug-ins, utility routines to make writing the plug-ins easier, and a test application to make sure plug-ins work.

As part of the SDK project, we are writing a small amount of code that will go inside X-Plane, modifying X-Plane's capabilities to be able to work with the DLL we are writing. We are keeping this code as small as possible; the goal is to keep our work separate from X-Plane. What can I do with the SDK? The SDK allows some basic functionality:

  1. Drawing on the screen.
  2. Intercepting mouse clicks and keystrokes.
  3. Doing processing as the flight loop is computed.
  4. Controlling where the other planes are.
  5. Controlling the weather.
  6. Accessing and changing some variables within the simulator.

These abilities form the basic building blocks for a number of kinds of plug-ins. For example:

  • Creating new instruments (1, 2, 6)
  • Connecting XP to multiplayer gaming environments (1, 2, 3, 4, 5, 6)
  • Providing new ATC when flying alone (1, 2, 3, 6)
  • Providing a new AI to control the other planes (1, 2, 3, 4, 6)
  • Creating new scenery that animates (1, 3, 6)

In order to do these things, you will need to program! You will need to program X-Plane in C, C++, or Delphi Pascal. I strongly recommend C or C++ because Delphi Pascal is for Windows only. Plugins written in C or C++ will be somewhat easy to compile on both platforms, as long as you use certain libraries. Also, if you want to do graphics, you will need to program OpenGL. The Plug-In SDK will provide some libraries for doing basic UI tasks (creating windows, buttons, diaogs, etc.) without programming OpenGL, but to accomplish advanced graphics tasks, OpenGL is the way to go.

!! What if I want to program in Java, Visual Basic, RealBasic, etc.?

Plug-Ins run directly as part of X-Plane. We don't support higher level interpreted languages because of the performance implications. If a language can support compilation, C-bindable functions and create DLLs, you can probably use it with the X-Plane Plugin System.

You can use other languages if you write an adapter in C, C++, or Delphi. Writing the adapter is somewhat tricky, but once done, you can use the other language for everything. What if I can't program at all? Can I still create plug-ins? Unfortunately no. Plug-Ins are programs.

But a programmer can create a plug-in that uses scripts or other authoring tools to create results. For example, a programmer could write a plug-in that provides ATC based on a script. Authors could then write scriptrs without having to program.

Think of the X-Plane SDK as the foundation of a building. Its purpose is not to live in, but to provide support for rooms that you would want to live in.

There are two main targets for the SDK:

  • Programmers that want to make plug-ins for users (e.g. multiplayer gaming plug-ins, new instruments, etc.)
  • Programmers that want to make plug-ins for people to author with (e.g. script processors, dynamic object renders, and other plug-ins that require "content").

We invite other programmers eto build on the SDK and create scripting extensions, AIs, all sorts of things...please contact us if you would like to work on this; we're happy to help. The SDK is just the first step, opening the door.