How to correctly compile an AIR client
You will need:
- IntelliJ IDEA (I use version 2019.2.4, if you have a newer version you may need to install the flash/flex plugin).
- An Adobe AIR SDK & Compiler (I use AIR 15).
- An AS3 RotMG Client (This one should be obvious).
For people who already have a compiled client and want to just change their project structure around can skip to the bottom of the post.*
Before we get started we have to make sure your project is in order, so open up the Project Structure (CTRL+ALT+SHIFT+S, or the blue folder in the top right) and hit Modules. If you don't have an existing module or your existing module doesn't have an F on the folder (indicating its a flash module) then you must create a new module and remove the old one, you can do that by hitting the + in the top left of the window. You should see an option in the dropdown called Flash Build Configuration under framework automatically, but if this isn't the case then hit New Module.
Select flash from the module types and setup. for AIR you want your Target Platform to be Desktop as AIR is only used a desktop application for Private Servers. Untick Create sample app and Create HTML wrapper template if it's ticked and set your Target Player to be whatever is available in your SDK. If your SDK does not contain Flex components, go ahead and tick Pure ActionScript aswell. You will be met with an error anyway if you are unsure. Set the module name to your project name or whatever you want and hit Finish. IF Flash Build Configuration is already there for you, then go ahead and just follow the build config steps I just walked you through without the sample app stuff.
Make sure to set your Main Class to WebMain (you can do this by clicking ... and searching WebMain) as this is the main class of the project for all current pserver sources. The rest of the setup for that is self explanatory (configure the rest of it urself because it really doesnt matter but generally ignore every option under output folder unless you know what you're doing).
Upon opening your project you may already have a set build configuration, if this is the case then skip to Step 2. If not, next to the green hammer (build icon) there will be a button called "ADD CONFIGURATION". If you click that you will be greeted with a list of configuration options, click the + icon in the top left of the window. Look through the configuration types until you find Flash App.
Once that is complete you're going to see a build configuration, generally set to [none] and if that is the case click it and select the Module we just created, then hit OK. Make sure in the Project Structure (CTRL+ALT+SHIFT+S, or the blue folder in the top right), in modules you have your SDK set to the AIR SDK you are using, do the same in the Project tab and set the SDK.
Open up the Project Structure (CTRL+ALT+SHIFT+S, or the blue folder in the top right), select the Modules tab and select your module. Next to Type: Flex Application for web (Flash Player), you will see Change.... Click that and change Web to Desktop and make sure the Output Type is Application, then hit OK. In the Project Structure tabs, you will see AIR Package as a new tab. If you would like to add a custom descriptor to your application, hit Custom Template instead of Generated under Application Descriptor, then hit Create. You will need to configure this correctly, so make sure the descriptor is that the root of your project (its there by default), and make sure your AIR version is the same as your SDK & Compiler version. Generally you will be flagged with an error for this if it's incorrect and it will tell you the version you are using and you can change it at the top of the descriptor (<application xmlns="https://ns.adobe.com/air/application/replace with version number">). If everything is done correctly then you should be able to build the AIR application.
You will need to go to the Build tab in the main window, you should see Package AIR Application... as a new option. If you want to output an executable file then you will need to change the Desktop Application Package to captive runtime bundle in the package window. After that's setup, hit PACKAGE. After packaging is completed you will see in your output folder your module name as a folder, and inside the executable along with the swf. Repeat this last step for updating your client.
*People who already have a compiled client:
Open up the Project Structure (CTRL+ALT+SHIFT+S, or the blue folder in the top right), select the Modules tab and select your module. Next to Type: Flex Application for web (Flash Player), you will see Change.... Click that and change Web to Desktop and make sure the Output Type is Application, then hit OK. In the Project Structure tabs, you will see AIR Package as a new tab. If you would like to add a custom descriptor to your application, hit Custom Template instead of Generated under Application Descriptor, then hit Create. You will need to configure this correctly, so make sure the descriptor is that the root of your project (its there by default), and make sure your AIR version is the same as your SDK & Compiler version. Generally you will be flagged with an error for this if it's incorrect and it will tell you the version you are using and you can change it at the top of the descriptor (<application xmlns="https://ns.adobe.com/air/application/replace with version number">).
For building the client from now on, if you would like to build the AIR application instead of just the swf you will need to go to the Build tab in the main window, you should see Package AIR Application... as a new option. If you want to output an executable file then you will need to change the Desktop Application Package to captive runtime bundle in the package window. After that's setup, hit PACKAGE.
For anyone who has any trouble or questions feel free to reply to this post and i'll try and help you out.
Thanks for reading.