Importing a Construct2 Game into the Intel XDK

Importing a Construct2 Game into the Intel XDK

There is a known issue with the 3491 release of the XDK and importing Construct2 apps that have been exported using the "new process" described below. That issue has been resolved with the 3522 hotfix release. Please upgrade to 3522 or later.

Also, please delete or rename the "config.xml" file that is included in the Construct2 export. It is normally found in the "www" folder of the exported project, but may also be present in the root of the exported project. The presence of that file can interfere with adding Cordova plugins to your Construct2 XDK project.

- - - - If you are updating a "NEW Style" Construct2 R225 Export into an existing XDK project... - - - -

After you have created an Intel XDK project using the "Construct2 R225 Export" process (see import section further below), you should use the techniques described below to update your Intel XDK project.

Writing over an existing Intel XDK project with the Construct2 export tool will cause problems, unless you:

  • Remove your project form the Intel XDK project list.
  • Exit the Intel XDK.
  • Replace project by exporting from Construct2 on top of your existing project.
  • Open the Intel XDK.
  • Use the green "open an Intel XDK project" button to import it as a new project (as in the import section, below).

Another approach that can be used to update an existing Intel XDK + Construct2 project is:

  • Exit the Intel XDK.
  • Export the Construct2 project to a new location on your development system (do not export on top of your existing Intel XDK project).
  • Copy the new application source files into your existing Intel XDK project (your "source files" are located in the "www" folder).
  • Restart the Intel XDK and open your now updated Construct2 project.

When using this technique, if you add or remove plugins using the Construct2 application editor/configuration tools, you will need to add or delete those plugins manually, using the Intel XDK plugin management tool located on the Projects tab. You can look inside the config.xml file that is exported for use by PhoneGap Build to get the proper name and ID for the plugins that should be part of your project, and compare those to what is listed in the Intel XDK plugin management tool.

A slight modification to the approach described above, which should only be used by those who are comfortable with low-level command-line tools, can be used to make the above approach more "automatic." It requires that you setup an active Intel XDK project and an export Construct2 project on your development system. You then link the "www" folder in your Intel XDK project to the "www" folder in the Construct2 export project. This allows you to quickly update the www folder.

A summary of this modified approach is:

  • Close the Intel XDK.
  • Export your initial Construct2 project (first time export).
  • Open the Intel XDK.
  • Open your initial Construct2 project in the Intel XDK (see the import section, below).
  • Close the Intel XDK.
  • Export your Construct2 project a second time, to a new location on your development system.
  • Replace the www folder in first project (the active XDK project) with a link to the second project's www folder.
  • Open the Intel XDK.
  • Make all subsequent exports to the second project, allowing the linked www folder in the active project to be automatically updated.

Using this technique, all subsequent updates from Construct2 must be directed to the second project location (the "update" project) and only the www folder in your initial XDK project will be updated, leaving the <project-name>.xdk file and other important project files unchanged each time you export from Construct2.

In this case your "first project" is the master XDK project, meaning it contains the plugins folder, the <project-name>.xdk file, etc. The second project is the master source code or "update" project, because it contains the www folder with all the appropriate source code resources. This approach will work best by using a hard link between the two www folders, not a soft link, which require that both projects reside on the same filesystem. Hard links are supported by Mac, Linux and Windows machines, so this solution can be used regardless of the OS on your development system.

See the discussion here > https://www.scirra.com/forum/bug-cordova-export_t182300 < for more details.

- - - - If you are importing a "NEW" Construct2 R225 Export to XDK project... - - - -

To import a Construct2 app into the Intel XDK, that was exported using the NEW Construct2 export process, please follow the instructions in thread #622015. When you export your project from Construct2 it is important that you name the export with letters, numbers and dash characters, only. Spaces and other characters will cause problems or will be rejected when you attempt to import the project into the Intel XDK.

new Construct2 export project contains a <project-name>.xdk file and a www directory. An old Construct2 export does not contain a <project-name>.xdk file or a www directory. To "import" a new Construct2 export project you must use the green "Open An Intel XDK Project" button at the bottom of the Projects tab:

 

