Directory Structure and C2

Discussion and feedback on Construct 2

Post » Tue Apr 23, 2013 10:27 pm

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.
B
9
Posts: 59
Reputation: 997

Post » Tue Apr 23, 2013 10:54 pm

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.
B
8
S
2
Posts: 63
Reputation: 1,223

Post » Tue Apr 23, 2013 11:14 pm

*snip* - Removed invalid bug I thought i'd found. Nothing to see here, carry on.    Venivididormi2013-04-23 23:17:05
B
8
S
2
Posts: 63
Reputation: 1,223

Post » Wed Apr 24, 2013 12:23 am

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.
B
9
Posts: 59
Reputation: 997

Post » Wed Apr 24, 2013 11:39 am

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.
Scirra Founder
B
357
S
214
G
72
Posts: 22,946
Reputation: 178,228

Post » Wed Apr 24, 2013 11:48 pm

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)
B
9
Posts: 59
Reputation: 997

Post » Thu Apr 25, 2013 1:12 am

Are you sure a file didn't go missing when merging/manipulating the project folder by hand?
Scirra Founder
B
357
S
214
G
72
Posts: 22,946
Reputation: 178,228

Post » Thu Apr 25, 2013 1:18 am

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 .

----


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.


Greg2013-04-25 07:20:34
B
9
Posts: 59
Reputation: 997

Post » Thu Apr 25, 2013 12:18 pm

@Ashley , that would be awesome , waiting for that one !
B
34
S
16
G
16
Posts: 2,222
Reputation: 16,564

Post » Thu Apr 25, 2013 6:19 pm

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..)
B
9
Posts: 59
Reputation: 997

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Eisenhans, humanescape and 5 guests