Halt on Canvas Snapshot?

Discussion and feedback on Construct 2

Post » Sun Jan 11, 2015 4:20 am

I just found out that I could replicate one of my Paster-only tricks right in C2 by combining 'CanvasSnapshot' with the Sprite action 'Load image from URL' (which can take a dataURI as well) to paste a copy of my current screen to a sprite image.

In my case I'm using it to 'flatten' a number of layers together and apply a blur to it. By using this approach, I can smoothly 'fade-in' a blur effect even on my modest android device, which isn't possible when I apply blur to multiple layers. I can't blur the whole layout because I have an overlay that I want to stay unblurred.

The problem is, whenever I grab a canvas snapshot and past it to a sprite, the engine halts for a few frames (more than a few on android). I notice that we only have the option of grabbing the canvas as a png/jpeg. Is the on-the-fly (de)compression the reason behind this slowdown? Or is this just a demanding operation that takes a ton of CPU on its own?
Don't lose your work. Backup your game with Dropbox.
Posts: 1,106
Reputation: 9,202

Post » Sun Jan 11, 2015 5:13 am

You are not only compressing then decompressing but probably also hitting the disk which means IO latency... IO is far slower than in-memory operations.
Posts: 196
Reputation: 1,974

Post » Sun Jan 11, 2015 6:53 am

I think I saw something like that hapenning, which is why I prefer to use the paster (as paster seems more adapted for real time interactions). I wonder why too however.
Game design is all about decomposing the core of your game so it becomes simple instructions.
Posts: 2,122
Reputation: 17,123

Return to Construct 2 General

Who is online

Users browsing this forum: lukewasthefish and 7 guests