Export resources to open formats (like Construct2)

This forum is currently in read-only mode.
From the Asset Store
Mine those precious space resources & start trading
  • Hello everybody,

    I am a programmer wanting to use Construct Classic as event and sprite behavior editor. To integrate CC to my current project's pipeline I would need to be able to export event sheets, properties and other info into an open and readable format (similarly to what Construct 2 does with XML).

    Now, I searched the forums for quite a while and I could not find anything related so I assumed that it is either trivial (and I am making a stupid question) or it hasn't been done yet.

    I would appreciate if anyone can help find out which one is it and, in case it's the 2nd, the advisable way to go (e.g., Plugins, compiling the CC GUI and implementing a new saving procedure etc.).

    Many thanks in advance

    PS: I prefer to use CC as opposed to Construct 2 because it's open source.

  • This is not possible in Construct Classic. Part of the reason we started Construct 2 is to re-engineer the whole architecture to be more modular, such as with our exporter system (although we haven't released the exporter development kit yet).

    So why not try going with C2? You could just read event XML files directly out the project folder rather than having to deal with Classic.

  • Thanks for the quick reply. This answers my first question handsomely.

    Are you sure it's not possible at all? Maybe it would just be very bothersome to do so. I am currently looking at the cpps used for creating cap file, just dumping the event sheet structure into a txt file looks like a feasible first step.

    PS: I would really like to make it work with CC if possible as I would like to keep the ability to hack away/workaround any issues I may find.

  • re you sure it's not possible at all? Maybe it would just be very bothersome to do so.

    It's bothersome to do so. Images and Layouts are simple enough to extract but events are tricky since ACE names are not stored in the cap, only number indexes.

    I made a python module to read/edit cap files that may be useful:

    http://dl.dropbox.com/u/5426011/utility/capreader.py

    It more or less mirrors the cpp files for saving/loading cap files.

  • Wow, you have saved me a world of pain.

    Thanks a lot.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello again, running the script you posted on spaceship.cap from the demo page, gives me the following result:

    test=capreader.capfile('spaceship.cap')

    Traceback (most recent call last):

    File "<stdin>", line 1, in <module>

    File "capreader.py", line 130, in __init__

        this.rw(cap)

    File "capreader.py", line 199, in rw

        rwArray(cap,this,'layouts','C',CLayout)

    File "capreader.py", line 67, in rwArray

        new.rw(cap)

    File "capreader.py", line 236, in rw

        rwArray(cap,this,'objects','iC0','uid',CObj,'obj')

    File "capreader.py", line 80, in rwArray

        new.rw(cap)

    File "capreader.py", line 268, in rw

        rwHeader(cap,'CObj', 3)

    File "capreader.py", line 50, in rwHeader

        assert name==newname, 'invalid header %s!=%s'%(name,newname)

    AssertionError: invalid header CObj!=?C?C?BdB???~?>????Sprite??Sprite6

    I will try to debug it over the next week (as Python is not my forte) but if the problem is trivial to anyone please feel free to enlighten me.

    Thanks again for all the help.

  • I can't reproduce that error. Did you open the cap file in construct and re-save it? I designed the script to only work with cap files saved with construct 0.9996 or newer. I also have only tested the script with python 2.6 and 2.7.

  • Im using python 2.7.3 and the Construct that is currently up for download (R1.2).

    I will try resaving the cap, without resaving and finally debugging and repost here the findings.

    Thanks again for all the help

  • Ok, I tried the code on the cap without resaving it in the new Construct and predictably I got a version error (posted at the end of this post for completeness).

    With resaving in the new CC I get the message that I originally posted.

    I will try debugging (and actually trying to understand the code) and post the results here.

    Thanks

    --result when running the cap without resaving in a new CC--

    test=capreader.capfile('spaceshipo.cap')

    Traceback (most recent call last):

    File "<stdin>", line 1, in <module>

    File "capreader.py", line 130, in __init__

        this.rw(cap) #<---

    File "capreader.py", line 145, in rw

        rwHeader(cap,'CApplication',18)

    File "capreader.py", line 51, in rwHeader

        assert version==newver, 'invalid version %d!=%d'%(version,newver)

    AssertionError: invalid version 18!=8

  • Works like a charm with Python 2.6.

    Apparently the problem was that I was using Python 2.7+

    Thanks for everything!

  • That's weird since it works for me with python 2.7.3. Anyway glad you got it working. Usually an error like that is due to some typo in my code which I can fix if I can reproduce it.

    Here is a mini example of a use of the script. It gets the names and icons of every object type in the cap.

    http://dl.dropbox.com/u/5426011/examples11/test.zip

  • Maybe it's an OS thing, my Python 2.7.3 was in Linux and I deliberately installed Python 2.6 on my Windows boot to test whether it worked on the old version.

    Maybe it was because of a case of '\' vs '/' or something OS-dependent.

    In any case, thanks for everything (including the last example), I will report on any useful tool that emerges from this work.

  • I'll have to test it in linux, and see why it's different.

    Here was the original reason for the script:

    http://www.scirra.com/forum/experimental-cap-to-c2-converter_topic42194.html

    The project is in a coma waiting for C2 to get more features that CC has. At which point I might revive it.

  • Funny that I missed that thread because making a CC to C2 converter (even if it's a bit of a lossy process) was exactly one of my secondary objectives.

    Thanks again, my progress is probably not going to be jet fast but I will do my best with the time I have.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)