A question for experienced developers in C2/C3...

Post » Tue Aug 22, 2017 3:10 pm

What?

Doesn't the Construct 2 manual say that construct loads everything before you can even start the game? Meaning no matter how many layouts you have they will all be loaded by the time you can play the first layout.

And from there how long can it take to load things into memory. I've never experienced any jerkiness when switching layouts
B
16
S
8
G
2
Posts: 44
Reputation: 2,388

Post » Tue Aug 22, 2017 4:20 pm

BadMario wrote:What?

Doesn't the Construct 2 manual say that construct loads everything before you can even start the game? Meaning no matter how many layouts you have they will all be loaded by the time you can play the first layout.

And from there how long can it take to load things into memory. I've never experienced any jerkiness when switching layouts


From the manual:

"Construct 2 only loads the images for the current layout. This avoids loading the entire project in memory which would be slow and consume a great deal of memory. When starting a layout, all images for the objects placed in the Layout View are pre-loaded. This includes all frames in all animations of any Sprite objects. (In other words, Sprites are either fully loaded in to memory, or not at all - they are never part-loaded.) When the layout ends, all images that are loaded but not used on the next layout are released from memory."

My guess is that you haven't done any asset heavy projects yet but for us who do stutter and long loading times between layouts is a big big issue. But as I said easily solved now with the possiblity to preload exactly what you want.

And you don't have to put all assets on one layout as @Newt said. You can load exactly what you want however you want.
B
54
S
23
G
13
Posts: 751
Reputation: 12,418

Post » Tue Aug 22, 2017 5:06 pm

You might not want all objects that are in a layout at the beginning of the layout, so an optimization for that would be nice.
Adding events just to take care of that seems redundant, and prone to cause errors. Try duplicating a layout, and event sheet, and removing an object without removing associated events for example.
Image ImageImage
B
169
S
50
G
170
Posts: 8,292
Reputation: 108,728

Post » Tue Aug 22, 2017 6:47 pm

I'm not saying the plugin is but or whatever... Plugins are made to make things faster and easier indeed.
All I meant is that I'm not the one to spend money on something you can do yourself. Easy way or hard way.

newt wrote:Well the only thing you can't do with C2 is "preload" an asset that's not in the the current layout, and get some confirmation that it is loaded.


Well, you can preload . Just create an object and delete it right away (you even have some kind of confirmation that it's been loaded).
That object will stay loaded in memory until the Layout ends, making next layout load faster or be unloaded from memory with rest of the unused objects.
The idea would be to know exactly what objects are on next layout and simply create and destroy them. Preferably in some kind of sequence and time period to not make current game choke.

That's how I think that plugin work, but I bet it's nicely designed with nicer optimization and more user friendly.

@BackendFreak if you make a plugin that will let me unload any object from current layout at any time at runtime then I'm ready to pay 20$ for it or even more :)
ImageImageImageImage
B
157
S
66
G
41
Posts: 2,599
Reputation: 34,835

Post » Tue Aug 22, 2017 7:35 pm

shinkan wrote:All I meant is that I'm not the one to spend money on something you can do yourself. Easy way or hard way.


I assure you that you are not able to replicate MM_Preloader features with C2 events. I myself made an event based preloader module (before I made this plugin) and it was ~100 events which were covering just around 50% of MM_Preloader's possibilities.

shinkan wrote:@BackendFreak if you make a plugin that will let me unload any object from current layout at any time at runtime then I'm ready to pay 20$ for it or even more :)

By "unload any object " you mean literally any object or sprites or audio? I've already created unload audio features in my experimental AudioPlus plugin, which shortly after were implemented into official Audio plugin. Unloading objects which are not image and sound related doesn't make much sense as they are very small. So I assume that you mean Sprites mainly and releasing images from the memory?
Fair enough - Added onto my TODO list. Will let you know when it's out.

@Anonnymitet & @BadMario you guys are both right and not. Let me explain.
C2 indeed loads all the project assets at the very beginning as BadMario says but it has nothing to do with the between-layout lags and the fact that you @BadMario haven't noticed it, means that you've simply never worked on big enough project as @Anonnymitet says (or you have some crazy monster fast PC).

The assets that C2 loads at the very beginning are compressed images, yet at start of each layout C2 grabs particular compressed images and decompress them into bitmaps, and that's the process that causes the lag. I wrote an article which mentions this as well, so you may want to have a read: Game loading time optimization
ImageImageImage
B
27
S
16
G
74
Posts: 985
Reputation: 41,689

Post » Tue Aug 22, 2017 9:04 pm

@BackendFreak I do believe the price tag for that plugin wasn't just set to get rich fast, but rather for the proper content of the plugin:)

as of the object unloading, I'll just give you the link, will be faster that way.

https://www.scirra.com/forum/request-quot-unload-from-memory-quot-action_t121551

wow, just realize that post is 3 years old...
Like always Ashley first misunderstood the question (like most people who post there) and then totally ignored it, but there are few good posts on later pages made by people who actually knows what they doing heh :)
ImageImageImageImage
B
157
S
66
G
41
Posts: 2,599
Reputation: 34,835

Post » Tue Aug 22, 2017 9:30 pm

shinkan wrote:@BackendFreak I do believe the price tag for that plugin wasn't just set to get rich fast, but rather for the proper content of the plugin:)

as of the object unloading, I'll just give you the link, will be faster that way.

https://www.scirra.com/forum/request-quot-unload-from-memory-quot-action_t121551

wow, just realize that post is 3 years old...
Like always Ashley first misunderstood the question (like most people who post there) and then totally ignored it, but there are few good posts on later pages made by people who actually knows what they doing heh :)


Alright I understand. I wouldn't say that Ashley missunderstood the question, he just don't see the valid use-case. In the example you gave, unloading unused objects wasn't necessary cause they could lay down in the memory idly and wait for the end of layout without any harm to the device or the project. Therefore Ashley's reply.

BUT. Such unloading feature would be useful if for instance the memory limit would bee 150MB and you have to load 200MB for instance. Then first you load 100MB and turn to 16MB with Paster, then release unused 100MB and then load the remaining 100MB. This would allow you to load 200MB onto device with 150MB limit for instance.

So yes I do see the usability and I will prepare such plugin soon. I'm finishing the SyncStorage plugin at the moment and then will take a look at this one. Will keep you updated.
ImageImageImage
B
27
S
16
G
74
Posts: 985
Reputation: 41,689

Post » Tue Aug 22, 2017 9:48 pm

Are we talking about just webgl, or that, and canvas?
Image ImageImage
B
169
S
50
G
170
Posts: 8,292
Reputation: 108,728

Post » Tue Aug 22, 2017 11:28 pm

newt wrote:Are we talking about just webgl, or that, and canvas?


I know that WebGL allows you to release the memory on request. Still in canvas you can drop the reference and so the data without any pointers will be cleaned by GC.

Up to that C2 handles objects instances in a specific way with so-called "deathRow", etc. so I can't just wipe out the texture from the memory cause this will cause some issues probably. It must be done "gently" and the right way.

That's just a theory for now. I haven't investigated anything yet.
ImageImageImage
B
27
S
16
G
74
Posts: 985
Reputation: 41,689

Post » Tue Aug 22, 2017 11:47 pm

I'd hold off until the new C3 runtime, and sdk comes out.
Image ImageImage
B
169
S
50
G
170
Posts: 8,292
Reputation: 108,728

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: Anonnymitet and 2 guests