If you are having trouble with building an iOS or Windows or Windows Phone app with a project that has been exported using the "new" C2 export process and imported using the instructions above, it may be due to a missing line in the <project-name>.xdk file. See the instructions in this post > https://software.intel.com/en-us/forums/intel-xdk/topic/621930#comment-1... < for a workaround.

- - - - The following method is for importing an "OLD" Construct2 Export to XDK project... - - - -

Please use the procedure below to increase the success of importing your Construct2 game into the Intel XDK:

  • export your game for Cordova
  • if there is a "www" directory located inside your exported Cordova project, skip the next step
  • if there is NOT a "www" directory, create a "www" directory inside your exported Cordova project
  • move all the application files and folders inside your exported project into the "www" directory (if they are not already there)
  • Leave the "config.xml" and "intelxdk.config.additions.xml" files in the top-level folder!

Now you should have a project folder that looks something like this:

Only a portion of the project file list is shown in the image above; but, in essence, all of the application files in the project should be located within the "www" directory that is located inside the exported Construct2 project. Only the "config.xml" and the "intelxdk.config.additions.xml" files (if they exist) should be located in the top-most level of the exported project.

VERY IMPORTANT! On the "Project Importer Results" dialog that appears, the XDK importer should have located your "index.html" file in the "www" directory inside your project AND you should tell it that you will use Cordova plugins AND that this is NOT a game project. See the image below:

Also, please make careful note of this warning dialog that may appear:

If you see this dialog it means that you have plugins inside an "intelxdk.config.additions.xml" file and that you need to remove them from that file and add them into your project using the Plugin Management tool on the Projects tab.

  • Open the "intelxdk.config.additions.xml" file to get the name of the plugins that you need to add to your project. See the Importing Third-Party Plugins section of this doc page > https://software.intel.com/en-us/xdk/docs/add-manage-project-plugins. The plugin ID can be found in the "intelxdk:plugin" tags located in that file. In the example below, you are going to

