Directory Structure and C2

0 favourites
  • 15 posts
From the Asset Store
a complete set of modular graphics, perfect for all kind of levelbuilding
  • I am working on a project with a friend, he is doing the majority of the scripting and I am doing the art. We both wanted work in construct at the same time on the same project, so we made two seperate duplicates of teh same project to work on, and then merge files we have a directory structure as follows:

    dropbox

    ../art

    ../code

    ../code/his

    ../code/my

    ../code/merged

    In code there are 3 projects, his project, my project, and a merged project where we take turns combining our efforts.

    We copy and paste our event sheets, layouts, and objects to the merged project when we make progress, leaving our files for local changes.

    I have been creating the png files in photoshop and saving both the PSD and PNG files in the art folder.

    So far everthing as worked fine, we can export as EXE and HTML5 with no issues, but whenever I try to export with appmobi or cocoonjs I get a missing image error. I followed up with Ludei (they looked over my project after I sent them a zip) and they insist it is an issue with either my project or c2.

    Before elevating this to a bug I wanted to ask a setup question,

    Does the art in the c2 project need to be in the same directory, does importing the png in the project not add it to the project? So do I need to change the directory structure to be

    dropbox

    ../his/code

    ../his/code/art

    ../my/code

    ../my/code/art

    ../merged/code/

    ../merged/code/art

    I avoided this initially for simplicity and to avoid 3 duplicates of art files that only I am working on, but if this is not possible I would rather tackle this change now before populating the game with all of the objects.

  • I had an issue somewhat like this a little while ago. I was importing sprites like i'd done a million times before, working working etc. Then I closed down construct 2 and later tried to reopen the capx. Got an error that it was missing a .PNG file and lost hours and hours of work. I even manually made sure the .PNG was in the directory specified, still refused to open with the same error. This has only happened to me twice out of many many hours in the program, so I didn't report it.

    However, I suspect it was because I did something funky like copy pasting image data from a sprite already in memory instead of loading a new sprite from a file. I'll see if I can repro this and provide more info.

  • *snip* - Removed invalid bug I thought i'd found. Nothing to see here, carry on.   <img src="smileys/smiley36.gif" border="0" align="middle" />

  • I actually almost posted this to that closed bug report you had been active in, but my issue is slightly different. I've tried to find best practices for a C2 directory structure but have not found anything concrete, so I created this thread.

    I am not getting an error exporting to HTML 5 or EXE and I can open the project fine, but I can not export to cocoonjs specifically, and Ludei told me I am missing image files, so I was curious if this could be due to my directory structure.

  • You really shouldn't do this by hand, because it's so easy to make mistakes like this and have images go missing. Source-control tools like SVN handle this automatically and are pretty excellent at doing that.

    I'll see if I can write up a tutorial on using SVN with Construct 2 projects at some point.

  • Thanks Ashley, I actually tried my best to set up ubersvn and tortoise svn but I had such a rough time it seemed like it was more trouble than it was worth.

    The project runs fine in html 5 (preview and export), and in EXE exports , but in cocoonjs I get this error:

    Exception loading image: null Exception: IllegalArgmentException: Cannot open the given '/data/data/com.ideateca.cocoonjslauncher/files/game/null' file path. at static com::ideateca::core::SPData com::io::AbstractFileSystem::loadFile(conststd::string&):47

    GET RESOURCE 'null': IllegalArgmentException: Cannot open the given '/data/data/com.ideateca.cocoonjslauncher/files/game/null' file path. at static com::ideateca::core::SPData com::io::AbstractFileSystem::loadFile(conststd::string&):47

    Can it cause problems having images in a folder outside of the project folder, or should I be placing everything in the project folder. With the way capx files worked I assumed that anything you add to an object/animation would compile all of the art into the project.

    I've been moving the art into the project textures folder and going to each object and loading them in from this new location, but there are so many sprites it's taking me a while so I can't confirm if this has helped or not (I got about 60% relocated into the project file, and it still cuased the issue, but the size of my cocoonjs exported zip increased so I am assuming this is adding missing files to the export)

  • Are you sure a file didn't go missing when merging/manipulating the project folder by hand?

  • No I can't confirm this for sure, I'm only about half way through checking all of our images. I am going through each image object (tileable backgrounds, sprites, etc) and loading in the image and confirming everything is correct on our end. We've merged 4 or 5 times, so there is a lot of room for error, but so far so good except for cacoonjs tests. There are no errors during exporting or testing on EXE exports or HTML 5 previews and exports. Only CacoonJS.

    Is there a way to see a list of all of the file paths for the project?

    Makes me really appreciate the IT guys at work who got our perforce and alienbran systems working <img src="smileys/smiley32.gif" border="0" align="middle" />.

    ----

    Update: I placed all of our art inside the directory structure created by construct when saving a project. I went trough every sprite, tileablebackground, and spritefont object in our project (including each frame of animation in every animated sprite) and I loaded the art from this new file location (within the directory structure, i.e., project/textures/{art})

    Everything still acts predictably and functions well with construct previews, exporting to html5, and exporting to exe, but when I export to cocoonjs I still get the same issue, exception loading image null exception, listed above.

    The size of my cocoonjs went up by about 100k (from 700 to 800k). I am using very small sprites (from 8x8 to 256x256, and a few larger "guide" sprites I am using for layout purposes that will not be "shipping")

    So after gong through all the art files I can confirm we haven not lost any art during any of our synchronizations, and there does not seem to be any instances where I have art in construct that I do not also have .png files for in the project directory structure.

    The only 3rd party plugin we are using is spritefont.

  • Ashley , that would be awesome , waiting for that one !

  • Still getting the same cocoonJS error, so the directory structure does not seems to be the issue. I removed all of the art from the game and events depending on art, and while unplayable it at least loads to cocoonjs. Is there a way I can quickly track down what image is being refrenced but loading as null, so I can fix this bug? It appears cocoonjs is looking for an image that is not there. It's odd that my game works on HTML5 and exe, but not cocoonJS. Which image could it be?! lol, I have a lot of images (UI is almost done, one full level done, and multiple characters with animation..)

  • Today I compared all of my sprite objects with what is in the zip, and they seem to be identical, so I do not know what would be causing me to get a "null" image reference error in cocoonjs. I have images in the zip for every object that relies on one, and everything works fine in HTML5 and exe.

    Could it be something to do with an object exporting with an improperly tagged -sheet#; sprites seem to get tagged -sheet# and tileable backgrounds don't, could this be related to the issue?

    Are there any suggestions for tracking down what image the cocoonjs export is looking for, the error in cocoonjs does not help me a whole lot debugging this, as I have no idea what image it's looking for and from what I can see all of the objects in my project have the appropriate images available to them.

  • It sounds like you corrupted the project when merging by hand (you should never merge by hand since it's so error prone; I've written and uploaded a tutorial on using SVN that you should read up on). I think all you can do is roll back to earlier backups until you get it working again.

  • That's terrible and project crippling news. I was able to get the project to load when deleting most of the objects, so I guess I'll trial and error try and hunt down what object CocoonJS is looking for. Some sort of error report or log would be REALLY helpful for instances like this where the only problem from my end is a missing image, and when I have over 150 images linked to various events, it would save me a whole lot of time to see "oh, it's missing image A.png"

    Our by hand merges were following the How Do I: Thread on the subject, so I did not think it was the wrong thing to do, I'll look over your SVN tutorial again, but the last time I tried to set it up I sunk a ton of time into it with little results. We started on this project almost a year ago, before cocoonJS was viable, so we've not been trying to test on cocoonJS until recently when strides were made (spritefont support specifically) so we do not have a "working cocoonjs version" all of our backups have the same error (which does narrow down which areas of the code could be causing the error)

    I just found your (new?) SVN tutorial,

    scirra.com/tutorials/537/how-to-collaborate-on-projects-with-svn

    and I'm going to read through it today and try to set it up tonight after work. It is much more detailed that previous SVN tutorials, so thank you for putting this together.

  • I'm getting these same two errors in CJS. My project includes about 300 images ranging in size from 256 x 200 up to 600 x 200. The problem is intermittent, with some images failing to load sometimes, and other images failing to load other times.

    I also see intermittent failures to load outside of CJS in the Safari browser on my ipad and in the Chrome browser on my Nexus 5. I haven't seen a failure to load for a while in a desktop browser.

    I'm really struggling with this, and I don't know what else to try. I already shrunk every image down as much as I possibly could, but I'm out of ideas.

    Ashley, would you be willing to look at a .capx if I sent it to you privately?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Are you sure the device isn't running out of memory?

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