0 Favourites

How to make a .c2addon file

  • The SDK documentation won't let me post this article right now, so I'm posting it here. Will get Tom to fix the site shortly :) This covers how to make the new .c2addon files supported in r120+.

    -------------

    The .c2addon file format allows plugin, behavior and effect developers to easily package their addon in to a single file. Users can then drag and drop the file in to the Construct 2 window to install it.

    A .c2addon file is actually a zip file with a renamed extension. The zip file always contains *info.xml* in the root, and a subfolder called *files*. What goes in the *files* folder depends on whether you're publishing a plugin, behavior or effect.

    #info.xml#

    The info.xml file specifies metadata about your addon. It states whether the type is a plugin, behavior or effect, and has information like the name, version and author of the addon. It should be straightforward to fill out. Be sure to write documentation and add the link to the documentation to info.xml.

    #Plugin and behavior files#

    When distributing a plugin or behavior, the *files* subfolder needs to contain another subfolder. For example your folder structure in the zip would be:

    info.xml

    files\myplugin\common.js

    files\myplugin\edittime.js

    files\myplugin\PluginIcon.ico

    files\myplugin\runtime.js

    *myplugin* is the name of the plugin or behavior folder, as it should appear in the install directory. Construct 2 will simply copy and paste this entire folder, preserving the folder name.

    #Effect files#

    When distributing an effect, simply place the .fx file and .xml file for the effect in the *files* subfolder in the zip, for example:

    info.xml

    files\myeffect.fx

    files\myeffect.xml

    #Packaging#

    Add all the files to a zip (right-click and 'Send to compressed (zipped) folder' in Windows Explorer). Be sure not to accidentally create a root level subfolder in the zip which itself contains info.xml - that will be rejected by Construct 2. Once zipped, rename the file so the extension is .c2addon rather than .zip. Test it by dragging and dropping the file in to the Construct 2 window. If you can install after the prompt successfully, your file is ready to distribute.

  • Ashley

    Would you please provide a sample ".c2addon" file?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Yes, please! I'm just about to release another effect.

    @Ashley

    Are we able to provide more than one plugin/behavior/effect with one .c2addon?

  • Ashley

    +1 rexrainbow asked you.

  • Ashley

    Thanks, one more question: Will C2 IDE check the version describe at xml?

  • No, the version in info.xml is simply displayed on the prompt. It will overwrite the files even if it's older than the previous version.

  • Ashley

    Thanks, because I forgot updated the version number usually. <img src="smileys/smiley9.gif" border="0" align="middle" />

  • Ashley - nice, it works!

    i can imagine some improvements:

    • associate the file extension with c2!
    • make the infos availabe in the corresponding dialogs, not just at install-time. it would greatly serve the purpose of telling what the addons actually do, if the user isn't quite sure.
    • why is it being extracted? keeping it as a c2addon would keep the directories "clean"
    • future option to have password protected c2addons to be able to offer paid addons. just came to my mind.. i should elaborate on that later...
  • Ashley

    After testing this out i encountered 2 little issues in the dialog prompt:

    1) The urls (website/documentation) are cut off after a certain length

    2) The urls do link to the pages.

  • I did a tool which creates automically the c2addon file.

    You can download it here

  • Unstickying this thread; there is now an up-to-date SDK manual entry for making .c2addon packages.

  • Nice job, septeven.

    But I think that should be a native c2addon assembler in Construct 2. Making the zip on your own seems too "low level" and error prone, don't you think?

  • For me, if I don't run Construct2 as administrator, it will not properly copy the .c2addon contents (since it cannot write to the C:\Program Files\ directory) but no error message shows up.

    Suggestions would be

    1) don't put up the "restart construct2 to see your new addons" window if the addons weren't actually installed, and instead give an error. I would consider this high priority.

    2) Have construct2 request elevated permissions to allow c2addons to be installed even if the program itself was not run as administrator

    3) Ideally, use a directory in the user's space that can hold 3rd party plugins & behaviors so Administrator access is not needed. This also allows people to quickly back up & transfer their 3rd party plugins from computer to computer. It also makes plugin development easier since the text editor could work on the in-place file without needing admin access, and source control could work off the same directory.

  • coatesjetset - it writes to appdata if it doesn't have permission to write to Program Files. The addon should still install fine.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
167 14,489
DMT2005's avatar
DMT2005
Unread sticky
1 Favourites
C2 Games made with CocoonIO
136 89,812
minhcuong's avatar
minhcuong
Unread hot topic Locked topic
83 19,085
Kyatric's avatar
Kyatric Construct Team Support