How do I Avoid loading all assets at once??

Get help using Construct 2

Post » Tue Nov 04, 2014 8:15 pm

I have a fairly largely scoped project that would benefit from compartmentalizing/modularizing.

Each module is a mini-game (about 10) and will have unique game mechanics but will share some functionality between them. They also need to be content aware (i.e. You completed this mini-game, you'll like this one) all wrapped in an interactive Construct-2 "over-world."

Would it be possible to load each component separately as the player accesses them (i.e. see a loading screen for each component) or do the assets have to be downloaded from the start?

The big challenge here is mobile support.

Thanks,
A
B
3
Posts: 5
Reputation: 183

Post » Tue Nov 04, 2014 9:05 pm

well it's probably a hack but as a C2 game can call another c2 game through the browser object, would this help? it'd be horrible if you wanted to transfer info between the games I suppose.
B
7
S
3
G
1
Posts: 184
Reputation: 1,352

Post » Tue Nov 04, 2014 9:11 pm

The key is the communication between the different components. It's easy to get Construct to send stuff to the browser through javascript functions but the reverse I suppose is a different story?
B
3
Posts: 5
Reputation: 183

Post » Wed Nov 05, 2014 2:20 am

"Premature optimisation is root of evil"

Don't worry about it, As long as it's not a problem "yet", Make your game, and rest assured that @Ashley (Boss) got our backs
I believe stuff is loaded layout-by-layout, so each minigame could be a layout, etc.
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,461

Post » Wed Nov 05, 2014 8:44 pm

"Premature optimisation is root of evil" +1 for this.

I've left more decapitated Java servlets in my wake doing this than I should care to admit, haha.

You can load images dynamically from blank sprite objects using the "Load image from URL" action. You can dynamically load Text objects using AJAX and JSON.

You can load assets with AJAX too using the "Request project file" or "Request URL" then request an image URL. For instance, on our website (http://50.112.151.9/home) we load the test text and images on the "About" page using JSON AJAX calls. That way it only loads each pages content when that page is visited. But you still need blank sprite containers for all of those objects.

Like this: http://postimg.org/image/kfuv0y92z/

The JSON file that it loads from looks like this:
{
"p1":["This is a paragraph of text for JSON delivery. 1","500","200","2200"],
"p2":["This is a paragraph of text for JSON delivery. 2","500","300","2200"],
"p3":["This is a paragraph of text for JSON delivery. 3","500","400","2200"],
"p4":["This is a paragraph of text for JSON delivery. 4","500","500","2200"],
"p5":["This is a paragraph of text for JSON delivery. 5","500","600","2200"],
"p6":["This is a paragraph of text for JSON delivery. 6","500","700","2200"],
"p7":["This is a paragraph of text for JSON delivery. 7","500","800","2200"],
"img1":["wizard2.gif", "800", "900", "0"],
"img2":["wizard_male.png", "800", "400", "0"],
"img3":["", "0", "0", "0"]
}
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,418
Reputation: 4,830

Post » Tue Feb 17, 2015 10:46 am

@gumshoe2029 How does that work with caching? Is there any?
Black Bobby The Hole Greenlit with 303 votes.
B
36
S
8
G
1
Posts: 164
Reputation: 3,031

Post » Tue Feb 17, 2015 1:57 pm

Construct 2 doesn't support part-loading projects at this time. The best thing to do is probably to export separate projects and navigate between them. They can still leave data for each other by storing stuff in WebStorage.
Scirra Founder
B
398
S
236
G
88
Posts: 24,441
Reputation: 194,671

Post » Tue Feb 17, 2015 2:00 pm

Thanks @ashley
Black Bobby The Hole Greenlit with 303 votes.
B
36
S
8
G
1
Posts: 164
Reputation: 3,031

Post » Wed Mar 18, 2015 8:56 pm

Je Fawk wrote:@gumshoe2029 How does that work with caching? Is there any?


Sorry for the late reply. My scheme listed above just loads images upon entering a new layout, so that I do not have C2 load them all at the beginning. I use 1px x 1px placer images for placeholders, then just dynamically resize and place.

There is no server-side caching this way, other than what the browser does anyway.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,418
Reputation: 4,830


Return to How do I....?

Who is online

Users browsing this forum: Instrex and 20 guests