In this example there is one plugin specified in the file to be added to the project, and it will be added using a github repo URL. Using the plugin manager (on the Projects tab), you would do the following (remember, you're getting the github repo location from the intelxdk.config.additions.xml file, above):

  • If there are more plugins, add them using a similar technique.

IMPORTANT! Be sure to remove the plugin definitions from the intelxdk.config.additions.xml file (you can comment them out or just delete them from that file).

  • Use the Build Settings section of the Projects tab to finish configuring your project.
  • Be sure to use the Crosswalk build option for best results on Android devices.
  • Make sure the CLI setting on the Build Settings page is configured for CLI 5.1.1 (or higher).
10 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Paul,

Thanks for detailed instructions.I have created my project on XDK as per your instructions. And have successfully build my game for iOS (for some reason you need to leave contents on additions.xml to work on iOS. For Android, your instructions of clearing file content and adding plugin through Plugin Management works!)

Anyways, I tested my game on iPad the Orientation always starts in Landscape. I have set the Orientation to Landscape in both Construct 2 and XDK Build. I also tried add these lines to the additions.xml

<platform name="ios">
        <preference name="Orientation" value="landscape" />
</platform>
<config-file target="*-Info.plist" parent="UISupportedInterfaceOrientations~ipad" overwrite="true">
    <array>
        <string>UIInterfaceOrientationLandscape</string>
    </array>
</config-file>        

<config-file target="*-Info.plist" parent="UISupportedInterfaceOrientations~ipad" overwrite="true">
    <array>
        <string>UIInterfaceOrientationLandscape</string>
    </array>
</config-file> 

None of the above methods are working for me :(

I am scared my app might fail the Review process if I go ahead with this issue. Please help me (There are many on C2 forum facing the same issue) BTW, the instruction on the following to create a plugin.XML does not work! The open file dialog that opens put does not allow you to select a file, its only allows you to select a Folder, https://software.intel.com/en-us/xdk/faqs/cordova#app-orientation

Samuel, did you try the screen orientation plugin? It's much easier to use than attempting to build the dummy plugin. I've updated the FAQ note with additional instructions.

@Paul if I have a version code of 20001 in my first apk, how can I increase the version code in my next apk in intel xdk?

Exported the game with Crosswalk for android, I have a small h.264 mp4 video in the game, about 2mb, but it cannot play it.

Edit: There was an issue with construct 2,

v222 solved exporting videos. Its working now

I have my game already set up in Intel XDK but in a bit different way so I have several questions now. 

1. Does it make a performace difference if the game files are under the "www" directory instead of outside?

2. The "www" directory should basically contain ONLY C2 export? So we can simply export files there or there should be also all config files like "intelxdk.config.crosswalk.xml" etc. (except the two you mentioned)

3. Is it possible to change the overall setup with the project which is currently set up in Intel XDK? I've tried to edit the source directory but it gave me an error "Invalid project".

4. I don't really remember what I have set up while creating the project but it states "Game Engine: canvas". So I probably selected that my project is a game. Does it impact performace? And if so... can it be edited somehow?

5. If I have to set up the project again. Is it possible? I mean won't Intel XDK give me an error that this App ID is currently taken or something?

6. I have set up IAP plugin via plugin manager, but still I can see it in the "intelxdk.config.additions.xml" file. Is this correct or something is wrong here?

Thanks in advance.

1. Does it make a performace difference if the game files are under the "www" directory instead of outside?

No performance difference.

2. The "www" directory should basically contain ONLY C2 export? So we can simply export files there or there should be also all config files like "intelxdk.config.crosswalk.xml" etc. (except the two you mentioned)

The www directory should contain all of your source files, so that all of your project config and control files are located outside that directory, avoiding including extra files in your APK. The intelxdk.config.*.xml files belong in the main project folder (the www folder is inside the project folder). Also, the plugins directory will be in the project folder, at the same level as the

3. Is it possible to change the overall setup with the project which is currently set up in Intel XDK? I've tried to edit the source directory but it gave me an error "Invalid project".

It works better to make a copy of your project and reconfigure the copy, that way you have something to go back to if you run into troubles.

4. I don't really remember what I have set up while creating the project but it states "Game Engine: canvas". So I probably selected that my project is a game. Does it impact performace? And if so... can it be edited somehow?

That only impacts the project type so it includes the game asset manager. If you don't want the game asset manager you would be better off creating a new project (Cordova blank, for example) and then copying your source into that new blank project, which will have a www directory setup inside of it. It will easier to then go and re-add any plugins, etc. that you used in the old project by hand, in the new project.

5. If I have to set up the project again. Is it possible? I mean won't Intel XDK give me an error that this App ID is currently taken or something?

The only thing the XDK cares about is a special GUID that is inside your project.xdk file, inside the main project. If you use process above (previous question) you'll get a unique GUID for the new project. The app store cares about your App ID and does not know anything about the project GUID.

6. I have set up IAP plugin via plugin manager, but still I can see it in the "intelxdk.config.additions.xml" file. Is this correct or something is wrong here?

The additions.xml file is for extra bits that aren't handled by the XDK UI. It gets added to the end of the auto-generated *.config.xml files. That's where you'll see references to your plugins, etc.

Hello, I hope I help when trying to sign my app I get "Error: Android asset filenames May only Contain ASCII characters", and add several pluggings and change names and yet does not leave me, do not understand why this version new ago this...

Quote:

jaden d. wrote:

Hello, I hope I help when trying to sign my app I get "Error: Android asset filenames May only Contain ASCII characters", and add several pluggings and change names and yet does not leave me, do not understand why this version new ago this...

Please start a new thread and provide more details, the information you have provided is not sufficient to help resolve your issue. Please provide a copy of the build summary log and attach the detailed build log to your post using the Attach Media button under the "File Attachments" section.

Leave a Comment

Please sign in to add a comment. Not a member? Join today